Files
FEDEO/backend/db/schema/devices.ts
florianfederspiel 7f4f232c32
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 31s
Build and Push Docker Images / build-frontend (push) Successful in 17s
Added Health Ednpoint for Devices
Added Offline Sync for times
2026-01-21 12:38:36 +01:00

35 lines
843 B
TypeScript

import {
pgTable,
uuid,
timestamp,
text,
bigint, jsonb,
} from "drizzle-orm/pg-core"
import { tenants } from "./tenants"
export const devices = pgTable("devices", {
id: uuid("id").primaryKey().defaultRandom(),
createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
name: text("name").notNull(),
type: text("type").notNull(),
tenant: bigint("tenant", { mode: "number" }).references(() => tenants.id),
password: text("password"),
externalId: text("externalId"),
lastSeen: timestamp("last_seen", { withTimezone: true }),
// Hier speichern wir den ganzen Payload (RSSI, Heap, IP, etc.)
lastDebugInfo: jsonb("last_debug_info"),
})
export type Device = typeof devices.$inferSelect
export type NewDevice = typeof devices.$inferInsert