Reject mutations on deleted skill comments

This commit is contained in:
Dotta committed 2026-06-11 17:57:24 +00:00
1 parent 1a894984b4
commit cf9542f6a3
2 files changed
+13

No files matched your search

@@ -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,
+4
View File
@@ -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);