Set up project configuration and base UI components

Initializes the project with necessary configurations, including Replit settings and a .gitignore file. It also introduces foundational UI components for the application, such as buttons, dialogs, and layout elements, likely for the Pomodoro timer application.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 59a5ae27-3c71-459b-b42f-fe14121bf9c3
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3007b6f6-d03b-45e1-9ed1-7ce8de18ea24/59a5ae27-3c71-459b-b42f-fe14121bf9c3/Uupe4F4
This commit is contained in:
ingecarlosgutie
2025-08-31 20:11:52 +00:00
parent 64aa1e69a0
commit 80595e7002
89 changed files with 17597 additions and 0 deletions

76
server/storage.ts Normal file
View File

@@ -0,0 +1,76 @@
import { type Session, type InsertSession, type DeviceProfile, type InsertDeviceProfile } from "@shared/schema";
import { randomUUID } from "crypto";
export interface IStorage {
// Sessions
createSession(session: InsertSession): Promise<Session>;
getSessionsByDeviceId(deviceId: string, limit?: number): Promise<Session[]>;
getSessionsInDateRange(deviceId: string, startDate: Date, endDate: Date): Promise<Session[]>;
// Device Profiles
createDeviceProfile(profile: InsertDeviceProfile): Promise<DeviceProfile>;
getDeviceProfile(deviceId: string): Promise<DeviceProfile | undefined>;
updateDeviceProfileActivity(deviceId: string): Promise<void>;
}
export class MemStorage implements IStorage {
private sessions: Map<string, Session> = new Map();
private deviceProfiles: Map<string, DeviceProfile> = new Map();
async createSession(insertSession: InsertSession): Promise<Session> {
const id = randomUUID();
const session: Session = {
...insertSession,
id,
};
this.sessions.set(id, session);
return session;
}
async getSessionsByDeviceId(deviceId: string, limit = 50): Promise<Session[]> {
const sessions = Array.from(this.sessions.values())
.filter(session => session.deviceId === deviceId)
.sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime())
.slice(0, limit);
return sessions;
}
async getSessionsInDateRange(deviceId: string, startDate: Date, endDate: Date): Promise<Session[]> {
const sessions = Array.from(this.sessions.values())
.filter(session => {
const sessionDate = new Date(session.startedAt);
return session.deviceId === deviceId &&
sessionDate >= startDate &&
sessionDate <= endDate;
})
.sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime());
return sessions;
}
async createDeviceProfile(insertProfile: InsertDeviceProfile): Promise<DeviceProfile> {
const id = randomUUID();
const now = new Date();
const profile: DeviceProfile = {
...insertProfile,
id,
createdAt: now,
lastActiveAt: now,
};
this.deviceProfiles.set(insertProfile.deviceId, profile);
return profile;
}
async getDeviceProfile(deviceId: string): Promise<DeviceProfile | undefined> {
return this.deviceProfiles.get(deviceId);
}
async updateDeviceProfileActivity(deviceId: string): Promise<void> {
const profile = this.deviceProfiles.get(deviceId);
if (profile) {
profile.lastActiveAt = new Date();
this.deviceProfiles.set(deviceId, profile);
}
}
}
export const storage = new MemStorage();