feat: terminology fix (Entry→Event), diary page generation, settings refactor
- Rename Entry→Event throughout frontend and backend - Change 'journal' terminology to 'diary page' - Add professional footer with links - Redirect to diary page after generation - Error handling for generation failures - Fix settings to store per-provider configs in providerSettings - Backend reads API key from providerSettings - Use prisma db push instead of migrate for schema sync - Clean up duplicate entries.ts file
This commit is contained in:
@@ -68,30 +68,34 @@ class ApiClient {
|
||||
}
|
||||
|
||||
async getDays() {
|
||||
return this.request<Array<{ date: string; entryCount: number; hasJournal: boolean }>>('GET', '/days');
|
||||
return this.request<Array<{ date: string; eventCount: number; hasJournal: boolean }>>('GET', '/days');
|
||||
}
|
||||
|
||||
async getDay(date: string) {
|
||||
return this.request<{ date: string; entries: Entry[]; journal: Journal | null }>('GET', `/days/${date}`);
|
||||
return this.request<{ date: string; events: Event[]; journal: Journal | null }>('GET', `/days/${date}`);
|
||||
}
|
||||
|
||||
async deleteDay(date: string) {
|
||||
return this.request<{ deleted: boolean }>('DELETE', `/days/${date}`);
|
||||
}
|
||||
|
||||
async createEntry(date: string, type: string, content: string, metadata?: object) {
|
||||
return this.request<Entry>('POST', '/entries', { date, type, content, metadata });
|
||||
async createEvent(date: string, type: string, content: string, metadata?: object) {
|
||||
return this.request<Event>('POST', '/events', { date, type, content, metadata });
|
||||
}
|
||||
|
||||
async updateEntry(id: string, content: string, metadata?: object) {
|
||||
return this.request<Entry>('PUT', `/entries/${id}`, { content, metadata });
|
||||
async updateEvent(id: string, content: string, metadata?: object) {
|
||||
return this.request<Event>('PUT', `/events/${id}`, { content, metadata });
|
||||
}
|
||||
|
||||
async deleteEntry(id: string) {
|
||||
return this.request<{ deleted: boolean }>('DELETE', `/entries/${id}`);
|
||||
async deleteEvent(id: string) {
|
||||
return this.request<{ deleted: boolean }>('DELETE', `/events/${id}`);
|
||||
}
|
||||
|
||||
async uploadPhoto(entryId: string, file: File) {
|
||||
async deleteJournal(date: string) {
|
||||
return this.request<{ deleted: boolean }>('DELETE', `/journal/${date}`);
|
||||
}
|
||||
|
||||
async uploadPhoto(eventId: string, file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
@@ -100,7 +104,7 @@ class ApiClient {
|
||||
headers['Authorization'] = `Bearer ${this.getApiKey()}`;
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE}/entries/${entryId}/photo`, {
|
||||
const response = await fetch(`${API_BASE}/events/${eventId}/photo`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: formData,
|
||||
@@ -108,7 +112,7 @@ class ApiClient {
|
||||
return response.json() as Promise<ApiResponse<{ mediaPath: string }>>;
|
||||
}
|
||||
|
||||
async uploadVoice(entryId: string, file: File) {
|
||||
async uploadVoice(eventId: string, file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
@@ -117,7 +121,7 @@ class ApiClient {
|
||||
headers['Authorization'] = `Bearer ${this.getApiKey()}`;
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE}/entries/${entryId}/voice`, {
|
||||
const response = await fetch(`${API_BASE}/events/${eventId}/voice`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: formData,
|
||||
@@ -150,10 +154,10 @@ class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
export interface Entry {
|
||||
export interface Event {
|
||||
id: string;
|
||||
date: string;
|
||||
type: 'text' | 'voice' | 'photo' | 'health' | 'location';
|
||||
type: string;
|
||||
content: string;
|
||||
mediaPath?: string;
|
||||
metadata?: string;
|
||||
@@ -164,7 +168,7 @@ export interface Journal {
|
||||
id: string;
|
||||
date: string;
|
||||
content: string;
|
||||
entryCount: number;
|
||||
eventCount: number;
|
||||
generatedAt: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user