stuff done
This commit is contained in:
32
lib/db/prisma/schema/entity.prisma
Normal file
32
lib/db/prisma/schema/entity.prisma
Normal file
@@ -0,0 +1,32 @@
|
||||
model Entity {
|
||||
id Int @id @default(autoincrement())
|
||||
type EntityType
|
||||
published Boolean? @default(false)
|
||||
scopes Json?
|
||||
position Int? @default(0) @db.UnsignedSmallInt
|
||||
slug String? @db.VarChar(512)
|
||||
media String? @db.VarChar(512)
|
||||
storeId Int @default(1) @map("store_id")
|
||||
locales EntityLocale[]
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
|
||||
updatedAt DateTime? @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3)
|
||||
|
||||
@@unique([storeId, type, slug])
|
||||
@@map("entities")
|
||||
}
|
||||
|
||||
model EntityLocale {
|
||||
id Int @id @default(autoincrement())
|
||||
lang Lang @default(uk)
|
||||
slug String? @db.VarChar(512)
|
||||
title String @db.VarChar(384)
|
||||
annotation String? @db.MediumText
|
||||
body String? @db.MediumText
|
||||
entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)
|
||||
entityId Int @map("entity_id")
|
||||
meta Meta? @relation(fields: [metaId], references: [id], onDelete: Cascade)
|
||||
metaId Int? @map("meta_id")
|
||||
|
||||
@@unique([slug, lang])
|
||||
@@map("entity_locale")
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
enum DeliveryOption {
|
||||
NP
|
||||
PICKUP
|
||||
COURIER
|
||||
}
|
||||
|
||||
enum Lang {
|
||||
uk
|
||||
ru
|
||||
}
|
||||
|
||||
enum EntityType {
|
||||
article
|
||||
block
|
||||
page
|
||||
}
|
||||
|
||||
enum Unit {
|
||||
mkg
|
||||
mg
|
||||
|
||||
@@ -23,6 +23,7 @@ model Meta {
|
||||
openGraph OpenGraph?
|
||||
storeLocale StoreLocale[]
|
||||
productLocale ProductLocale[]
|
||||
entityLocale EntityLocale[]
|
||||
//vendorLocale VendorLocale[]
|
||||
|
||||
@@map("meta")
|
||||
|
||||
26
lib/db/prisma/schema/order.prisma
Normal file
26
lib/db/prisma/schema/order.prisma
Normal file
@@ -0,0 +1,26 @@
|
||||
model Order {
|
||||
id Int @id @default(autoincrement())
|
||||
storeId Int @default(1) @map("store_id")
|
||||
lang Lang
|
||||
orderNo String @map("order_no") @db.VarChar(45)
|
||||
isQuick Boolean @map("is_quick")
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int? @map("user_id")
|
||||
firstName String @map("first_name") @db.VarChar(255)
|
||||
patronymic String? @db.VarChar(255)
|
||||
surname String? @db.VarChar(255)
|
||||
deliveryOption DeliveryOption? @map("delivery_option")
|
||||
phone String? @db.Char(24)
|
||||
email String? @db.VarChar(320)
|
||||
emailSent Boolean? @map("email_sent")
|
||||
/// [OrderAddressType]
|
||||
address Json?
|
||||
notes String? @db.MediumText
|
||||
/// [OrderDetailsType]
|
||||
details Json
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
|
||||
updatedAt DateTime? @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3)
|
||||
|
||||
@@unique([orderNo, storeId])
|
||||
@@map("orders")
|
||||
}
|
||||
@@ -27,6 +27,7 @@ model User {
|
||||
extendedData Json? @map("extended_data") @db.Json
|
||||
// orders Order[]
|
||||
favorites UserFavouriteProduct[]
|
||||
orders Order[]
|
||||
reviews UserProductReview[]
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3)
|
||||
updatedAt DateTime? @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3)
|
||||
|
||||
Reference in New Issue
Block a user