diff --git a/frontend/services/dto/task-recurrence.ts b/frontend/services/dto/task-recurrence.ts new file mode 100644 index 0000000..66c94c8 --- /dev/null +++ b/frontend/services/dto/task-recurrence.ts @@ -0,0 +1,22 @@ +export type TaskRecurrence = { + id: number + '@id'?: string + type: 'daily' | 'weekly' | 'monthly' | 'yearly' + interval: number + daysOfWeek: string[] | null + dayOfMonth: number | null + weekOfMonth: number | null + endDate: string | null + maxOccurrences: number | null + occurrenceCount: number +} + +export type TaskRecurrenceWrite = { + type: 'daily' | 'weekly' | 'monthly' | 'yearly' + interval: number + daysOfWeek?: string[] | null + dayOfMonth?: number | null + weekOfMonth?: number | null + endDate?: string | null + maxOccurrences?: number | null +} diff --git a/frontend/services/dto/task.ts b/frontend/services/dto/task.ts index abc1374..467db8f 100644 --- a/frontend/services/dto/task.ts +++ b/frontend/services/dto/task.ts @@ -29,6 +29,23 @@ export type Task = { status: string title: string } | null + scheduledStart: string | null + scheduledEnd: string | null + deadline: string | null + syncToCalendar: boolean + calendarSyncError: string | null + recurrence: { + id: number + '@id'?: string + type: 'daily' | 'weekly' | 'monthly' | 'yearly' + interval: number + daysOfWeek: string[] | null + dayOfMonth: number | null + weekOfMonth: number | null + endDate: string | null + maxOccurrences: number | null + occurrenceCount: number + } | null } export type TaskWrite = { @@ -43,4 +60,9 @@ export type TaskWrite = { tags: string[] archived?: boolean clientTicket?: string | null + scheduledStart?: string | null + scheduledEnd?: string | null + deadline?: string | null + syncToCalendar?: boolean + recurrence?: string | null } diff --git a/frontend/services/dto/zimbra.ts b/frontend/services/dto/zimbra.ts new file mode 100644 index 0000000..7565252 --- /dev/null +++ b/frontend/services/dto/zimbra.ts @@ -0,0 +1,19 @@ +export type ZimbraSettings = { + serverUrl: string | null + username: string | null + calendarPath: string | null + enabled: boolean + hasPassword: boolean +} + +export type ZimbraSettingsWrite = { + serverUrl: string | null + username: string | null + calendarPath: string | null + password?: string | null + enabled: boolean +} + +export type ZimbraTestResult = { + success: boolean +} diff --git a/frontend/services/task-recurrences.ts b/frontend/services/task-recurrences.ts new file mode 100644 index 0000000..237b145 --- /dev/null +++ b/frontend/services/task-recurrences.ts @@ -0,0 +1,25 @@ +import type { TaskRecurrence, TaskRecurrenceWrite } from './dto/task-recurrence' + +export function useTaskRecurrenceService() { + const api = useApi() + + async function create(payload: TaskRecurrenceWrite): Promise { + return api.post('/task_recurrences', payload as Record, { + toastSuccessKey: 'taskRecurrence.created', + }) + } + + async function update(id: number, payload: Partial): Promise { + return api.patch(`/task_recurrences/${id}`, payload as Record, { + toastSuccessKey: 'taskRecurrence.updated', + }) + } + + async function remove(id: number): Promise { + await api.delete(`/task_recurrences/${id}`, {}, { + toastSuccessKey: 'taskRecurrence.deleted', + }) + } + + return { create, update, remove } +} diff --git a/frontend/services/zimbra.ts b/frontend/services/zimbra.ts new file mode 100644 index 0000000..f125612 --- /dev/null +++ b/frontend/services/zimbra.ts @@ -0,0 +1,21 @@ +import type { ZimbraSettings, ZimbraSettingsWrite, ZimbraTestResult } from './dto/zimbra' + +export function useZimbraService() { + const api = useApi() + + async function getSettings(): Promise { + return api.get('/settings/zimbra') + } + + async function saveSettings(payload: ZimbraSettingsWrite): Promise { + return api.put('/settings/zimbra', payload as Record, { + toastSuccessKey: 'zimbra.settings.saved', + }) + } + + async function testConnection(): Promise { + return api.post('/settings/zimbra/test', {}) + } + + return { getSettings, saveSettings, testConnection } +}