Added Backend

This commit is contained in:
2026-01-06 12:07:43 +01:00
parent b013ef8f4b
commit 6f3d4c0bff
165 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import {
pgTable,
uuid,
bigint,
timestamp,
integer,
text,
} from "drizzle-orm/pg-core"
import { stafftimeentries } from "./staff_time_entries"
import {sql} from "drizzle-orm";
export const stafftimenetryconnects = pgTable("staff_time_entry_connects", {
id: uuid("id").primaryKey().defaultRandom(),
stafftimeentry: uuid("time_entry_id")
.notNull()
.references(() => stafftimeentries.id, { onDelete: "cascade" }),
project_id: bigint("project_id", { mode: "number" }), // referenziert später projects.id
started_at: timestamp("started_at", { withTimezone: true }).notNull(),
stopped_at: timestamp("stopped_at", { withTimezone: true }).notNull(),
durationMinutes: integer("duration_minutes").generatedAlwaysAs(
sql`(EXTRACT(epoch FROM (stopped_at - started_at)) / 60)`
),
notes: text("notes"),
created_at: timestamp("created_at", { withTimezone: true }).defaultNow(),
updated_at: timestamp("updated_at", { withTimezone: true }).defaultNow(),
})
export type StaffTimeEntryConnect =
typeof stafftimenetryconnects.$inferSelect
export type NewStaffTimeEntryConnect =
typeof stafftimenetryconnects.$inferInsert