Skip to content

Commit

Permalink
fix(builds): fix exclusive tags query (#1173)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->
**Not manually tested**

Fixes RVTEE-645
## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Sep 28, 2024
1 parent 8e08889 commit b8c323a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions svc/api/servers/src/route/builds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ pub async fn patch_tags(
.check_game(ctx.op_ctx(), game_id, env_id, false)
.await?;

let tags: HashMap<String, String> =
serde_json::from_value::<HashMap<String, String>>(unwrap!(body.tags))?;
let tags = unwrap_with!(body.tags, API_BAD_BODY, error = "missing field `tags`");
let tags = serde_json::from_value::<HashMap<String, String>>(tags)
.map_err(|err| err_code!(API_BAD_BODY, error = err))?;

ctx.op(build::ops::get::Input {
build_ids: vec![build_id],
Expand Down
8 changes: 4 additions & 4 deletions svc/pkg/build/src/ops/patch_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ pub async fn patch_tags(ctx: &OperationCtx, input: &Input) -> GlobalResult<Outpu
SET tags = (
SELECT jsonb_object_agg(key, value)
FROM jsonb_each(tags)
WHERE NOT (key = ANY($2::text[]))
WHERE NOT (key = ANY($2::TEXT[]))
)
WHERE
b.game_id = (
SELECT game_id
b.env_id = (
SELECT env_id
FROM db_build.builds
WHERE build_id = $1
)
AND tags ?| $2::text[];
AND tags ?| $2::TEXT[]
",
&build_id,
&exclusive_tags,
Expand Down

0 comments on commit b8c323a

Please sign in to comment.