-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from skgndi12/feature/issue-164/define-interf…
…aces-and-types-for-review-and-reply-repositories [#164] Define interfaces and types for Review and Reply repositories
- Loading branch information
Showing
3 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
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,47 @@ | ||
import { Reply } from '@src/core/entities/review.entity'; | ||
import { TransactionClient } from '@src/core/ports/transaction.manager'; | ||
import { Direction } from '@src/core/services/review/types'; | ||
|
||
export interface CreateReplyParams { | ||
reviewId: number; | ||
userId: string; | ||
content: string; | ||
} | ||
|
||
export interface FindManyAndCountResponse { | ||
replies: Reply[]; | ||
replyCount: number; | ||
} | ||
|
||
export interface FindRepliesParams { | ||
reviewId: number; | ||
|
||
// sort | ||
direction: Direction; | ||
|
||
// pagination | ||
pageOffset: number; | ||
pageSize: number; | ||
} | ||
|
||
export interface UpdateReplyParams { | ||
id: number; | ||
content: string; | ||
} | ||
|
||
export interface ReplyRepository { | ||
create( | ||
params: CreateReplyParams, | ||
txClient?: TransactionClient | ||
): Promise<Reply>; | ||
findById(id: number, txClient?: TransactionClient): Promise<Reply>; | ||
findManyAndCount( | ||
params: FindRepliesParams, | ||
txClient?: TransactionClient | ||
): Promise<FindManyAndCountResponse>; | ||
update( | ||
params: UpdateReplyParams, | ||
txClient?: TransactionClient | ||
): Promise<Reply>; | ||
deleteById(id: number, txClient?: TransactionClient): Promise<void>; | ||
} |
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,54 @@ | ||
import { Review } from '@src/core/entities/review.entity'; | ||
import { TransactionClient } from '@src/core/ports/transaction.manager'; | ||
import { Direction, SortBy } from '@src/core/services/review/types'; | ||
|
||
export interface CreateReviewParams { | ||
userId: string; | ||
title: string; | ||
movieName: string; | ||
content: string; | ||
} | ||
|
||
export interface FindManyAndCountResponse { | ||
reviews: Review[]; | ||
reviewCount: number; | ||
} | ||
|
||
export interface FindReviewsParams { | ||
// filter | ||
nickname?: string; | ||
title?: string; | ||
movieName?: string; | ||
|
||
// sort | ||
sortBy: SortBy; | ||
direction: Direction; | ||
|
||
//pagination | ||
pageOffset: number; | ||
pageSize: number; | ||
} | ||
|
||
export interface UpdateReviewParams { | ||
id: number; | ||
title: string; | ||
movieName: string; | ||
content: string; | ||
} | ||
|
||
export interface ReviewRepository { | ||
create( | ||
params: CreateReviewParams, | ||
txClient?: TransactionClient | ||
): Promise<Review>; | ||
findById(id: number, txClient?: TransactionClient): Promise<Review>; | ||
findManyAndCount( | ||
params: FindReviewsParams, | ||
txClient?: TransactionClient | ||
): Promise<FindManyAndCountResponse>; | ||
update( | ||
params: UpdateReviewParams, | ||
txClient?: TransactionClient | ||
): Promise<Review>; | ||
deleteById(id: number, txClient?: TransactionClient): Promise<void>; | ||
} |
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,3 @@ | ||
export type SortBy = 'createdAt' | 'movieName'; | ||
|
||
export type Direction = 'asc' | 'desc'; |