L12 Zeiterfassung: Datenmodell, Rechte und Events für die Zeitfreigabe
Migration zeiterfassung_freigabe (TimeEntry source/approvalStatus/pendingChange, WorkSession.manual), Rechte field:record_own_time und time:approve, PII approvedById, Events time.approval_requested/approved/rejected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -894,6 +894,8 @@ model WorkSession {
|
||||
startedOffline Boolean @default(false) @map("started_offline")
|
||||
deviceInfo String? @map("device_info")
|
||||
clientId String? @map("client_id")
|
||||
/// L12: container session for manually recorded entries (one per user + order + day, always `ended`)
|
||||
manual Boolean @default(false)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -917,6 +919,17 @@ enum TimeEntryType {
|
||||
interruption
|
||||
}
|
||||
|
||||
enum TimeEntrySource {
|
||||
tracked
|
||||
manual
|
||||
}
|
||||
|
||||
enum TimeApprovalStatus {
|
||||
approved
|
||||
pending
|
||||
rejected
|
||||
}
|
||||
|
||||
model TimeEntry {
|
||||
id String @id @default(cuid())
|
||||
tenantId String @map("tenant_id")
|
||||
@@ -930,6 +943,16 @@ model TimeEntry {
|
||||
correctionReason String? @map("correction_reason")
|
||||
correctedById String? @map("corrected_by_id")
|
||||
clientId String? @map("client_id")
|
||||
// L12 Zeiterfassung: manual entries and correction proposals need approval; only
|
||||
// `approvalStatus = approved` counts for reports, totals and billing.
|
||||
source TimeEntrySource @default(tracked)
|
||||
approvalStatus TimeApprovalStatus @default(approved) @map("approval_status")
|
||||
approvedById String? @map("approved_by_id")
|
||||
approvedAt DateTime? @map("approved_at")
|
||||
rejectionReason String? @map("rejection_reason")
|
||||
/// proposed correction of this entry {startedAt, endedAt, type, reason, requestedAt}; old values stay valid until approval
|
||||
pendingChange Json? @map("pending_change")
|
||||
note String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -937,6 +960,7 @@ model TimeEntry {
|
||||
|
||||
@@index([tenantId, workSessionId])
|
||||
@@index([tenantId, userId, startedAt])
|
||||
@@index([tenantId, approvalStatus])
|
||||
@@unique([tenantId, clientId])
|
||||
@@map("time_entries")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user