feat: add AssetCategory Prisma model + migration
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "AssetCategoryValueGroup" AS ENUM ('high_value', 'low_value');
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "asset_categories" (
|
||||||
|
"id" UUID NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"value_group" "AssetCategoryValueGroup" NOT NULL,
|
||||||
|
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT "asset_categories_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
@@ -216,6 +216,35 @@ model PurchaseOrder {
|
|||||||
@@map("purchase_orders")
|
@@map("purchase_orders")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fixed, closed set of 2 values tied to the domain (see docs/
|
||||||
|
// asset-license-management.md's "## Phân loại tài sản: High-value vs
|
||||||
|
// Low-value/Consumable" section) — native Postgres enum, same rationale as
|
||||||
|
// RequestType/AssetItemStatus/LicenseType above. Determines downstream
|
||||||
|
// rules for entities that will attach to a category later (not built in
|
||||||
|
// this task): AssetModel.categoryId must point to a `high_value` category,
|
||||||
|
// ConsumableItem.categoryId must point to a `low_value` category.
|
||||||
|
enum AssetCategoryValueGroup {
|
||||||
|
high_value
|
||||||
|
low_value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Asset classification catalog — see docs/asset-license-management.md's
|
||||||
|
// "## Phân loại tài sản" section and the `AssetCategory` row in the "Data
|
||||||
|
// model (sơ bộ)" table. Standalone entity, no FKs (same starting shape as
|
||||||
|
// Vendor before it grew relations) — `AssetModel` and
|
||||||
|
// `AssetCategoryAttributeDef` will attach to this via `categoryId` in
|
||||||
|
// later tasks (not this one). IT admin defines the concrete categories
|
||||||
|
// (e.g. "Laptop", "Cáp HDMI") freely; only `valueGroup` is a fixed 2-value
|
||||||
|
// set.
|
||||||
|
model AssetCategory {
|
||||||
|
id String @id @default(uuid()) @db.Uuid
|
||||||
|
name String
|
||||||
|
valueGroup AssetCategoryValueGroup @map("value_group")
|
||||||
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
|
|
||||||
|
@@map("asset_categories")
|
||||||
|
}
|
||||||
|
|
||||||
// Minimal internal auth accounts — NOT company SSO (deliberately ruled out,
|
// Minimal internal auth accounts — NOT company SSO (deliberately ruled out,
|
||||||
// see CLAUDE.md / auth decision notes). A handful of trusted IT staff
|
// see CLAUDE.md / auth decision notes). A handful of trusted IT staff
|
||||||
// accounts, created by hand via scripts/create-user.ts, no self-registration.
|
// accounts, created by hand via scripts/create-user.ts, no self-registration.
|
||||||
|
|||||||
Reference in New Issue
Block a user