Skip to content

Commit

Permalink
chore(shard.lock): bump deps version & minor linter tweaks (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis authored Jun 3, 2024
1 parent e230d04 commit 7a5caf3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
12 changes: 6 additions & 6 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ shards:

connect-proxy:
git: https://github.com/spider-gazelle/connect-proxy.git
version: 2.0.0
version: 2.0.1

crc16:
git: https://github.com/maiha/crc16.cr.git
Expand All @@ -63,7 +63,7 @@ shards:

csuuid:
git: https://github.com/wyhaines/csuuid.cr.git
version: 1.0.0+git.commit.a4cf9615c6518cf27c68a1755a8c2ac4ae4fe987
version: 1.0.1+git.commit.b71cf5c899dd5cde6aff8e922bdabd5e2dfab585

db:
git: https://github.com/crystal-lang/crystal-db.git
Expand Down Expand Up @@ -171,7 +171,7 @@ shards:

office365:
git: https://github.com/placeos/office365.git
version: 1.24.0
version: 1.25.3

open_api:
git: https://github.com/elbywan/open_api.cr.git
Expand Down Expand Up @@ -227,15 +227,15 @@ shards:

place_calendar:
git: https://github.com/placeos/calendar.git
version: 4.20.1
version: 4.21.3

placeos-compiler:
git: https://github.com/placeos/compiler.git
version: 4.9.3

placeos-core:
git: https://github.com/placeos/core.git
version: 4.14.2+git.commit.f30dd7da934f29a341b23c629abb188fbce30b94
version: 4.14.4+git.commit.89ca0d0fc171ac21c6979dc80c0db4317f944ef1

placeos-core-client: # Overridden
git: https://github.com/placeos/core-client.git
Expand All @@ -255,7 +255,7 @@ shards:

placeos-models:
git: https://github.com/placeos/models.git
version: 9.47.0
version: 9.47.1

placeos-resource:
git: https://github.com/place-labs/resource.git
Expand Down
22 changes: 22 additions & 0 deletions spec/controllers/modules_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,28 @@ module PlaceOS::Api
updated = Model::Module.from_trusted_json(result.body)
updated.id.should eq mod.id
end

it "POST endpoint should discard read-only field updates" do
mod = PlaceOS::Model::Generator.module
mod_json = JSON.parse(mod.to_json)
mod_json.as_h["has_runtime_error"] = JSON::Any.new(true)
mod_json.as_h["error_timestamp"] = JSON::Any.new(0)

groups = [] of String
result = client.post(Modules.base_route, body: mod_json.to_json,
headers: Spec::Authentication.headers(sys_admin: true, support: true, groups: groups))
result.status_code.should eq 201
mod1 = PlaceOS::Model::Module.from_trusted_json(result.body)

result = client.get(path: File.join(Modules.base_route, mod1.id.as(String)),
headers: Spec::Authentication.headers)

result.status_code.should eq 200

mod2 = PlaceOS::Model::Module.from_json(result.body)
mod2.has_runtime_error.should be_false
mod2.error_timestamp.should be_nil
end
end

describe "index", tags: "search" do
Expand Down
2 changes: 1 addition & 1 deletion src/placeos-rest-api/controllers/asset_types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module PlaceOS::Api
as: {String, Int64}
).each { |(id, count)| counts[id] = count }
end

# ameba:disable Style/VerboseBlock
results.each { |type| type.asset_count = counts[type.id]? || 0_i64 }
counts
end
Expand Down
4 changes: 2 additions & 2 deletions src/placeos-rest-api/controllers/modules.cr
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ module PlaceOS::Api
query = %({#{stream}="core"} | logfmt | source = "#{current_module.id}" | level = "[E]")
results = client.query_range(query, 20, error_timestamp - 1.hour, error_timestamp, Loki::Direction::Backward)
entries = Array(String).new
results.response_data.result.as(Loki::Model::Streams).each do |stream|
stream.entries.each { |entry| entries << (entry.line.try &.gsub("+ ", "") || "\n") }
results.response_data.result.as(Loki::Model::Streams).each do |log_stream|
log_stream.entries.each { |entry| entries << (entry.line.try &.gsub("+ ", "") || "\n") }
end

entries
Expand Down

0 comments on commit 7a5caf3

Please sign in to comment.