Fix #53
Some checks failed
Build and Push Docker Images / build-backend (push) Successful in 33s
Build and Push Docker Images / build-frontend (push) Has been cancelled

This commit is contained in:
2026-01-13 14:24:04 +01:00
parent 32b4c40e11
commit 267648074c
3 changed files with 15 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ export default async function staffTimeRoutes(server: FastifyInstance) {
server.post("/staff/time/event", async (req, reply) => { server.post("/staff/time/event", async (req, reply) => {
try { try {
const userId = req.user.user_id const actorId = req.user.user_id;
const tenantId = req.user.tenant_id const tenantId = req.user.tenant_id
const body = req.body as any const body = req.body as any
@@ -35,17 +35,15 @@ export default async function staffTimeRoutes(server: FastifyInstance) {
const dataToInsert = { const dataToInsert = {
tenant_id: tenantId, tenant_id: tenantId,
user_id: userId, user_id: body.user_id,
actortype: "user", actortype: "user",
actoruser_id: userId, actoruser_id: actorId,
eventtime: normalizeDate(body.eventtime), eventtime: normalizeDate(body.eventtime),
eventtype: body.eventtype, eventtype: body.eventtype,
source: "WEB", source: "WEB",
payload: body.payload // Payload (z.B. Description) mit speichern payload: body.payload // Payload (z.B. Description) mit speichern
} }
console.log(dataToInsert)
const [created] = await server.db const [created] = await server.db
.insert(stafftimeevents) .insert(stafftimeevents)
//@ts-ignore //@ts-ignore

View File

@@ -103,7 +103,8 @@ async function onSubmit(event: FormSubmitEvent<any>) {
start: startIso, // Die eingegebene Startzeit start: startIso, // Die eingegebene Startzeit
end: endIso, // Die eingegebene Endzeit (oder null) end: endIso, // Die eingegebene Endzeit (oder null)
type: state.type, type: state.type,
description: state.description description: state.description,
user_id: props.defaultUserId
}) })
toast.add({ title: 'Zeit manuell erfasst', color: 'green' }) toast.add({ title: 'Zeit manuell erfasst', color: 'green' })
@@ -131,6 +132,8 @@ async function onSubmit(event: FormSubmitEvent<any>) {
</div> </div>
</template> </template>
{{props}}
<UForm :schema="schema" :state="state" class="space-y-4" @submit="onSubmit"> <UForm :schema="schema" :state="state" class="space-y-4" @submit="onSubmit">
<UFormGroup label="Typ" name="type"> <UFormGroup label="Typ" name="type">

View File

@@ -91,15 +91,18 @@ export const useStaffTime = () => {
} }
// 🆕 NEU: Manuellen Eintrag erstellen (Vergangenheit oder Zeitraum) // 🆕 NEU: Manuellen Eintrag erstellen (Vergangenheit oder Zeitraum)
const createEntry = async (data: { start: string, end: string | null, type: string, description: string }) => { const createEntry = async (data: { start: string, end: string | null, type: string, description: string, user_id: string }) => {
// 1. Start Event senden // 1. Start Event senden
// Wir nutzen den dynamischen Typ (work_start, vacation_start etc.) // Wir nutzen den dynamischen Typ (work_start, vacation_start etc.)
console.log(data)
await $api('/api/staff/time/event', { await $api('/api/staff/time/event', {
method: 'POST', method: 'POST',
body: { body: {
eventtype: `${data.type}_start`, eventtype: `${data.type}_start`,
eventtime: data.start, eventtime: data.start,
payload: { description: data.description } payload: { description: data.description },
user_id: data.user_id,
} }
}) })
@@ -109,7 +112,9 @@ export const useStaffTime = () => {
method: 'POST', method: 'POST',
body: { body: {
eventtype: `${data.type}_end`, eventtype: `${data.type}_end`,
eventtime: data.end eventtime: data.end,
payload: { description: data.description },
user_id: data.user_id,
} }
}) })
} }