feat: implement lobby functionality with user and server information retrieval

This commit is contained in:
2026-01-03 13:35:16 +00:00
parent 1988e180c5
commit 67d995c65f
14 changed files with 328 additions and 17 deletions
@@ -12,6 +12,14 @@ export const createInMemoryUserRepository = (
const usersByEmail = new Map<string, UserRecord>();
return {
async findById(id: string): Promise<UserRecord | null> {
for (const user of usersByName.values()) {
if (user.id === id) {
return user;
}
}
return null;
},
async findByUsername(username: string): Promise<UserRecord | null> {
return usersByName.get(username) ?? null;
},
@@ -56,6 +56,14 @@ export const createPostgresUserRepository = (
hasher: PasswordHasher = createSimplePasswordHasher()
): UserRepository => {
return {
async findById(id: string): Promise<UserRecord | null> {
const row = await prisma.appUser.findUnique({
where: {
id,
},
});
return row ? mapUser(row) : null;
},
async findByUsername(username: string): Promise<UserRecord | null> {
const row = await prisma.appUser.findUnique({
where: {
@@ -51,6 +51,7 @@ export interface CreateUserInput {
}
export interface UserRepository {
findById(id: string): Promise<UserRecord | null>;
findByUsername(username: string): Promise<UserRecord | null>;
findByOauthId(type: 'KAKAO', oauthId: string): Promise<UserRecord | null>;
findByEmail(email: string): Promise<UserRecord | null>;