@@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
2
2
import { InjectRepository } from '@nestjs/typeorm' ;
3
3
import { Repository } from 'typeorm' ;
4
4
import { UserReport } from '../common/entities/user-report.entity' ;
5
- import { CreateUserReportDto } from '../user-report/ dto/user-report.dto ' ;
5
+ import { UserReportRequest } from './ dto/user-report.request ' ;
6
6
import {
7
7
DataNotFoundException ,
8
8
InvalidInputValueException ,
@@ -18,14 +18,14 @@ export class UserReportService {
18
18
private readonly userService : UserService ,
19
19
) { }
20
20
21
- async createReport ( createUserReportDto : CreateUserReportDto ) : Promise < void > {
22
- const { fromUserId , toUserId , reason } = createUserReportDto ;
21
+ async createReport ( createUserReportDto : UserReportRequest ) : Promise < void > {
22
+ const { requesterId , targetId , reason } = createUserReportDto ;
23
23
24
24
const fromUser = await this . userService . findByFields ( {
25
- where : { id : fromUserId , status : StatusEnum . ACTIVATED } ,
25
+ where : { id : requesterId , status : StatusEnum . ACTIVATED } ,
26
26
} ) ;
27
27
const toUser = await this . userService . findByFields ( {
28
- where : { id : toUserId , status : StatusEnum . ACTIVATED } ,
28
+ where : { id : targetId , status : StatusEnum . ACTIVATED } ,
29
29
} ) ;
30
30
31
31
if ( ! fromUser || ! toUser ) {
@@ -35,8 +35,8 @@ export class UserReportService {
35
35
// 중복 신고 확인
36
36
const existingReport = await this . userReportRepository
37
37
. createQueryBuilder ( 'report' )
38
- . where ( 'report.fromUser = :fromUserId ' , { fromUserId } )
39
- . andWhere ( 'report.toUser = :toUserId ' , { toUserId } )
38
+ . where ( 'report.fromUser = :requesterId ' , { requesterId } )
39
+ . andWhere ( 'report.toUser = :targetId ' , { targetId } )
40
40
. andWhere ( 'report.reason = :reason' , { reason } )
41
41
. getOne ( ) ;
42
42
@@ -49,7 +49,6 @@ export class UserReportService {
49
49
toUser,
50
50
reason,
51
51
createdAt : new Date ( ) ,
52
- updatedAt : new Date ( ) ,
53
52
status : StatusEnum . ACTIVATED ,
54
53
} ) ;
55
54
0 commit comments