mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
Reject mutations on deleted skill comments
This commit is contained in:
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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user