-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
758 additions
and
119 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
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,6 +1,7 @@ | ||
import { Injectable, UnauthorizedException } from '@nestjs/common'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import * as bcrypt from 'bcrypt'; | ||
import { Provider } from '@repo/types'; | ||
|
||
import { CreateSocialUserDto } from '@/user/dto/createSocialUser.dto'; | ||
import { UserService } from '@/user/user.service'; | ||
|
@@ -15,7 +16,7 @@ export class AuthService { | |
) {} | ||
|
||
async signupLocal(signupRequestDto: LocalSignupRequestDto) { | ||
return this.userService.createLocalUser({ provider: 'local', ...signupRequestDto }); | ||
return this.userService.createLocalUser({ provider: Provider.local, ...signupRequestDto }); | ||
} | ||
|
||
async validateLocalLogin(username: string, inputPassword: string) { | ||
|
@@ -32,17 +33,20 @@ export class AuthService { | |
|
||
async createGuestUser() { | ||
const randomNum = Math.floor(Math.random() * 10000); | ||
const response = await fetch('https://api.thecatapi.com/v1/images/search'); | ||
const catImageUrl = (await response.json())[0].url; | ||
|
||
const guestUser = { | ||
username: `guest_${randomNum}`, | ||
password: `guest_password_${randomNum}`, | ||
email: `[email protected]`, | ||
nickname: `guest_${randomNum}`, | ||
introduce: `게스트 사용자입니다. `, | ||
profileImageUrl: `https://cataas.com/cat?${Date.now()}`, | ||
profileImageUrl: catImageUrl, | ||
}; | ||
const user = await this.userService.findUserByUsername(guestUser.username); | ||
if (!user) { | ||
return this.userService.createLocalUser({ provider: 'guest', ...guestUser }); | ||
return this.userService.createLocalUser({ provider: Provider.guest, ...guestUser }); | ||
} | ||
return user; | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// config/cookie.config.ts | ||
import { Injectable } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { CookieOptions } from 'express'; | ||
|
||
@Injectable() | ||
export class CookieConfig { | ||
constructor(private configService: ConfigService) {} | ||
|
||
getAuthCookieOptions(): CookieOptions { | ||
return { | ||
httpOnly: true, | ||
secure: this.configService.get<string>('NODE_ENV') === 'production', | ||
sameSite: 'lax', | ||
path: '/', | ||
}; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,6 +7,12 @@ export class TickleDetailResponseDto { | |
}) | ||
speakerName: string; | ||
|
||
@ApiProperty({ | ||
example: 1, | ||
description: '발표자 유저 아이디', | ||
}) | ||
speakerId: number; | ||
|
||
@ApiProperty({ | ||
example: '[email protected]', | ||
description: '발표자 이메일', | ||
|
@@ -56,4 +62,16 @@ export class TickleDetailResponseDto { | |
description: '발표자 프로필 이미지 Url', | ||
}) | ||
speakerImgUrl: string; | ||
|
||
@ApiProperty({ | ||
example: 'true', | ||
description: '티클의 호스트 여부', | ||
}) | ||
isOwner: boolean; | ||
|
||
@ApiProperty({ | ||
example: 'true', | ||
description: '이미 참가신청을 했는지 여부', | ||
}) | ||
alreadyApplied: boolean; | ||
} |
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
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.