Skip to content

refactor: standardize delete return types across all domains #85

@iamfj

Description

@iamfj

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

  1. Update deleteAttachment, deleteDocument, deleteIssueRelation to return { id: string; success: boolean } (matching deleteComment).
  2. Update their callers in the command layer to pass the returned object to outputSuccess() directly.
  3. Update corresponding tests.

Acceptance Criteria

  • All delete* service functions return { id: string; success: boolean }
  • Commands pass the service result to outputSuccess() directly
  • Tests updated
  • npm run check:ci && npx tsc --noEmit && npm test && npm run build all pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions