- Introduced Form, FormField, FormItem, FormLabel, FormControl, FormDescription, FormMessage components for structured form handling. - Added Input, Textarea, and Select components for user input. - Implemented Label and Separator components for better UI organization. - Created Skeleton component for loading states. - Developed Toast and Toaster components for user notifications. - Integrated useToast hook for managing toast notifications. - Established AI analysis functionality with analyzeJournalWithLocalAI. - Set up Dexie for local database management with Journal and Task models. - Configured Supabase client for server-side and browser-side interactions. - Defined database schema for journals, tasks, chat sessions, and messages with Row Level Security policies. Co-authored-by: Copilot <copilot@github.com>
43 lines
935 B
TypeScript
43 lines
935 B
TypeScript
import Dexie, { type Table } from "dexie";
|
||
|
||
// Veritabanı Modelleri
|
||
export interface Journal {
|
||
id: string;
|
||
date: string;
|
||
mood: string;
|
||
energy: number;
|
||
content: string;
|
||
ai_tags?: string[];
|
||
ai_sentiment_score?: number;
|
||
ai_summary?: string;
|
||
created_at: string;
|
||
updated_at: string;
|
||
}
|
||
|
||
export interface Task {
|
||
id: string;
|
||
journal_id?: string;
|
||
title: string;
|
||
status: "todo" | "in_progress" | "completed";
|
||
ai_generated: boolean;
|
||
date: string;
|
||
created_at: string;
|
||
}
|
||
|
||
export class MindSpaceDB extends Dexie {
|
||
journals!: Table<Journal>;
|
||
tasks!: Table<Task>;
|
||
|
||
constructor() {
|
||
super("MindSpaceDatabase");
|
||
|
||
// Schema tanımlamaları.
|
||
// IndexedDB'de sadece indekslenecek (üzerinde arama/sıralama yapılacak) alanları belirtiriz.
|
||
this.version(1).stores({
|
||
journals: "id, date, mood",
|
||
tasks: "id, status, date, journal_id"
|
||
});
|
||
}
|
||
}
|
||
|
||
export const db = new MindSpaceDB(); |