mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 01:26:37 +08:00
feat(server): comment model (#12760)
close CLOUD-226 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced support for comments and replies within workspaces and documents, enabling users to create, update, delete, and resolve comments, as well as manage threaded replies. - **Bug Fixes** - Added user-friendly error messages and handling for situations where comments or replies are not found. - **Tests** - Added comprehensive tests to ensure correct behavior of comment and reply operations. - **Localization** - Added English translations for new comment and reply error messages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> #### PR Dependency Tree * **PR #12760** 👈 * **PR #12909** * **PR #12911** * **PR #12761** * **PR #12924** * **PR #12925** This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
@@ -907,4 +907,14 @@ export const USER_FRIENDLY_ERRORS = {
|
||||
args: { reason: 'string' },
|
||||
message: ({ reason }) => `Invalid indexer input: ${reason}`,
|
||||
},
|
||||
|
||||
// comment and reply errors
|
||||
comment_not_found: {
|
||||
type: 'resource_not_found',
|
||||
message: 'Comment not found.',
|
||||
},
|
||||
reply_not_found: {
|
||||
type: 'resource_not_found',
|
||||
message: 'Reply not found.',
|
||||
},
|
||||
} satisfies Record<string, UserFriendlyErrorOptions>;
|
||||
|
||||
@@ -1067,6 +1067,18 @@ export class InvalidIndexerInput extends UserFriendlyError {
|
||||
super('invalid_input', 'invalid_indexer_input', message, args);
|
||||
}
|
||||
}
|
||||
|
||||
export class CommentNotFound extends UserFriendlyError {
|
||||
constructor(message?: string) {
|
||||
super('resource_not_found', 'comment_not_found', message);
|
||||
}
|
||||
}
|
||||
|
||||
export class ReplyNotFound extends UserFriendlyError {
|
||||
constructor(message?: string) {
|
||||
super('resource_not_found', 'reply_not_found', message);
|
||||
}
|
||||
}
|
||||
export enum ErrorNames {
|
||||
INTERNAL_SERVER_ERROR,
|
||||
NETWORK_ERROR,
|
||||
@@ -1202,7 +1214,9 @@ export enum ErrorNames {
|
||||
INVALID_APP_CONFIG_INPUT,
|
||||
SEARCH_PROVIDER_NOT_FOUND,
|
||||
INVALID_SEARCH_PROVIDER_REQUEST,
|
||||
INVALID_INDEXER_INPUT
|
||||
INVALID_INDEXER_INPUT,
|
||||
COMMENT_NOT_FOUND,
|
||||
REPLY_NOT_FOUND
|
||||
}
|
||||
registerEnumType(ErrorNames, {
|
||||
name: 'ErrorNames'
|
||||
|
||||
Reference in New Issue
Block a user