import { type User, type InsertUser } from "@shared/schema"; import { randomUUID } from "crypto"; // modify the interface with any CRUD methods // you might need export interface IStorage { getUser(id: string): Promise; getUserByUsername(username: string): Promise; createUser(user: InsertUser): Promise; } export class MemStorage implements IStorage { private users: Map; constructor() { this.users = new Map(); } async getUser(id: string): Promise { return this.users.get(id); } async getUserByUsername(username: string): Promise { return Array.from(this.users.values()).find( (user) => user.username === username, ); } async createUser(insertUser: InsertUser): Promise { const id = randomUUID(); const user: User = { ...insertUser, id }; this.users.set(id, user); return user; } } export const storage = new MemStorage();