ai rec works
as intended, needs refinments
This commit is contained in:
1 parent
0183a8ea6a
commit
3ab9908588
21 files changed
+1579
-696
No files matched your search
@@ -5,4 +5,5 @@ import * as schema from './schema'
|
||||
const sqlite = new Database('./fitai.db')
|
||||
export const db = drizzle(sqlite, { schema })
|
||||
|
||||
export * from './schema'
|
||||
export * from './schema'
|
||||
export { eq, and, or, desc, asc } from 'drizzle-orm'
|
||||
@@ -145,6 +145,35 @@ export const fitnessProfiles = sqliteTable("fitness_profiles", {
|
||||
.$defaultFn(() => new Date()),
|
||||
});
|
||||
|
||||
export const recommendations = sqliteTable("recommendations", {
|
||||
id: text("id").primaryKey(),
|
||||
userId: text("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
fitnessProfileId: text("fitness_profile_id")
|
||||
.notNull()
|
||||
.references(() => fitnessProfiles.id, { onDelete: "cascade" }),
|
||||
recommendationText: text("recommendation_text").notNull(),
|
||||
activityPlan: text("activity_plan").notNull(),
|
||||
dietPlan: text("diet_plan").notNull(),
|
||||
status: text("status", {
|
||||
enum: ["pending", "approved", "rejected"],
|
||||
})
|
||||
.notNull()
|
||||
.default("pending"),
|
||||
generatedAt: integer("generated_at", { mode: "timestamp" })
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date()),
|
||||
approvedAt: integer("approved_at", { mode: "timestamp" }),
|
||||
approvedBy: text("approved_by"), // User ID of admin/trainer
|
||||
createdAt: integer("created_at", { mode: "timestamp" })
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date()),
|
||||
updatedAt: integer("updated_at", { mode: "timestamp" })
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date()),
|
||||
});
|
||||
|
||||
export type User = typeof users.$inferSelect;
|
||||
export type NewUser = typeof users.$inferInsert;
|
||||
export type Client = typeof clients.$inferSelect;
|
||||
@@ -157,3 +186,5 @@ export type Notification = typeof notifications.$inferSelect;
|
||||
export type NewNotification = typeof notifications.$inferInsert;
|
||||
export type FitnessProfile = typeof fitnessProfiles.$inferSelect;
|
||||
export type NewFitnessProfile = typeof fitnessProfiles.$inferInsert;
|
||||
export type Recommendation = typeof recommendations.$inferSelect;
|
||||
export type NewRecommendation = typeof recommendations.$inferInsert;
|
||||
Reference in new issue
Block a user