diff --git a/server/src/__tests__/company-skills-service.test.ts b/server/src/__tests__/company-skills-service.test.ts index a41357eb22a..a4f6a0cb46e 100644 --- a/server/src/__tests__/company-skills-service.test.ts +++ b/server/src/__tests__/company-skills-service.test.ts @@ -249,6 +249,15 @@ describeEmbeddedPostgres("companySkillService.list", () => { await expect(svc.deleteComment(companyId, skillId, comment.id, { type: "user", userId: "board" })) .resolves.toMatchObject({ id: comment.id, deletedAt: expect.any(Date) }); await expect(svc.listComments(companyId, skillId)).resolves.toEqual([]); + await expect(svc.updateComment( + companyId, + skillId, + comment.id, + { body: "Resurrected." }, + { type: "user", userId: "board" }, + )).rejects.toMatchObject({ status: 404 }); + await expect(svc.deleteComment(companyId, skillId, comment.id, { type: "user", userId: "board" })) + .rejects.toMatchObject({ status: 404 }); await expect(svc.createComment( companyId, skillId, diff --git a/server/src/services/company-skills.ts b/server/src/services/company-skills.ts index fbeb5fbc3d3..569fe384e4f 100644 --- a/server/src/services/company-skills.ts +++ b/server/src/services/company-skills.ts @@ -2794,6 +2794,7 @@ export function companySkillService(db: Db) { eq(companySkillComments.companyId, companyId), eq(companySkillComments.companySkillId, skillId), eq(companySkillComments.id, commentId), + isNull(companySkillComments.deletedAt), )) .then((rows) => rows[0] ?? null); if (!existing) throw notFound("Skill comment not found"); @@ -2806,6 +2807,7 @@ export function companySkillService(db: Db) { eq(companySkillComments.companyId, companyId), eq(companySkillComments.companySkillId, skillId), eq(companySkillComments.id, commentId), + isNull(companySkillComments.deletedAt), )) .returning() .then((rows) => rows[0] ?? null); @@ -2826,6 +2828,7 @@ export function companySkillService(db: Db) { eq(companySkillComments.companyId, companyId), eq(companySkillComments.companySkillId, skillId), eq(companySkillComments.id, commentId), + isNull(companySkillComments.deletedAt), )) .then((rows) => rows[0] ?? null); if (!existing) throw notFound("Skill comment not found"); @@ -2838,6 +2841,7 @@ export function companySkillService(db: Db) { eq(companySkillComments.companyId, companyId), eq(companySkillComments.companySkillId, skillId), eq(companySkillComments.id, commentId), + isNull(companySkillComments.deletedAt), )) .returning() .then((rows) => rows[0] ?? null);