28ad3f1535
This commit introduces the foundational UI components and logic for the task management application, including task creation, calendar views, Kanban boards, and navigation elements. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ceced2fc-aa46-458d-ba87-ddd4b7bb1518 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/659922a9-0087-461c-90dd-6d9a58b81d4d/ceced2fc-aa46-458d-ba87-ddd4b7bb1518/yy9YLEW
39 lines
993 B
TypeScript
39 lines
993 B
TypeScript
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<User | undefined>;
|
|
getUserByUsername(username: string): Promise<User | undefined>;
|
|
createUser(user: InsertUser): Promise<User>;
|
|
}
|
|
|
|
export class MemStorage implements IStorage {
|
|
private users: Map<string, User>;
|
|
|
|
constructor() {
|
|
this.users = new Map();
|
|
}
|
|
|
|
async getUser(id: string): Promise<User | undefined> {
|
|
return this.users.get(id);
|
|
}
|
|
|
|
async getUserByUsername(username: string): Promise<User | undefined> {
|
|
return Array.from(this.users.values()).find(
|
|
(user) => user.username === username,
|
|
);
|
|
}
|
|
|
|
async createUser(insertUser: InsertUser): Promise<User> {
|
|
const id = randomUUID();
|
|
const user: User = { ...insertUser, id };
|
|
this.users.set(id, user);
|
|
return user;
|
|
}
|
|
}
|
|
|
|
export const storage = new MemStorage();
|