🚀 Backend komplett implementiert

Features:
- Auth mit JWT + Argon2 (Login, Register, Refresh)
- Rollen-System (Chef/Disponent/Mitarbeiter)
- User Management mit Berechtigungen
- Aufträge mit Zuweisungen
- Verfügbarkeitsplanung
- Stundenzettel mit Foto-Upload Support
- Modulares System mit Config
- Entwickler-Panel Endpoints

Tech:
- Deno + Oak
- PostgreSQL
- CORS enabled
This commit is contained in:
2026-02-20 15:12:06 +00:00
parent a07c2ad858
commit ee19e45171
16 changed files with 2079 additions and 2 deletions

145
src/types/index.ts Normal file
View File

@@ -0,0 +1,145 @@
// User roles
export type UserRole = "chef" | "disponent" | "mitarbeiter";
// Order status
export type OrderStatus = "draft" | "published" | "in_progress" | "completed" | "cancelled";
// Assignment status
export type AssignmentStatus = "pending" | "confirmed" | "declined" | "completed";
// Timesheet status
export type TimesheetStatus = "pending" | "approved" | "rejected";
// User
export interface User {
id: string;
org_id: string;
email: string;
password_hash?: string;
role: UserRole;
first_name: string;
last_name: string;
phone?: string;
avatar_url?: string;
created_by?: string;
managed_by?: string;
active: boolean;
last_login?: Date;
created_at: Date;
updated_at: Date;
}
// Organization
export interface Organization {
id: string;
name: string;
slug: string;
settings: Record<string, unknown>;
created_at: Date;
updated_at: Date;
}
// Order
export interface Order {
id: string;
org_id: string;
number: number;
title: string;
description?: string;
location?: string;
address?: string;
client_name?: string;
client_contact?: string;
status: OrderStatus;
start_time?: Date;
end_time?: Date;
required_staff: number;
special_instructions?: string;
created_by: string;
created_at: Date;
updated_at: Date;
}
// Order Assignment
export interface OrderAssignment {
id: string;
order_id: string;
user_id: string;
status: AssignmentStatus;
note?: string;
confirmed_at?: Date;
created_at: Date;
}
// Availability
export interface Availability {
id: string;
user_id: string;
date: Date;
available: boolean;
time_from?: string;
time_to?: string;
note?: string;
created_at: Date;
updated_at: Date;
}
// Timesheet
export interface Timesheet {
id: string;
user_id: string;
order_id?: string;
work_date: Date;
start_time?: string;
end_time?: string;
hours_worked?: number;
photo_url?: string;
status: TimesheetStatus;
approved_by?: string;
rejection_reason?: string;
approved_at?: Date;
created_at: Date;
updated_at: Date;
}
// Module
export interface Module {
id: string;
name: string;
display_name: string;
description?: string;
is_core: boolean;
default_config: Record<string, unknown>;
created_at: Date;
}
// Organization Module
export interface OrganizationModule {
id: string;
org_id: string;
module_id: string;
enabled: boolean;
config: Record<string, unknown>;
enabled_at: Date;
updated_at: Date;
}
// JWT Payload
export interface JWTPayload {
sub: string; // user id
org: string; // org id
role: UserRole;
email: string;
iat: number;
exp: number;
}
// Auth Context
export interface AuthContext {
user: {
id: string;
org_id: string;
role: UserRole;
email: string;
};
}