import type { LoginCtx } from "./ReqLogin.js"; import type { SessionCtx } from "./StartSession.js"; import type { ProcDecoratorGenerator } from "./base.js"; export type GameLoginCtx = { generalID: number; generalName: string; gameLoginDate: Date; } export function ReqGameLogin(): ProcDecoratorGenerator { return async (ctx) => { //NOTE: 게임 서버별로 gameLoginCtx를 따로 가져야 하는가? let gameLoginCtx = ctx.session.getItem(`gameLoginCtx`); if(gameLoginCtx){ if(gameLoginCtx.gameLoginDate >= ctx.loginDate){ return [{ result: true, },{ ...gameLoginCtx, ...ctx, }]; } gameLoginCtx = undefined; } //TODO: DB에서 generalID를 가져오는 로직 return [{ result: false, type: 'Required GameLogin', info: 'NotYetImplemented' }, ctx]; } }