transform core api codes into this project, update modules as admin/pos context modules
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
model Customer {
|
||||
id String @id @default(uuid())
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
type CustomerType
|
||||
complex_id String
|
||||
is_favorite Boolean? @default(false)
|
||||
|
||||
sales_invoices SalesInvoice[]
|
||||
customerIndividuals CustomerIndividual?
|
||||
customerLegals CustomerLegal?
|
||||
|
||||
@@map("customers")
|
||||
}
|
||||
|
||||
model CustomerIndividual {
|
||||
customer_id String @id
|
||||
first_name String @db.VarChar(255)
|
||||
last_name String @db.VarChar(255)
|
||||
national_id String @db.Char(10)
|
||||
postal_code String @db.Char(10)
|
||||
economic_code String? @db.Char(10)
|
||||
complex_id String
|
||||
|
||||
customer Customer @relation(fields: [customer_id], references: [id])
|
||||
|
||||
@@unique([complex_id, national_id])
|
||||
@@map("customer_individuals")
|
||||
}
|
||||
|
||||
model CustomerLegal {
|
||||
customer_id String @id
|
||||
company_name String @db.VarChar(255)
|
||||
economic_code String @db.Char(10)
|
||||
registration_number String @db.Char(20)
|
||||
postal_code String @db.Char(10)
|
||||
complex_id String
|
||||
|
||||
customer Customer @relation(fields: [customer_id], references: [id])
|
||||
|
||||
@@unique([complex_id, registration_number])
|
||||
@@map("customer_legal")
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
enum PaymentMethodType {
|
||||
TERMINAL
|
||||
CASH
|
||||
SET_OFF
|
||||
CARD
|
||||
BANK
|
||||
CHECK
|
||||
OTHER
|
||||
}
|
||||
|
||||
enum PurchaseReceiptStatus {
|
||||
UNPAID
|
||||
PARTIALLY_PAID
|
||||
PAID
|
||||
}
|
||||
|
||||
enum SalesInvoiceType {
|
||||
GOOD
|
||||
SERVICE
|
||||
}
|
||||
|
||||
enum UnitType {
|
||||
COUNT
|
||||
GRAM
|
||||
KILOGRAM
|
||||
MILLILITER
|
||||
LITER
|
||||
METER
|
||||
HOUR
|
||||
}
|
||||
|
||||
enum GoodPricingModel {
|
||||
STANDARD
|
||||
GOLD
|
||||
}
|
||||
|
||||
enum CustomerType {
|
||||
INDIVIDUAL
|
||||
LEGAL
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
enum UserStatus {
|
||||
ACTIVE
|
||||
INACTIVE
|
||||
}
|
||||
|
||||
enum AccountRole {
|
||||
OWNER
|
||||
OPERATOR
|
||||
ACCOUNTANT
|
||||
}
|
||||
|
||||
enum AccountStatus {
|
||||
ACTIVE
|
||||
SUSPENDED
|
||||
}
|
||||
|
||||
enum POSStatus {
|
||||
ACTIVE
|
||||
DISABLED
|
||||
}
|
||||
|
||||
enum POSRole {
|
||||
MANAGER
|
||||
OPERATOR
|
||||
VIEWER
|
||||
}
|
||||
|
||||
enum LicenseType {
|
||||
BASIC
|
||||
PRO
|
||||
ENTERPRISE
|
||||
}
|
||||
|
||||
enum LicenseStatus {
|
||||
ACTIVE
|
||||
EXPIRED
|
||||
SUSPENDED
|
||||
}
|
||||
|
||||
enum POSType {
|
||||
PSP
|
||||
MOBILE
|
||||
API
|
||||
}
|
||||
|
||||
enum UserType {
|
||||
LEGAL
|
||||
INDIVIDUAL
|
||||
}
|
||||
|
||||
enum AccountType {
|
||||
PARTNER
|
||||
BUSINESS
|
||||
ADMIN
|
||||
PROVIDER
|
||||
POS
|
||||
}
|
||||
|
||||
enum PartnerRole {
|
||||
ADMIN
|
||||
OPERATOR
|
||||
}
|
||||
|
||||
enum BusinessRole {
|
||||
ADMIN
|
||||
OPERATOR
|
||||
}
|
||||
|
||||
enum ProviderRole {
|
||||
ADMIN
|
||||
OPERATOR
|
||||
}
|
||||
|
||||
enum TokenType {
|
||||
ACCESS
|
||||
REFRESH
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
model Good {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
description String? @db.Text
|
||||
sku String @db.VarChar(100)
|
||||
local_sku String? @unique() @db.VarChar(100)
|
||||
barcode String? @unique() @db.VarChar(100)
|
||||
base_sale_price Decimal? @default(0.00) @db.Decimal(15, 0)
|
||||
is_default_guild_good Boolean @default(false)
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
|
||||
complex_id String?
|
||||
category_id String?
|
||||
guild_id String?
|
||||
|
||||
category GoodCategory? @relation(fields: [category_id], references: [id])
|
||||
complex Complex? @relation(fields: [complex_id], references: [id])
|
||||
guild Guild? @relation(fields: [guild_id], references: [id])
|
||||
sales_invoice_items SalesInvoiceItem[]
|
||||
|
||||
@@index([category_id])
|
||||
@@map("goods")
|
||||
}
|
||||
|
||||
model GoodCategory {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(100)
|
||||
description String? @db.Text
|
||||
image_url String? @db.VarChar(255)
|
||||
complex_id String?
|
||||
is_default_guild_good Boolean @default(false)
|
||||
guild_id String?
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
|
||||
goods Good[]
|
||||
guild Guild? @relation(fields: [guild_id], references: [id])
|
||||
complex Complex? @relation(fields: [complex_id], references: [id])
|
||||
|
||||
@@map("good_categories")
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
model SalesInvoice {
|
||||
id String @id @default(uuid())
|
||||
code String @unique @db.VarChar(100)
|
||||
total_amount Decimal @db.Decimal(15, 2)
|
||||
notes String? @db.Text
|
||||
unknown_customer Json? @db.Json
|
||||
invoice_date DateTime? @default(now()) @db.Timestamp(0)
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
|
||||
customer_id String?
|
||||
account_id String
|
||||
complex_id String
|
||||
|
||||
customer Customer? @relation(fields: [customer_id], references: [id])
|
||||
items SalesInvoiceItem[]
|
||||
payments SalesInvoicePayment[]
|
||||
|
||||
@@map("sales_invoices")
|
||||
}
|
||||
|
||||
model SalesInvoiceItem {
|
||||
id String @id @default(uuid())
|
||||
quantity Decimal @db.Decimal(10, 0)
|
||||
unit_type UnitType
|
||||
unit_price Decimal @default(0.00) @db.Decimal(15, 2)
|
||||
total_amount Decimal @default(0.00) @db.Decimal(15, 2)
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
discount Decimal @default(0.00) @db.Decimal(15, 2)
|
||||
notes String? @db.Text
|
||||
|
||||
invoice_id String
|
||||
good_id String?
|
||||
service_id String?
|
||||
|
||||
payload Json?
|
||||
|
||||
invoice SalesInvoice @relation(fields: [invoice_id], references: [id])
|
||||
good Good? @relation(fields: [good_id], references: [id])
|
||||
service Service? @relation(fields: [service_id], references: [id])
|
||||
|
||||
@@index([invoice_id, good_id])
|
||||
@@map("sales_invoice_items")
|
||||
}
|
||||
|
||||
model SalesInvoicePayment {
|
||||
id String @id @default(uuid())
|
||||
invoice_id String
|
||||
amount Decimal @db.Decimal(15, 2)
|
||||
payment_method PaymentMethodType
|
||||
paid_at DateTime
|
||||
created_at DateTime @default(now())
|
||||
|
||||
invoice SalesInvoice @relation(fields: [invoice_id], references: [id])
|
||||
|
||||
@@index([invoice_id])
|
||||
@@map("sales_invoice_payments")
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
model Service {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
description String? @db.Text
|
||||
sku String @unique() @db.VarChar(100)
|
||||
local_sku String? @unique() @db.VarChar(100)
|
||||
barcode String? @unique() @db.VarChar(100)
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
category_id String?
|
||||
base_sale_price Decimal @default(0.00) @db.Decimal(15, 0)
|
||||
account_id String
|
||||
complex_id String
|
||||
|
||||
category ServiceCategory? @relation(fields: [category_id], references: [id])
|
||||
sales_invoice_items SalesInvoiceItem[]
|
||||
|
||||
@@index([category_id])
|
||||
@@map("services")
|
||||
}
|
||||
|
||||
model ServiceCategory {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(100)
|
||||
description String? @db.Text
|
||||
image_url String? @db.VarChar(255)
|
||||
account_id String
|
||||
complex_id String
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
|
||||
services Service[]
|
||||
|
||||
@@map("service_categories")
|
||||
}
|
||||
Reference in New Issue
Block a user