mirror of
https://github.com/CarGDev/pomodoro.git
synced 2025-09-18 20:38:29 +00:00
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:
38
shared/schema.ts
Normal file
38
shared/schema.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { pgTable, text, varchar, integer, boolean, timestamp } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
export const sessions = pgTable("sessions", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
deviceId: text("device_id").notNull(),
|
||||
type: text("type").notNull(), // 'focus' | 'break'
|
||||
intendedMinutes: integer("intended_minutes").notNull(),
|
||||
actualSeconds: integer("actual_seconds").notNull(),
|
||||
startedAt: timestamp("started_at").notNull(),
|
||||
endedAt: timestamp("ended_at").notNull(),
|
||||
completed: boolean("completed").notNull(),
|
||||
interruptions: integer("interruptions").notNull().default(0),
|
||||
});
|
||||
|
||||
export const deviceProfiles = pgTable("device_profiles", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
deviceId: text("device_id").notNull().unique(),
|
||||
createdAt: timestamp("created_at").notNull().default(sql`now()`),
|
||||
lastActiveAt: timestamp("last_active_at").notNull().default(sql`now()`),
|
||||
});
|
||||
|
||||
export const insertSessionSchema = createInsertSchema(sessions).omit({
|
||||
id: true,
|
||||
});
|
||||
|
||||
export const insertDeviceProfileSchema = createInsertSchema(deviceProfiles).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
lastActiveAt: true,
|
||||
});
|
||||
|
||||
export type InsertSession = z.infer<typeof insertSessionSchema>;
|
||||
export type Session = typeof sessions.$inferSelect;
|
||||
export type InsertDeviceProfile = z.infer<typeof insertDeviceProfileSchema>;
|
||||
export type DeviceProfile = typeof deviceProfiles.$inferSelect;
|
Reference in New Issue
Block a user