add editable menu items for companies
This commit is contained in:
@@ -170,6 +170,14 @@ enum EmployeeRole {
|
||||
AGENT
|
||||
}
|
||||
|
||||
enum MenuItemType {
|
||||
INTERNAL_PAGE
|
||||
EXTERNAL_LINK
|
||||
PARENT_MENU
|
||||
SECTION_LABEL
|
||||
DIVIDER
|
||||
}
|
||||
|
||||
enum VehicleStatus {
|
||||
AVAILABLE
|
||||
RESERVED
|
||||
@@ -513,6 +521,7 @@ model Company {
|
||||
pricingRules PricingRule[]
|
||||
notifications Notification[] @relation("CompanyNotifications")
|
||||
complaints Complaint[]
|
||||
companyMenuItems CompanyMenuItem[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -1804,6 +1813,80 @@ model PlanFeature {
|
||||
@@map("plan_features")
|
||||
}
|
||||
|
||||
model MenuItem {
|
||||
id String @id @default(cuid())
|
||||
systemKey String? @unique
|
||||
label String
|
||||
itemType MenuItemType @default(INTERNAL_PAGE)
|
||||
routeOrUrl String?
|
||||
icon String?
|
||||
parentId String?
|
||||
parent MenuItem? @relation("MenuItemHierarchy", fields: [parentId], references: [id], onDelete: SetNull)
|
||||
children MenuItem[] @relation("MenuItemHierarchy")
|
||||
displayOrder Int @default(0)
|
||||
openInNewTab Boolean @default(false)
|
||||
isRequired Boolean @default(false)
|
||||
isActive Boolean @default(true)
|
||||
createdBy String?
|
||||
updatedBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
subscriptionAssignments SubscriptionMenuItem[]
|
||||
companyAssignments CompanyMenuItem[]
|
||||
roleVisibilities MenuItemRoleVisibility[]
|
||||
|
||||
@@index([parentId])
|
||||
@@index([isActive, displayOrder])
|
||||
@@map("menu_items")
|
||||
}
|
||||
|
||||
model SubscriptionMenuItem {
|
||||
id String @id @default(cuid())
|
||||
plan Plan
|
||||
menuItemId String
|
||||
menuItem MenuItem @relation(fields: [menuItemId], references: [id], onDelete: Cascade)
|
||||
displayOrder Int @default(0)
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([plan, menuItemId])
|
||||
@@index([menuItemId])
|
||||
@@index([plan, displayOrder])
|
||||
@@map("subscription_menu_items")
|
||||
}
|
||||
|
||||
model CompanyMenuItem {
|
||||
id String @id @default(cuid())
|
||||
companyId String
|
||||
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
|
||||
menuItemId String
|
||||
menuItem MenuItem @relation(fields: [menuItemId], references: [id], onDelete: Cascade)
|
||||
displayOrder Int @default(0)
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([companyId, menuItemId])
|
||||
@@index([menuItemId])
|
||||
@@index([companyId, displayOrder])
|
||||
@@map("company_menu_items")
|
||||
}
|
||||
|
||||
model MenuItemRoleVisibility {
|
||||
id String @id @default(cuid())
|
||||
menuItemId String
|
||||
menuItem MenuItem @relation(fields: [menuItemId], references: [id], onDelete: Cascade)
|
||||
role EmployeeRole
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([menuItemId, role])
|
||||
@@index([role])
|
||||
@@map("menu_item_role_visibility")
|
||||
}
|
||||
|
||||
model PricingPromotion {
|
||||
id String @id @default(cuid())
|
||||
code String @unique
|
||||
|
||||
Reference in New Issue
Block a user