feat(P18A-1,P18A-2): 新增资产模型权限与默认分类
这个提交包含在:
+74
-5
@@ -52,6 +52,14 @@ enum PurchaseRequestStatus {
|
||||
cancelled
|
||||
}
|
||||
|
||||
enum AssetCardStatus {
|
||||
in_stock
|
||||
in_use
|
||||
under_repair
|
||||
retired
|
||||
archived
|
||||
}
|
||||
|
||||
enum LeaveDaySession {
|
||||
am
|
||||
pm
|
||||
@@ -229,10 +237,11 @@ model Employee {
|
||||
leave_requests LeaveRequest[]
|
||||
leave_ledgers LeaveLedger[]
|
||||
owned_cost_centers CostCenter[] @relation("CostCenterOwner")
|
||||
purchase_requests_applicant PurchaseRequest[] @relation("PurchaseRequestApplicant")
|
||||
purchase_requests_submitted PurchaseRequest[] @relation("PurchaseRequestSubmitter")
|
||||
purchase_attachments_uploaded PurchaseAttachment[] @relation("PurchaseAttachmentUploader")
|
||||
purchase_requests_applicant PurchaseRequest[] @relation("PurchaseRequestApplicant")
|
||||
purchase_requests_submitted PurchaseRequest[] @relation("PurchaseRequestSubmitter")
|
||||
purchase_attachments_uploaded PurchaseAttachment[] @relation("PurchaseAttachmentUploader")
|
||||
purchase_order_archives PurchaseOrderArchive[] @relation("PurchaseOrderArchiveArchivedBy")
|
||||
assigned_asset_cards AssetCard[] @relation("AssetCardAssignee")
|
||||
|
||||
owned_invoices InvoicePool[] @relation("InvoiceOwner")
|
||||
uploaded_invoices InvoicePool[] @relation("InvoiceUploader")
|
||||
@@ -424,6 +433,7 @@ model LegalEntity {
|
||||
holiday_calendars HolidayCalendar[] @relation("HolidayCalendarLegalEntity")
|
||||
suppliers Supplier[]
|
||||
purchase_requests PurchaseRequest[]
|
||||
asset_cards AssetCard[]
|
||||
budget_pools BudgetPool[] @relation("BudgetPoolLegalEntity")
|
||||
|
||||
@@index([enabled, archived_at], map: "idx_legal_entities_status")
|
||||
@@ -449,9 +459,10 @@ model CostCenter {
|
||||
legal_entity LegalEntity @relation(fields: [legal_entity_id], references: [id], onDelete: Restrict)
|
||||
parent CostCenter? @relation("CostCenterToParent", fields: [parent_id], references: [id], onDelete: Restrict)
|
||||
children CostCenter[] @relation("CostCenterToParent")
|
||||
owner_employee Employee? @relation("CostCenterOwner", fields: [owner_employee_id], references: [id], onDelete: SetNull)
|
||||
budget_pools BudgetPool[] @relation("BudgetPoolCostCenter")
|
||||
owner_employee Employee? @relation("CostCenterOwner", fields: [owner_employee_id], references: [id], onDelete: SetNull)
|
||||
budget_pools BudgetPool[] @relation("BudgetPoolCostCenter")
|
||||
purchase_requests PurchaseRequest[]
|
||||
asset_cards AssetCard[]
|
||||
|
||||
@@unique([legal_entity_id, code], map: "legal_entity_cost_center_code_ux")
|
||||
@@index([legal_entity_id, enabled, archived_at], map: "idx_cost_centers_legal_entity_status")
|
||||
@@ -478,6 +489,7 @@ model DocumentCategory {
|
||||
updated_by String? @db.Uuid
|
||||
|
||||
purchase_requests PurchaseRequest[]
|
||||
asset_categories AssetCategory[]
|
||||
|
||||
@@index([entity_type, enabled, archived_at], map: "idx_document_categories_entity_status")
|
||||
@@map("document_categories")
|
||||
@@ -586,6 +598,7 @@ model PurchaseRequest {
|
||||
items PurchaseRequestItem[]
|
||||
attachments PurchaseAttachment[]
|
||||
order_archive PurchaseOrderArchive?
|
||||
asset_cards AssetCard[]
|
||||
workflow_instances WorkflowInstance[]
|
||||
|
||||
@@index([applicant_id, status, updated_at], map: "idx_purchase_requests_applicant_status_updated")
|
||||
@@ -656,6 +669,62 @@ model PurchaseOrderArchive {
|
||||
@@map("purchase_order_archives")
|
||||
}
|
||||
|
||||
model AssetCategory {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique
|
||||
name String
|
||||
document_category_id String? @db.Uuid
|
||||
enabled Boolean @default(true)
|
||||
archived_at DateTime?
|
||||
|
||||
created_at DateTime @default(now())
|
||||
created_by String? @db.Uuid
|
||||
updated_at DateTime @updatedAt
|
||||
updated_by String? @db.Uuid
|
||||
|
||||
document_category DocumentCategory? @relation(fields: [document_category_id], references: [id], onDelete: SetNull)
|
||||
asset_cards AssetCard[]
|
||||
|
||||
@@index([enabled, archived_at], map: "idx_asset_categories_status")
|
||||
@@index([document_category_id], map: "idx_asset_categories_document_category")
|
||||
@@map("asset_categories")
|
||||
}
|
||||
|
||||
model AssetCard {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
asset_no String @unique
|
||||
name String
|
||||
category_id String @db.Uuid
|
||||
legal_entity_id String @db.Uuid
|
||||
cost_center_id String @db.Uuid
|
||||
purchase_request_id String? @db.Uuid
|
||||
serial_no String?
|
||||
location String?
|
||||
status AssetCardStatus @default(in_stock)
|
||||
assignee_employee_id String? @db.Uuid
|
||||
activated_at DateTime? @db.Date
|
||||
retired_at DateTime? @db.Date
|
||||
|
||||
created_at DateTime @default(now())
|
||||
created_by String? @db.Uuid
|
||||
updated_at DateTime @updatedAt
|
||||
updated_by String? @db.Uuid
|
||||
|
||||
category AssetCategory @relation(fields: [category_id], references: [id], onDelete: Restrict)
|
||||
legal_entity LegalEntity @relation(fields: [legal_entity_id], references: [id], onDelete: Restrict)
|
||||
cost_center CostCenter @relation(fields: [cost_center_id], references: [id], onDelete: Restrict)
|
||||
purchase_request PurchaseRequest? @relation(fields: [purchase_request_id], references: [id], onDelete: SetNull)
|
||||
assignee Employee? @relation("AssetCardAssignee", fields: [assignee_employee_id], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([category_id], map: "idx_asset_cards_category")
|
||||
@@index([legal_entity_id], map: "idx_asset_cards_legal_entity")
|
||||
@@index([cost_center_id], map: "idx_asset_cards_cost_center")
|
||||
@@index([purchase_request_id], map: "idx_asset_cards_purchase_request")
|
||||
@@index([assignee_employee_id], map: "idx_asset_cards_assignee")
|
||||
@@index([status], map: "idx_asset_cards_status")
|
||||
@@map("asset_cards")
|
||||
}
|
||||
|
||||
model ReimbursementForm {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
form_number String? @unique
|
||||
|
||||
在新工单中引用
屏蔽一个用户