Add blog categories and default SUPER_ADMIN store scope to Mana Collection.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-09 12:28:36 +03:30
co-authored by Cursor
parent 3da8a5d4a2
commit 20e81ade19
10 changed files with 328 additions and 18 deletions
+29 -8
View File
@@ -126,6 +126,7 @@ model Store {
products Product[]
categories Category[]
blogCategories BlogCategory[]
brands Brand[]
blogs BlogPost[]
orderItems OrderItem[]
@@ -219,24 +220,44 @@ model ProductVariant {
@@index([productId])
}
model BlogCategory {
id String @id @default(cuid())
storeId String
store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
parentId String?
parent BlogCategory? @relation("BlogCategoryTree", fields: [parentId], references: [id], onDelete: SetNull)
children BlogCategory[] @relation("BlogCategoryTree")
nameFa String
nameEn String @default("")
sortOrder Int @default(0)
blogs BlogPost[]
@@index([storeId])
@@index([parentId])
@@index([sortOrder])
}
model BlogPost {
id String @id @default(cuid())
id String @id @default(cuid())
storeId String
store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
categoryId String?
category BlogCategory? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
title String
summary String @default("")
body String @default("")
author String @default("")
summary String @default("")
body String @default("")
author String @default("")
imageUrl String?
imageKey String?
published Boolean @default(true)
published Boolean @default(true)
metaTitle String?
metaDescription String?
slug String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([storeId])
@@index([categoryId])
@@index([published])
@@index([slug])
}