generated from xgeekshq/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: comment repository (#1214)
- Loading branch information
1 parent
1703362
commit 0bbf6a0
Showing
17 changed files
with
350 additions
and
227 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
backend/src/modules/comments/applications/create.comment.application.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
backend/src/modules/comments/applications/delete.comment.application.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,43 @@ | ||
import { CreateCommentApplicationImpl } from './applications/create.comment.application'; | ||
import { DeleteCommentApplicationImpl } from './applications/delete.comment.application'; | ||
import { UpdateCommentApplicationImpl } from './applications/update.comment.application'; | ||
import { DeleteCommentApplication } from './applications/delete.comment.application'; | ||
import { CreateCommentApplication } from './applications/create.comment.application'; | ||
import { UpdateCommentApplication } from './applications/update.comment.application'; | ||
import { TYPES } from './interfaces/types'; | ||
import CreateCommentServiceImpl from './services/create.comment.service'; | ||
import DeleteCommentServiceImpl from './services/delete.comment.service'; | ||
import UpdateCommentServiceImpl from './services/update.comment.service'; | ||
import { CommentRepository } from './repositories/comment.repository'; | ||
import CreateCommentService from './services/create.comment.service'; | ||
import DeleteCommentService from './services/delete.comment.service'; | ||
import UpdateCommentService from './services/update.comment.service'; | ||
|
||
export const createCommentService = { | ||
provide: TYPES.services.CreateCommentService, | ||
useClass: CreateCommentServiceImpl | ||
useClass: CreateCommentService | ||
}; | ||
|
||
export const updateCommentService = { | ||
provide: TYPES.services.UpdateCommentService, | ||
useClass: UpdateCommentServiceImpl | ||
useClass: UpdateCommentService | ||
}; | ||
|
||
export const deleteCommentService = { | ||
provide: TYPES.services.DeleteCommentService, | ||
useClass: DeleteCommentServiceImpl | ||
useClass: DeleteCommentService | ||
}; | ||
|
||
export const createCommentApplication = { | ||
provide: TYPES.applications.CreateCommentApplication, | ||
useClass: CreateCommentApplicationImpl | ||
useClass: CreateCommentApplication | ||
}; | ||
|
||
export const updateCommentApplication = { | ||
provide: TYPES.applications.UpdateCommentApplication, | ||
useClass: UpdateCommentApplicationImpl | ||
useClass: UpdateCommentApplication | ||
}; | ||
|
||
export const deleteCommentApplication = { | ||
provide: TYPES.applications.DeleteCommentApplication, | ||
useClass: DeleteCommentApplicationImpl | ||
useClass: DeleteCommentApplication | ||
}; | ||
|
||
export const commentRepository = { | ||
provide: TYPES.repositories.CommentRepository, | ||
useClass: CommentRepository | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
backend/src/modules/comments/interfaces/applications/create.comment.application.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/src/modules/comments/interfaces/applications/delete.comment.application.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
backend/src/modules/comments/interfaces/repositories/comment.repository.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { BaseInterfaceRepository } from 'src/libs/repositories/interfaces/base.repository.interface'; | ||
import Board from 'src/modules/boards/entities/board.schema'; | ||
|
||
export interface CommentRepositoryInterface extends BaseInterfaceRepository<Board> { | ||
// CREATE COMMENTS | ||
insertItemComment( | ||
boardId: string, | ||
cardId: string, | ||
itemId: string, | ||
userId: string, | ||
text: string, | ||
anonymous: boolean | ||
): Promise<Board>; | ||
|
||
insertCardGroupComment( | ||
boardId: string, | ||
cardId: string, | ||
userId: string, | ||
text: string, | ||
anonymous: boolean | ||
): Promise<Board>; | ||
|
||
// UPDATE COMMENTS | ||
updateItemComment( | ||
boardId: string, | ||
cardId: string, | ||
cardItemId: string, | ||
commentId: string, | ||
text: string, | ||
anonymous: boolean | ||
): Promise<Board>; | ||
|
||
updateCardGroupComment( | ||
boardId: string, | ||
cardId: string, | ||
commentId: string, | ||
text: string, | ||
anonymous: boolean | ||
): Promise<Board>; | ||
|
||
// DELETE COMMENTS | ||
deleteItemComment(boardId: string, commentId: string, userId: string): Promise<Board>; | ||
|
||
deleteCardGroupComment(boardId: string, commentId: string, userId: string): Promise<Board>; | ||
} |
17 changes: 4 additions & 13 deletions
17
backend/src/modules/comments/interfaces/services/delete.comment.service.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
import { LeanDocument } from 'mongoose'; | ||
import { BoardDocument } from 'src/modules/boards/entities/board.schema'; | ||
import Board from 'src/modules/boards/entities/board.schema'; | ||
|
||
export interface DeleteCommentService { | ||
deleteItemComment( | ||
boardId: string, | ||
commentId: string, | ||
userId: string | ||
): Promise<LeanDocument<BoardDocument>>; | ||
export interface DeleteCommentServiceInterface { | ||
deleteItemComment(boardId: string, commentId: string, userId: string): Promise<Board>; | ||
|
||
deleteCardGroupComment( | ||
boardId: string, | ||
commentId: string, | ||
userId: string | ||
): Promise<LeanDocument<BoardDocument>>; | ||
deleteCardGroupComment(boardId: string, commentId: string, userId: string): Promise<Board>; | ||
} |
11 changes: 4 additions & 7 deletions
11
backend/src/modules/comments/interfaces/services/update.comment.service.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import { LeanDocument } from 'mongoose'; | ||
import { BoardDocument } from 'src/modules/boards/entities/board.schema'; | ||
import Board from 'src/modules/boards/entities/board.schema'; | ||
|
||
export interface UpdateCommentService { | ||
export interface UpdateCommentServiceInterface { | ||
updateItemComment( | ||
boardId: string, | ||
cardId: string, | ||
cardItemId: string, | ||
commentId: string, | ||
userId: string, | ||
text: string, | ||
anonymous: boolean | ||
): Promise<LeanDocument<BoardDocument> | null>; | ||
): Promise<Board>; | ||
|
||
updateCardGroupComment( | ||
boardId: string, | ||
cardId: string, | ||
commentId: string, | ||
userId: string, | ||
text: string, | ||
anonymous: boolean | ||
): Promise<LeanDocument<BoardDocument> | null>; | ||
): Promise<Board>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.