경로 이동

This commit is contained in:
2023-08-18 14:13:46 +00:00
parent df8b5e854b
commit aec88333c2
12 changed files with 33 additions and 33 deletions
+35
View File
@@ -0,0 +1,35 @@
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<Q extends LoginCtx & SessionCtx>(): ProcDecoratorGenerator<GameLoginCtx, Q> {
return async (ctx) => {
//NOTE: 게임 서버별로 gameLoginCtx를 따로 가져야 하는가?
let gameLoginCtx = ctx.session.getItem<GameLoginCtx>(`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];
}
}