import { BaseService } from './BaseService' ; import { BaseComment , User } from '../model' ; import { ObjectType } from './BaseService' ; export interface IcommentDTO { comment : string ; boardId : number ; user : User ; } export interface IdepthCommentDTO { comment : string ; commentId : number ; user : User ; } export abstract class BaseCommentService < T extends BaseComment > extends BaseService < T > { constructor ( repo ) { super ( repo ) ; } async updateReportCount ( id ) { const comment = await ( this . getById ( id ) as Promise < Partial < BaseComment > > ) ; const newComment = { reportCount : Number ( comment ?. reportCount ) + 1 , } ; return this . genericRepository . save ( { ... comment , ... newComment } as object ) ; } async update ( id , comment ) { const oldComment = await ( this . getById ( id ) as Promise < T > ) ; const newComment = { comment , } ; return this . genericRepository . save ( { ... oldComment , ... newComment , } as object ) ; } }