Files
psp_api/prisma/schema/product.prisma
T
ahasani cbe51b9343 feat: implement bank accounts, branches, and banks modules with CRUD operations
- Added BankAccountsController, BankAccountsService, and related DTOs for managing bank accounts.
- Implemented BankBranchesController, BankBranchesService, and related DTOs for managing bank branches.
- Created BanksController and BanksService for retrieving bank information.
- Integrated Prisma for database operations across all modules.
- Added response mapping for consistent API responses.
2025-12-24 21:24:59 +03:30

77 lines
3.7 KiB
Plaintext

model ProductVariant {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
basePrice Decimal @db.Decimal(10, 2)
salePrice Decimal @db.Decimal(10, 2)
description String? @db.Text
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
imageUrl String? @db.VarChar(255)
unit String? @db.VarChar(10)
quantity Decimal? @default(0.00) @db.Decimal(10, 2)
alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2)
isActive Boolean @default(true)
isFeatured Boolean @default(false)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
productId Int
product Product @relation("Product_Variant", fields: [productId], references: [id], onUpdate: NoAction)
@@index([productId], map: "Product_Variants_productId_fkey")
@@map("Product_Variants")
}
model Product {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
description String? @db.Text
sku String? @unique(map: "products_sku_unique") @db.VarChar(100)
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
brandId Int?
categoryId Int?
salePrice Decimal @default(0.00) @db.Decimal(10, 2)
inventoryTransferItems InventoryTransferItem[] @relation("InventoryTransferItem_Product")
// productCharges ProductCharge[] @relation("Product_Charges")
variants ProductVariant[] @relation("Product_Variant")
brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction)
category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
purchaseReceiptItems PurchaseReceiptItem[] @relation("Product_PurchaseReceiptItems")
salesInvoiceItems SalesInvoiceItem[] @relation("Product_SalesInvoiceItems")
stockAdjustments StockAdjustment[] @relation("Product_Stock_Adjustments")
stockBalances StockBalance[] @relation("StockBalance_Product")
stockMovements StockMovement[] @relation("StockMovement_Product")
@@index([brandId], map: "Products_brandId_fkey")
@@index([categoryId], map: "Products_categoryId_fkey")
@@map("Products")
}
model ProductBrand {
id Int @id @default(autoincrement())
name String @db.VarChar(100)
description String? @db.Text
imageUrl String? @db.VarChar(255)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
products Product[] @relation("Product_Brand")
@@map("Product_brands")
}
model ProductCategory {
id Int @id @default(autoincrement())
name String @db.VarChar(100)
description String? @db.Text
imageUrl String? @db.VarChar(255)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
products Product[] @relation("Product_Category")
@@map("Product_categories")
}