feat: eslint 적용 및 관련 코드 일괄 수정
This commit is contained in:
@@ -82,10 +82,7 @@ export class InMemoryGatewaySessionService implements GatewaySessionService {
|
||||
this.sessions.delete(sessionToken);
|
||||
}
|
||||
|
||||
async createGameSession(
|
||||
sessionToken: string,
|
||||
profile: string
|
||||
): Promise<GameSessionInfo | null> {
|
||||
async createGameSession(sessionToken: string, profile: string): Promise<GameSessionInfo | null> {
|
||||
const session = await this.getSession(sessionToken);
|
||||
if (!session) {
|
||||
return null;
|
||||
|
||||
@@ -4,9 +4,7 @@ import { createSimplePasswordHasher, type PasswordHasher } from './passwordHashe
|
||||
import type { CreateUserInput, UserRecord, UserRepository } from './userRepository.js';
|
||||
|
||||
// 유저 데이터 저장소를 메모리로 대체한 임시 구현.
|
||||
export const createInMemoryUserRepository = (
|
||||
hasher: PasswordHasher = createSimplePasswordHasher()
|
||||
): UserRepository => {
|
||||
export const createInMemoryUserRepository = (hasher: PasswordHasher = createSimplePasswordHasher()): UserRepository => {
|
||||
const usersByName = new Map<string, UserRecord>();
|
||||
const usersByOauthId = new Map<string, UserRecord>();
|
||||
const usersByEmail = new Map<string, UserRecord>();
|
||||
|
||||
@@ -38,9 +38,7 @@ const parseToken = (payload: Record<string, unknown>): KakaoOAuthToken => {
|
||||
accessToken: String(payload.access_token ?? ''),
|
||||
refreshToken: payload.refresh_token ? String(payload.refresh_token) : undefined,
|
||||
accessTokenExpiresIn: Number(payload.expires_in ?? 0),
|
||||
refreshTokenExpiresIn: payload.refresh_token_expires_in
|
||||
? Number(payload.refresh_token_expires_in)
|
||||
: undefined,
|
||||
refreshTokenExpiresIn: payload.refresh_token_expires_in ? Number(payload.refresh_token_expires_in) : undefined,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -141,12 +139,8 @@ export class KakaoOAuthClient {
|
||||
kakaoAccount: {
|
||||
hasEmail: Boolean(kakaoAccount.has_email ?? false),
|
||||
email: kakaoAccount.email ? String(kakaoAccount.email) : undefined,
|
||||
isEmailValid: kakaoAccount.is_email_valid
|
||||
? Boolean(kakaoAccount.is_email_valid)
|
||||
: undefined,
|
||||
isEmailVerified: kakaoAccount.is_email_verified
|
||||
? Boolean(kakaoAccount.is_email_verified)
|
||||
: undefined,
|
||||
isEmailValid: kakaoAccount.is_email_valid ? Boolean(kakaoAccount.is_email_valid) : undefined,
|
||||
isEmailVerified: kakaoAccount.is_email_verified ? Boolean(kakaoAccount.is_email_verified) : undefined,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,6 +8,5 @@ export interface PasswordHasher {
|
||||
// 비밀번호 해싱은 임시 구현이므로 이후 안전한 KDF로 교체한다.
|
||||
export const createSimplePasswordHasher = (): PasswordHasher => ({
|
||||
createSalt: () => randomBytes(16).toString('hex'),
|
||||
hash: (password: string, salt: string) =>
|
||||
createHash('sha256').update(`${salt}:${password}`).digest('hex'),
|
||||
hash: (password: string, salt: string) => createHash('sha256').update(`${salt}:${password}`).digest('hex'),
|
||||
});
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { GatewayPrisma, type GatewayPrismaClient } from '@sammo-ts/infra';
|
||||
|
||||
import { createSimplePasswordHasher, type PasswordHasher } from './passwordHasher.js';
|
||||
import type {
|
||||
CreateUserInput,
|
||||
UserOAuthInfo,
|
||||
UserRecord,
|
||||
UserRepository,
|
||||
UserSanctions,
|
||||
} from './userRepository.js';
|
||||
import type { CreateUserInput, UserOAuthInfo, UserRecord, UserRepository, UserSanctions } from './userRepository.js';
|
||||
|
||||
const readStringArray = (value: unknown): string[] => {
|
||||
if (!Array.isArray(value)) {
|
||||
|
||||
@@ -7,6 +7,5 @@ export interface GatewayRedisKeyBuilder {
|
||||
export const createGatewayRedisKeyBuilder = (prefix: string): GatewayRedisKeyBuilder => ({
|
||||
sessionKey: (sessionToken: string) => `${prefix}:session:${sessionToken}`,
|
||||
sessionGameSetKey: (sessionToken: string) => `${prefix}:session-games:${sessionToken}`,
|
||||
gameSessionKey: (profile: string, gameToken: string) =>
|
||||
`${prefix}:game-session:${profile}:${gameToken}`,
|
||||
gameSessionKey: (profile: string, gameToken: string) => `${prefix}:game-session:${profile}:${gameToken}`,
|
||||
});
|
||||
|
||||
@@ -101,10 +101,7 @@ export class RedisGatewaySessionService implements GatewaySessionService {
|
||||
await this.client.del(key);
|
||||
}
|
||||
|
||||
async createGameSession(
|
||||
sessionToken: string,
|
||||
profile: string
|
||||
): Promise<GameSessionInfo | null> {
|
||||
async createGameSession(sessionToken: string, profile: string): Promise<GameSessionInfo | null> {
|
||||
const session = await this.getSession(sessionToken);
|
||||
if (!session) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user