diff --git a/BE/src/auth/google.strategy.ts b/BE/src/auth/google.strategy.ts index dde566d..8c86236 100644 --- a/BE/src/auth/google.strategy.ts +++ b/BE/src/auth/google.strategy.ts @@ -22,6 +22,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') { ): Promise { const user = { email: email.emails[0].value, + auth_type: 'google', }; done(null, user); } diff --git a/BE/src/mates/mates.controller.ts b/BE/src/mates/mates.controller.ts index fccc8e3..ea59de8 100644 --- a/BE/src/mates/mates.controller.ts +++ b/BE/src/mates/mates.controller.ts @@ -33,23 +33,23 @@ export class MatesController { @ApiCreatedResponse({ description: 'OK', }) - @ApiBody({ - schema: { - properties: { - date: { - type: 'datetime', - example: '2023-11-22T14:00:00+09:00', - description: '날짜', - }, - }, - }, + @ApiQuery({ + name: 'datetime', + example: '2023-11-22T14:00:00', + description: '날짜', + }) + @ApiQuery({ + name: 'timezone', + example: '+09:00', + description: '타임존', }) @ApiOperation({ summary: '모든 친구들 조회하기 (완)' }) getMates( @User('id') user_id: number, - @Body('date') date: string, + @Query('datetime') datetime: string, + @Query('timezone') timezone: string, ): Promise { - return this.matesService.getMates(user_id, date); + return this.matesService.getMates(user_id, datetime, timezone); } @Get('/status') diff --git a/BE/src/mates/mates.service.ts b/BE/src/mates/mates.service.ts index 7a44b0c..c406f9d 100644 --- a/BE/src/mates/mates.service.ts +++ b/BE/src/mates/mates.service.ts @@ -53,10 +53,17 @@ export class MatesService { }; } - async getMates(user_id: number, date: string): Promise { - const offset = date.split(/\d\d:\d\d:\d\d/)[1]; + async getMates( + user_id: number, + datetime: string, + timezone: string, + ): Promise { + if (!user_id || !datetime || !timezone) { + throw new BadRequestException('인자의 형식이 잘못되었습니다.'); + } + const offset = timezone[0] === ' ' ? `+${timezone.trim()}` : timezone; - const nowUserTime = moment(date) + const nowUserTime = moment(`${datetime}${timezone}`) .utcOffset(offset) .format('YYYY-MM-DD HH:mm:ss');