add manual time entry feature

This commit is contained in:
Gregor Vostrak
2024-04-24 22:13:22 +02:00
parent 8136f630c9
commit f52a629bac
15 changed files with 261 additions and 28 deletions

View File

@@ -22,6 +22,11 @@ export type TimeEntryResponse = ZodiosResponseByAlias<
>;
export type TimeEntry = TimeEntryResponse['data'][0];
export type CreateTimeEntryBody = ZodiosBodyByAlias<
SolidTimeApi,
'createTimeEntry'
>;
export type ProjectResponse = ZodiosResponseByAlias<
SolidTimeApi,
'getProjects'

View File

@@ -71,7 +71,7 @@ export const useNotificationsStore = defineStore('notifications', () => {
}
}
}
return null;
throw new Error('Failed to handle API request');
}
return { addNotification, notifications, handleApiRequestNotifications };

View File

@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
import { getCurrentOrganizationId, getCurrentUserId } from '@/utils/useUser';
import { api } from '../../../openapi.json.client';
import { reactive, ref } from 'vue';
import type { TimeEntry } from '@/utils/api';
import type { CreateTimeEntryBody, TimeEntry } from '@/utils/api';
import dayjs from 'dayjs';
import { useNotificationsStore } from '@/utils/notification';
@@ -83,7 +83,7 @@ export const useTimeEntriesStore = defineStore('timeEntries', () => {
}
}
async function createTimeEntry(timeEntry: TimeEntry) {
async function createTimeEntry(timeEntry: CreateTimeEntryBody) {
const organizationId = getCurrentOrganizationId();
if (organizationId) {
await handleApiRequestNotifications(