Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@appquality/tryber-database": "^0.44.51",
"@appquality/tryber-database": "^0.45.0",
"@appquality/wp-auth": "^1.0.7",
"@aws-crypto/sha256-js": "^5.2.0",
"@aws-sdk/hash-node": "^3.374.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ const ai_review_1 = {
bug_id: bug_1.id,
};

const ai_review_1_v2 = {
ai_status: "approved",
ai_reason: "Bug is valid",
ai_notes: "Bug has been reviewed by AI",
score_percentage: 95,
campaign_id: campaign_1.id,
bug_id: bug_1.id,
version: "v2",
};

describe("GET /campaigns/{cid}/bugs/{bid}/aiReview", () => {
beforeAll(async () => {
await tryber.tables.WpAppqEvdBug.do().insert([bug_1, bug_2, bug_3]);
Expand Down Expand Up @@ -109,6 +119,11 @@ describe("GET /campaigns/{cid}/bugs/{bid}/aiReview", () => {
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
});
await tryber.tables.AiBugReview.do().insert({
...ai_review_1_v2,
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
});
await tryber.tables.AiBugReview.do().insert({
...ai_review_1,
campaign_id: campaign_3.id,
Expand Down Expand Up @@ -195,7 +210,7 @@ describe("GET /campaigns/{cid}/bugs/{bid}/aiReview", () => {
expect(response.status).toBe(200);
});

it("Should return the AI review data", async () => {
it("Should return the AI review data (version = v1)", async () => {
const response = await request(app)
.get(`/campaigns/${campaign_1.id}/bugs/${bug_1.id}/aiReview`)
.set("Authorization", "Bearer admin");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export default class Route extends CampaignRoute<{
}

protected async getBugAiReview() {
return await tryber.tables.WpAppqEvdBug.do()
return await tryber.tables.AiBugReview.do()
.select("ai_status", "ai_reason", "ai_notes", "score_percentage")
.from("ai_bug_review")
.where("campaign_id", this.cp_id)
.where("bug_id", this.bug_id)
.where("version", "v1")
.first();
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"@babel/parser" "^7.22.5"
"@babel/traverse" "^7.22.5"

"@appquality/tryber-database@^0.44.51":
version "0.44.51"
resolved "https://registry.yarnpkg.com/@appquality/tryber-database/-/tryber-database-0.44.51.tgz#207f9713b4514f39e34ccd9f8352bbf060823a9b"
integrity sha512-8gFdIN0Uusy13wTTFmwQRgfxnhYjisFu46n263JHrcZgaPuEuV6QW7fNmOtfBAATMH7sxCecdMe6zIuf3tH2wQ==
"@appquality/tryber-database@^0.45.0":
version "0.45.0"
resolved "https://registry.yarnpkg.com/@appquality/tryber-database/-/tryber-database-0.45.0.tgz#f9483cff194b20e9dcaa2fb9cc1ebd6735e8f527"
integrity sha512-k9hAN/mKUJGNoY0RNJMggPqG+4c5O7+ieKlqoZPE7BxxxLFE6Ol/pBqWWryB/TQqEbEKiU7MnwcPVLHyHCwRRg==
dependencies:
better-sqlite3 "^8.1.0"
knex "^2.5.1"
Expand Down
Loading