Summary
Standardize the return type of all delete* service functions to return { id: string; success: boolean } instead of Promise<boolean>.
Context
During code review of #15 (comments edit/reply/delete), it was noted that deleteComment returns { id: string; success: boolean } while deleteAttachment, deleteDocument, and deleteIssueRelation return Promise<boolean>. The command layer then constructs a synthetic success object (e.g. outputSuccess({ success: true, message: "Document moved to trash" })).
The { id, success } pattern is better for JSON consumers — it confirms which entity was deleted and is consistent with how mutation payloads return entityId.
Affected Functions
| Service |
Current Return |
File |
deleteAttachment |
Promise<boolean> |
src/services/attachment-service.ts |
deleteDocument |
Promise<boolean> |
src/services/document-service.ts |
deleteIssueRelation |
Promise<boolean> |
src/services/issue-relation-service.ts |
deleteComment |
Promise<{ id, success }> |
src/services/comment-service.ts ✅ |
Proposed Change
- Update
deleteAttachment, deleteDocument, deleteIssueRelation to return { id: string; success: boolean } (matching deleteComment).
- Update their callers in the command layer to pass the returned object to
outputSuccess() directly.
- Update corresponding tests.
Acceptance Criteria
Summary
Standardize the return type of all
delete*service functions to return{ id: string; success: boolean }instead ofPromise<boolean>.Context
During code review of #15 (comments edit/reply/delete), it was noted that
deleteCommentreturns{ id: string; success: boolean }whiledeleteAttachment,deleteDocument, anddeleteIssueRelationreturnPromise<boolean>. The command layer then constructs a synthetic success object (e.g.outputSuccess({ success: true, message: "Document moved to trash" })).The
{ id, success }pattern is better for JSON consumers — it confirms which entity was deleted and is consistent with how mutation payloads returnentityId.Affected Functions
deleteAttachmentPromise<boolean>src/services/attachment-service.tsdeleteDocumentPromise<boolean>src/services/document-service.tsdeleteIssueRelationPromise<boolean>src/services/issue-relation-service.tsdeleteCommentPromise<{ id, success }>src/services/comment-service.ts✅Proposed Change
deleteAttachment,deleteDocument,deleteIssueRelationto return{ id: string; success: boolean }(matchingdeleteComment).outputSuccess()directly.Acceptance Criteria
delete*service functions return{ id: string; success: boolean }outputSuccess()directlynpm run check:ci && npx tsc --noEmit && npm test && npm run buildall pass