feat: add AssetItem Prisma model + migration

This commit is contained in:
2026-07-31 16:04:01 +07:00
parent 3f6497e2df
commit 09b54f3c6b
2 changed files with 47 additions and 0 deletions
+29
View File
@@ -63,6 +63,35 @@ model Employee {
@@map("employees")
}
// Fixed, closed set of 4 values tied to the domain (see docs/
// asset-license-management.md's "Data model (sơ bộ)" table) — native
// Postgres enum, same rationale as RequestType above.
enum AssetItemStatus {
in_stock
assigned
repair
retired
}
// Hardware inventory — see docs/asset-license-management.md's "Data model
// (sơ bộ)" table (serial number, model, ngày mua, bảo hành, trạng thái).
// No Vendor/Assignment relation yet — those entities don't exist yet
// (see "Việc còn dở" in CLAUDE.md), so this is a standalone entity for now,
// same starting shape as Employee before Request grew an FK to it.
// warrantyEndDate is nullable: not every asset has known warranty terms at
// intake time (smallest sensible assumption — doesn't block creation).
model AssetItem {
id String @id @default(uuid()) @db.Uuid
serialNumber String @unique @map("serial_number")
model String
purchaseDate DateTime @map("purchase_date") @db.Date
warrantyEndDate DateTime? @map("warranty_end_date") @db.Date
status AssetItemStatus @default(in_stock)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
@@map("asset_items")
}
// Minimal internal auth accounts — NOT company SSO (deliberately ruled out,
// see CLAUDE.md / auth decision notes). A handful of trusted IT staff
// accounts, created by hand via scripts/create-user.ts, no self-registration.