Skip to content

Commit

Permalink
feat: Save duplicate from
Browse files Browse the repository at this point in the history
  • Loading branch information
d-beezee committed May 30, 2024
1 parent 3c77151 commit 54a40fe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
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.40.0",
"@appquality/tryber-database": "^0.40.3",
"@appquality/wp-auth": "^1.0.7",
"@googlemaps/google-maps-services-js": "^3.3.7",
"@sendgrid/mail": "^7.6.0",
Expand Down
18 changes: 18 additions & 0 deletions src/routes/dossiers/_post/duplication.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,4 +549,22 @@ describe("Route POST /dossiers - duplication", () => {
WordpressJsonApiTrigger.prototype.generatePages
).not.toHaveBeenCalled();
});

it("Should save duplication origin", async () => {
const response = await request(app)
.post("/dossiers")
.send({ ...baseRequest, duplicate: { campaign: 1 } })
.set("Authorization", "Bearer admin");

expect(response.status).toBe(201);

const id = response.body.id;

const campaign = await tryber.tables.WpAppqEvdCampaign.do()
.select("duplicate_from")
.where({ id })
.first();

expect(campaign).toHaveProperty("duplicate_from", 1);
});
});
1 change: 1 addition & 0 deletions src/routes/dossiers/_post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export default class RouteItem extends UserRoute<{
cust_bug_vis: campaignToDuplicate.cust_bug_vis,
campaign_type: campaignToDuplicate.campaign_type,
campaign_pts: campaignToDuplicate.campaign_pts,
duplicate_from: campaignToDuplicate.id,
}
: {}),
})
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.40.0":
version "0.40.0"
resolved "https://registry.yarnpkg.com/@appquality/tryber-database/-/tryber-database-0.40.0.tgz#c4cec8c65ca756414d29763adbd51a701dc396bb"
integrity sha512-54VpXGy8601sORtN14YBRQKcTPFxXu67zaeEhV1ycJ/SnMAZQeSEnmFqQN0G2o3jt5KX89TtMi0ndpRrOme7kg==
"@appquality/tryber-database@^0.40.3":
version "0.40.3"
resolved "https://registry.yarnpkg.com/@appquality/tryber-database/-/tryber-database-0.40.3.tgz#94bd841393ddfe269cb7d2f73e3cd401071f3a41"
integrity sha512-xseQiNLwef5AK11DwOyblVPDd0oeyzMXT+MLzv5y/t+tGe1NonI5yYZEF7UJAnmkCFRneZPRTBe4P++svVE2bA==
dependencies:
better-sqlite3 "^8.1.0"
knex "^2.5.1"
Expand Down

0 comments on commit 54a40fe

Please sign in to comment.