import { users, type User, type InsertUser } from "@shared/schema"; // modify the interface with any CRUD methods // you might need export interface IStorage { getUser(id: number): Promise; getUserByUsername(username: string): Promise; createUser(user: InsertUser): Promise; } export class MemStorage implements IStorage { private users: Map; currentId: number; constructor() { this.users = new Map(); this.currentId = 1; } async getUser(id: number): 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 = this.currentId++; const user: User = { ...insertUser, id }; this.users.set(id, user); return user; } } export const storage = new MemStorage();