transform core api codes into this project, update modules as admin/pos context modules
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
model Token {
|
||||
id String @id @default(uuid())
|
||||
token String @unique
|
||||
type TokenType
|
||||
created_at DateTime @default(now())
|
||||
expires_at DateTime
|
||||
|
||||
account_id String
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
@@unique([type, account_id])
|
||||
@@map("tokens")
|
||||
}
|
||||
|
||||
model VerificationCode {
|
||||
id String @id @default(uuid())
|
||||
code String
|
||||
is_used Boolean @default(false)
|
||||
created_at DateTime @default(now())
|
||||
expires_at DateTime
|
||||
|
||||
account_id String
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
@@map("verification_codes")
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
model Guild {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String?
|
||||
|
||||
business_activities BusinessActivity[]
|
||||
goods Good[]
|
||||
good_categories GoodCategory[]
|
||||
|
||||
@@map("guilds")
|
||||
}
|
||||
|
||||
model BusinessActivity {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
created_at DateTime @default(now())
|
||||
guild_id String
|
||||
owner_id String
|
||||
|
||||
guild Guild @relation(fields: [guild_id], references: [id])
|
||||
user User @relation(fields: [owner_id], references: [id])
|
||||
|
||||
complexes Complex[]
|
||||
accounts Account[]
|
||||
|
||||
@@map("business_activities")
|
||||
}
|
||||
|
||||
model Complex {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
address String?
|
||||
tax_id String?
|
||||
|
||||
business_activity_id String
|
||||
|
||||
business_activity BusinessActivity @relation(fields: [business_activity_id], references: [id])
|
||||
|
||||
pos_list Pos[]
|
||||
goods Good[]
|
||||
good_categories GoodCategory[]
|
||||
|
||||
@@map("complexes")
|
||||
}
|
||||
|
||||
model Pos {
|
||||
id String @id @default(uuid())
|
||||
serial String @unique
|
||||
model String?
|
||||
status POSStatus @default(ACTIVE)
|
||||
pos_type POSType
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt()
|
||||
|
||||
complex_id String
|
||||
device_id String
|
||||
provider_id String?
|
||||
|
||||
complex Complex @relation(fields: [complex_id], references: [id])
|
||||
device Device @relation(fields: [device_id], references: [id])
|
||||
provider Provider? @relation(fields: [provider_id], references: [id])
|
||||
|
||||
licenses License[]
|
||||
accounts Account[]
|
||||
|
||||
@@map("poses")
|
||||
}
|
||||
|
||||
// model BusinessAccount {
|
||||
// id String @id @default(uuid())
|
||||
// role BusinessRole
|
||||
// status AccountStatus @default(ACTIVE)
|
||||
// created_at DateTime @default(now())
|
||||
// business_activity_id String
|
||||
// account_id String @unique
|
||||
|
||||
// account Account @relation(fields: [account_id], references: [id])
|
||||
// owned_activities BusinessActivity[] @relation("business_owner")
|
||||
|
||||
// @@unique([business_activity_id, account_id])
|
||||
// @@map("business_accounts")
|
||||
// }
|
||||
|
||||
// model PosAccount {
|
||||
// id String @id @default(uuid())
|
||||
// pos_id String
|
||||
// account_id String
|
||||
// role POSRole
|
||||
// created_at DateTime @default(now())
|
||||
|
||||
// pos Pos @relation(fields: [pos_id], references: [id])
|
||||
// account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
// @@unique([pos_id, account_id])
|
||||
// @@map("pos_accounts")
|
||||
// }
|
||||
@@ -0,0 +1,25 @@
|
||||
model DeviceBrand {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt()
|
||||
|
||||
devices Device[]
|
||||
|
||||
@@map("device_brands")
|
||||
}
|
||||
|
||||
model Device {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
os_version String?
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt()
|
||||
brand_id String
|
||||
|
||||
brand DeviceBrand @relation(fields: [brand_id], references: [id])
|
||||
poses Pos[]
|
||||
|
||||
@@map("devices")
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
model License {
|
||||
id String @id @default(uuid())
|
||||
starts_at DateTime
|
||||
expires_at DateTime
|
||||
status LicenseStatus
|
||||
|
||||
pos_id String
|
||||
partner_id String
|
||||
|
||||
pos Pos @relation(fields: [pos_id], references: [id])
|
||||
partner Partner @relation(fields: [partner_id], references: [id])
|
||||
|
||||
@@map("licenses")
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
model Partner {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String?
|
||||
|
||||
licenses License[]
|
||||
account Account[]
|
||||
|
||||
@@map("partners")
|
||||
}
|
||||
|
||||
// model PartnerAccount {
|
||||
// id String @id @default(uuid())
|
||||
// role PartnerRole
|
||||
// status AccountStatus @default(ACTIVE)
|
||||
// created_at DateTime @default(now())
|
||||
// partner_id String
|
||||
// account_id String @unique
|
||||
|
||||
// partner Partner @relation(fields: [partner_id], references: [id])
|
||||
// account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
// @@unique([partner_id, account_id])
|
||||
// @@map("partner_accounts")
|
||||
// }
|
||||
@@ -0,0 +1,72 @@
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
// user_type UserType
|
||||
created_at DateTime @default(now())
|
||||
|
||||
// individual_profile IndividualProfile?
|
||||
// legal_profile LegalProfile?
|
||||
mobile_number String @unique()
|
||||
national_code String? @unique()
|
||||
first_name String
|
||||
last_name String
|
||||
// username String
|
||||
accounts Account[]
|
||||
businessActivities BusinessActivity[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
// model LegalProfile {
|
||||
// user_id String @id
|
||||
// company_name String
|
||||
// register_no String @unique()
|
||||
// representative_name String?
|
||||
// representative_national_id String?
|
||||
|
||||
// // user User @relation(fields: [user_id], references: [id])
|
||||
|
||||
// @@map("legal_profiles")
|
||||
// }
|
||||
|
||||
// model IndividualProfile {
|
||||
// user_id String @id
|
||||
// national_code String @unique()
|
||||
// first_name String
|
||||
// last_name String
|
||||
// birth_date DateTime?
|
||||
// mobile_number String
|
||||
// // user User @relation(fields: [user_id], references: [id])
|
||||
|
||||
// @@map("individual_profiles")
|
||||
// }
|
||||
|
||||
model Account {
|
||||
id String @id @default(uuid())
|
||||
username String @unique()
|
||||
// first_name String
|
||||
// last_name String
|
||||
type AccountType
|
||||
status AccountStatus
|
||||
password String
|
||||
created_at DateTime @default(now())
|
||||
|
||||
user_id String
|
||||
user User @relation(fields: [user_id], references: [id])
|
||||
|
||||
partner_id String?
|
||||
partner Partner? @relation(fields: [partner_id], references: [id])
|
||||
|
||||
business_id String?
|
||||
business BusinessActivity? @relation(fields: [business_id], references: [id])
|
||||
|
||||
provider_id String?
|
||||
provider Provider? @relation(fields: [provider_id], references: [id])
|
||||
|
||||
pos_id String?
|
||||
pos Pos? @relation(fields: [pos_id], references: [id])
|
||||
|
||||
verification_codes VerificationCode[]
|
||||
tokens Token[]
|
||||
|
||||
@@map("accounts")
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
model Provider {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String?
|
||||
|
||||
pos_list Pos[]
|
||||
accounts Account[]
|
||||
|
||||
@@map("providers")
|
||||
}
|
||||
|
||||
// model ProviderAccount {
|
||||
// id String @id @default(uuid())
|
||||
// role ProviderRole
|
||||
// status AccountStatus @default(ACTIVE)
|
||||
// created_at DateTime @default(now())
|
||||
// provider_id String
|
||||
// account_id String @unique
|
||||
|
||||
// provider Provider @relation(fields: [provider_id], references: [id])
|
||||
// account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
// @@unique([provider_id, account_id])
|
||||
// @@map("provider_accounts")
|
||||
// }
|
||||
Reference in New Issue
Block a user