2026-09-10 12:53:23 +03:30
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
PrismaClientKnownRequestError,
|
|
|
|
|
PrismaClientUnknownRequestError,
|
|
|
|
|
PrismaClientRustPanicError,
|
|
|
|
|
PrismaClientInitializationError,
|
|
|
|
|
PrismaClientValidationError,
|
|
|
|
|
NotFoundError,
|
|
|
|
|
getPrismaClient,
|
|
|
|
|
sqltag,
|
|
|
|
|
empty,
|
|
|
|
|
join,
|
|
|
|
|
raw,
|
|
|
|
|
skip,
|
|
|
|
|
Decimal,
|
|
|
|
|
Debug,
|
|
|
|
|
objectEnumValues,
|
|
|
|
|
makeStrictEnum,
|
|
|
|
|
Extensions,
|
|
|
|
|
warnOnce,
|
|
|
|
|
defineDmmfProperty,
|
|
|
|
|
Public,
|
|
|
|
|
getRuntime
|
|
|
|
|
} = require('@prisma/client/runtime/edge.js')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Prisma = {}
|
|
|
|
|
|
|
|
|
|
exports.Prisma = Prisma
|
|
|
|
|
exports.$Enums = {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prisma Client JS version: 5.22.0
|
|
|
|
|
* Query Engine version: 605197351a3c8bdd595af2d2a9bc3025bca48ea2
|
|
|
|
|
*/
|
|
|
|
|
Prisma.prismaVersion = {
|
|
|
|
|
client: "5.22.0",
|
|
|
|
|
engine: "605197351a3c8bdd595af2d2a9bc3025bca48ea2"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Prisma.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
|
|
|
|
|
Prisma.PrismaClientUnknownRequestError = PrismaClientUnknownRequestError
|
|
|
|
|
Prisma.PrismaClientRustPanicError = PrismaClientRustPanicError
|
|
|
|
|
Prisma.PrismaClientInitializationError = PrismaClientInitializationError
|
|
|
|
|
Prisma.PrismaClientValidationError = PrismaClientValidationError
|
|
|
|
|
Prisma.NotFoundError = NotFoundError
|
|
|
|
|
Prisma.Decimal = Decimal
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Re-export of sql-template-tag
|
|
|
|
|
*/
|
|
|
|
|
Prisma.sql = sqltag
|
|
|
|
|
Prisma.empty = empty
|
|
|
|
|
Prisma.join = join
|
|
|
|
|
Prisma.raw = raw
|
|
|
|
|
Prisma.validator = Public.validator
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Extensions
|
|
|
|
|
*/
|
|
|
|
|
Prisma.getExtensionContext = Extensions.getExtensionContext
|
|
|
|
|
Prisma.defineExtension = Extensions.defineExtension
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Shorthand utilities for JSON filtering
|
|
|
|
|
*/
|
|
|
|
|
Prisma.DbNull = objectEnumValues.instances.DbNull
|
|
|
|
|
Prisma.JsonNull = objectEnumValues.instances.JsonNull
|
|
|
|
|
Prisma.AnyNull = objectEnumValues.instances.AnyNull
|
|
|
|
|
|
|
|
|
|
Prisma.NullTypes = {
|
|
|
|
|
DbNull: objectEnumValues.classes.DbNull,
|
|
|
|
|
JsonNull: objectEnumValues.classes.JsonNull,
|
|
|
|
|
AnyNull: objectEnumValues.classes.AnyNull
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Enums
|
|
|
|
|
*/
|
|
|
|
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
|
|
|
|
|
ReadUncommitted: 'ReadUncommitted',
|
|
|
|
|
ReadCommitted: 'ReadCommitted',
|
|
|
|
|
RepeatableRead: 'RepeatableRead',
|
|
|
|
|
Serializable: 'Serializable'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exports.Prisma.CityScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
name: 'name',
|
|
|
|
|
province: 'province'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.AdminUserScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
fullName: 'fullName',
|
|
|
|
|
mobile: 'mobile',
|
|
|
|
|
passwordHash: 'passwordHash',
|
|
|
|
|
role: 'role',
|
|
|
|
|
branchId: 'branchId',
|
|
|
|
|
wagePercent: 'wagePercent',
|
|
|
|
|
isActive: 'isActive',
|
|
|
|
|
createdAt: 'createdAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.CustomerScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
fullName: 'fullName',
|
|
|
|
|
mobile: 'mobile',
|
|
|
|
|
nationalCode: 'nationalCode',
|
|
|
|
|
passwordHash: 'passwordHash',
|
|
|
|
|
cityId: 'cityId',
|
|
|
|
|
referredByAgentId: 'referredByAgentId',
|
|
|
|
|
goldCreditLimitGrams: 'goldCreditLimitGrams',
|
|
|
|
|
goldDebtGrams: 'goldDebtGrams',
|
|
|
|
|
fiatDebtRial: 'fiatDebtRial',
|
|
|
|
|
verificationStep: 'verificationStep',
|
|
|
|
|
nationalIdImageUrl: 'nationalIdImageUrl',
|
|
|
|
|
businessLicenseUrl: 'businessLicenseUrl',
|
|
|
|
|
shopImageUrl: 'shopImageUrl',
|
|
|
|
|
isActive: 'isActive',
|
|
|
|
|
createdAt: 'createdAt',
|
|
|
|
|
updatedAt: 'updatedAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.CustomerAddressScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
customerId: 'customerId',
|
|
|
|
|
cityId: 'cityId',
|
|
|
|
|
addressLine: 'addressLine',
|
|
|
|
|
isDefault: 'isDefault'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.BranchScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
name: 'name',
|
|
|
|
|
cityId: 'cityId'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.WorkshopScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
name: 'name',
|
|
|
|
|
isActive: 'isActive'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.CategoryScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
title: 'title',
|
|
|
|
|
parentId: 'parentId'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.BrandScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
title: 'title'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.CollectionScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
title: 'title',
|
|
|
|
|
description: 'description',
|
|
|
|
|
isActive: 'isActive'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.CollectionProductScalarFieldEnum = {
|
|
|
|
|
collectionId: 'collectionId',
|
|
|
|
|
productId: 'productId'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.ProductScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
title: 'title',
|
|
|
|
|
description: 'description',
|
|
|
|
|
categoryId: 'categoryId',
|
|
|
|
|
brandId: 'brandId',
|
|
|
|
|
isActive: 'isActive',
|
|
|
|
|
createdAt: 'createdAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.ProductImageScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
productId: 'productId',
|
|
|
|
|
url: 'url',
|
|
|
|
|
sortOrder: 'sortOrder'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.ProductVariantScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
productId: 'productId',
|
|
|
|
|
title: 'title',
|
|
|
|
|
sku: 'sku',
|
|
|
|
|
rashWeightGrams: 'rashWeightGrams',
|
|
|
|
|
defaultWagePercent: 'defaultWagePercent',
|
|
|
|
|
isActive: 'isActive'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.OrderScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
orderNumber: 'orderNumber',
|
|
|
|
|
customerId: 'customerId',
|
|
|
|
|
branchId: 'branchId',
|
|
|
|
|
status: 'status',
|
|
|
|
|
totalGoldWeightGrams: 'totalGoldWeightGrams',
|
|
|
|
|
wageWeightGrams: 'wageWeightGrams',
|
|
|
|
|
flatRialCharge: 'flatRialCharge',
|
|
|
|
|
isSuspendedOverCreditLimit: 'isSuspendedOverCreditLimit',
|
|
|
|
|
deliveredAt: 'deliveredAt',
|
|
|
|
|
createdAt: 'createdAt',
|
|
|
|
|
updatedAt: 'updatedAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.OrderItemScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
orderId: 'orderId',
|
|
|
|
|
productVariantId: 'productVariantId',
|
|
|
|
|
quantity: 'quantity',
|
|
|
|
|
rashWeightGramsSnapshot: 'rashWeightGramsSnapshot',
|
|
|
|
|
wagePercentSnapshot: 'wagePercentSnapshot',
|
|
|
|
|
discountPercentSnapshot: 'discountPercentSnapshot',
|
|
|
|
|
computedWeightGrams: 'computedWeightGrams',
|
|
|
|
|
flatRialCharge: 'flatRialCharge'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.OrderStatusEventScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
orderId: 'orderId',
|
|
|
|
|
fromStatus: 'fromStatus',
|
|
|
|
|
toStatus: 'toStatus',
|
|
|
|
|
note: 'note',
|
|
|
|
|
actorAdminUserId: 'actorAdminUserId',
|
|
|
|
|
createdAt: 'createdAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.PreOrderScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
customerId: 'customerId',
|
|
|
|
|
cityId: 'cityId',
|
|
|
|
|
workshopId: 'workshopId',
|
|
|
|
|
status: 'status',
|
|
|
|
|
designImageUrl: 'designImageUrl',
|
|
|
|
|
colorName: 'colorName',
|
|
|
|
|
sizeSpec: 'sizeSpec',
|
|
|
|
|
stoneColor: 'stoneColor',
|
|
|
|
|
minaColor: 'minaColor',
|
|
|
|
|
estimatedWeightGrams: 'estimatedWeightGrams',
|
|
|
|
|
estimatedPriceRial: 'estimatedPriceRial',
|
|
|
|
|
description: 'description',
|
|
|
|
|
convertedOrderId: 'convertedOrderId',
|
|
|
|
|
createdAt: 'createdAt',
|
|
|
|
|
updatedAt: 'updatedAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.PreOrderStatusEventScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
preOrderId: 'preOrderId',
|
|
|
|
|
changes: 'changes',
|
|
|
|
|
actorAdminUserId: 'actorAdminUserId',
|
|
|
|
|
ipAddress: 'ipAddress',
|
|
|
|
|
createdAt: 'createdAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.LedgerEntryScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
customerId: 'customerId',
|
|
|
|
|
currency: 'currency',
|
|
|
|
|
direction: 'direction',
|
|
|
|
|
sourceType: 'sourceType',
|
|
|
|
|
amount: 'amount',
|
|
|
|
|
karatPerMille: 'karatPerMille',
|
|
|
|
|
pricePerGramRialAtEntry: 'pricePerGramRialAtEntry',
|
|
|
|
|
orderId: 'orderId',
|
|
|
|
|
confirmed: 'confirmed',
|
|
|
|
|
confirmedAt: 'confirmedAt',
|
|
|
|
|
postedByAdminUserId: 'postedByAdminUserId',
|
|
|
|
|
note: 'note',
|
|
|
|
|
createdAt: 'createdAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.GoldPriceQuoteScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
karatPerMille: 'karatPerMille',
|
|
|
|
|
pricePerGramRial: 'pricePerGramRial',
|
|
|
|
|
source: 'source',
|
|
|
|
|
quotedAt: 'quotedAt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.WalletBonusScalarFieldEnum = {
|
|
|
|
|
id: 'id',
|
|
|
|
|
customerId: 'customerId',
|
|
|
|
|
orderId: 'orderId',
|
|
|
|
|
goldGrams: 'goldGrams',
|
|
|
|
|
grantedAt: 'grantedAt',
|
|
|
|
|
expiresAt: 'expiresAt',
|
|
|
|
|
consumedAt: 'consumedAt',
|
|
|
|
|
isActive: 'isActive'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.SortOrder = {
|
|
|
|
|
asc: 'asc',
|
|
|
|
|
desc: 'desc'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.JsonNullValueInput = {
|
|
|
|
|
JsonNull: Prisma.JsonNull
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.QueryMode = {
|
|
|
|
|
default: 'default',
|
|
|
|
|
insensitive: 'insensitive'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.NullsOrder = {
|
|
|
|
|
first: 'first',
|
|
|
|
|
last: 'last'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.JsonNullValueFilter = {
|
|
|
|
|
DbNull: Prisma.DbNull,
|
|
|
|
|
JsonNull: Prisma.JsonNull,
|
|
|
|
|
AnyNull: Prisma.AnyNull
|
|
|
|
|
};
|
|
|
|
|
exports.AdminRole = exports.$Enums.AdminRole = {
|
|
|
|
|
SUPER_ADMIN: 'SUPER_ADMIN',
|
|
|
|
|
SYSTEM_APPROVER: 'SYSTEM_APPROVER',
|
|
|
|
|
SALES_EXPERT: 'SALES_EXPERT',
|
|
|
|
|
WORKSHOP_SUPERVISOR: 'WORKSHOP_SUPERVISOR',
|
|
|
|
|
ACCOUNTANT: 'ACCOUNTANT'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.VerificationStep = exports.$Enums.VerificationStep = {
|
|
|
|
|
UNVERIFIED: 'UNVERIFIED',
|
|
|
|
|
STEP_ONE_SUBMITTED: 'STEP_ONE_SUBMITTED',
|
|
|
|
|
STEP_TWO_SUBMITTED: 'STEP_TWO_SUBMITTED',
|
|
|
|
|
VERIFIED: 'VERIFIED'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.OrderStatus = exports.$Enums.OrderStatus = {
|
|
|
|
|
SUSPENDED: 'SUSPENDED',
|
|
|
|
|
PLACED: 'PLACED',
|
|
|
|
|
ADMIN_APPROVED: 'ADMIN_APPROVED',
|
|
|
|
|
SOURCING: 'SOURCING',
|
|
|
|
|
PREPARING: 'PREPARING',
|
|
|
|
|
DELIVERED_TO_AGENT: 'DELIVERED_TO_AGENT',
|
|
|
|
|
DELIVERED_TO_CUSTOMER: 'DELIVERED_TO_CUSTOMER',
|
|
|
|
|
CANCELLED: 'CANCELLED'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.PreOrderStatus = exports.$Enums.PreOrderStatus = {
|
|
|
|
|
PLACED: 'PLACED',
|
|
|
|
|
ADMIN_APPROVED: 'ADMIN_APPROVED',
|
|
|
|
|
WORKSHOP_APPROVED: 'WORKSHOP_APPROVED',
|
|
|
|
|
READY_TO_SHIP: 'READY_TO_SHIP',
|
|
|
|
|
DELIVERED: 'DELIVERED',
|
|
|
|
|
CANCELLED: 'CANCELLED'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.LedgerCurrency = exports.$Enums.LedgerCurrency = {
|
|
|
|
|
GOLD_GRAM: 'GOLD_GRAM',
|
|
|
|
|
RIAL: 'RIAL'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.LedgerDirection = exports.$Enums.LedgerDirection = {
|
|
|
|
|
DEBIT: 'DEBIT',
|
|
|
|
|
CREDIT: 'CREDIT'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.LedgerSourceType = exports.$Enums.LedgerSourceType = {
|
|
|
|
|
ORDER_STOCK: 'ORDER_STOCK',
|
|
|
|
|
ORDER_PRE_ORDER: 'ORDER_PRE_ORDER',
|
|
|
|
|
REPAYMENT_MELTED_GOLD: 'REPAYMENT_MELTED_GOLD',
|
|
|
|
|
REPAYMENT_TRANSFER: 'REPAYMENT_TRANSFER',
|
|
|
|
|
REPAYMENT_CHEQUE: 'REPAYMENT_CHEQUE',
|
|
|
|
|
REPAYMENT_CASH: 'REPAYMENT_CASH',
|
|
|
|
|
WALLET_BONUS: 'WALLET_BONUS',
|
|
|
|
|
ADJUSTMENT: 'ADJUSTMENT'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.Prisma.ModelName = {
|
|
|
|
|
City: 'City',
|
|
|
|
|
AdminUser: 'AdminUser',
|
|
|
|
|
Customer: 'Customer',
|
|
|
|
|
CustomerAddress: 'CustomerAddress',
|
|
|
|
|
Branch: 'Branch',
|
|
|
|
|
Workshop: 'Workshop',
|
|
|
|
|
Category: 'Category',
|
|
|
|
|
Brand: 'Brand',
|
|
|
|
|
Collection: 'Collection',
|
|
|
|
|
CollectionProduct: 'CollectionProduct',
|
|
|
|
|
Product: 'Product',
|
|
|
|
|
ProductImage: 'ProductImage',
|
|
|
|
|
ProductVariant: 'ProductVariant',
|
|
|
|
|
Order: 'Order',
|
|
|
|
|
OrderItem: 'OrderItem',
|
|
|
|
|
OrderStatusEvent: 'OrderStatusEvent',
|
|
|
|
|
PreOrder: 'PreOrder',
|
|
|
|
|
PreOrderStatusEvent: 'PreOrderStatusEvent',
|
|
|
|
|
LedgerEntry: 'LedgerEntry',
|
|
|
|
|
GoldPriceQuote: 'GoldPriceQuote',
|
|
|
|
|
WalletBonus: 'WalletBonus'
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* Create the Client
|
|
|
|
|
*/
|
|
|
|
|
const config = {
|
|
|
|
|
"generator": {
|
|
|
|
|
"name": "client",
|
|
|
|
|
"provider": {
|
|
|
|
|
"fromEnvVar": null,
|
|
|
|
|
"value": "prisma-client-js"
|
|
|
|
|
},
|
|
|
|
|
"output": {
|
|
|
|
|
"value": "C:\\App\\gold-bank\\node_modules\\.pnpm\\@prisma+client@5.22.0_prisma@5.22.0\\node_modules\\@prisma\\client",
|
|
|
|
|
"fromEnvVar": null
|
|
|
|
|
},
|
|
|
|
|
"config": {
|
|
|
|
|
"engineType": "library"
|
|
|
|
|
},
|
|
|
|
|
"binaryTargets": [
|
|
|
|
|
{
|
|
|
|
|
"fromEnvVar": null,
|
|
|
|
|
"value": "windows",
|
|
|
|
|
"native": true
|
|
|
|
|
},
|
2026-09-10 13:00:05 +03:30
|
|
|
{
|
|
|
|
|
"fromEnvVar": null,
|
2026-09-10 13:58:50 +03:30
|
|
|
"value": "debian-openssl-3.0.x"
|
2026-09-10 12:53:23 +03:30
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"previewFeatures": [],
|
|
|
|
|
"sourceFilePath": "C:\\App\\gold-bank\\apps\\api\\prisma\\schema.prisma"
|
|
|
|
|
},
|
|
|
|
|
"relativeEnvPaths": {
|
|
|
|
|
"rootEnvPath": null
|
|
|
|
|
},
|
|
|
|
|
"relativePath": "../../../../../../apps/api/prisma",
|
|
|
|
|
"clientVersion": "5.22.0",
|
|
|
|
|
"engineVersion": "605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
|
|
|
|
"datasourceNames": [
|
|
|
|
|
"db"
|
|
|
|
|
],
|
|
|
|
|
"activeProvider": "postgresql",
|
|
|
|
|
"postinstall": false,
|
|
|
|
|
"inlineDatasources": {
|
|
|
|
|
"db": {
|
|
|
|
|
"url": {
|
|
|
|
|
"fromEnvVar": "DATABASE_URL",
|
|
|
|
|
"value": null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-09-10 13:58:50 +03:30
|
|
|
"inlineSchema": "// Gold Banking System — core schema\n// Canonical accounting model: legacy \"System A\" gram ledger (see migration notes).\n// The external \"Tahesab\" service is retired — LedgerEntry is the sole source of truth.\n// All money/weight fields use Decimal, never Float, to avoid rounding drift in debt math.\n\ngenerator client {\n provider = \"prisma-client-js\"\n // native = local Windows/macOS; debian-openssl-3.0.x = node:20-bookworm-slim (Arvan)\n binaryTargets = [\"native\", \"debian-openssl-3.0.x\"]\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Enums\n// ─────────────────────────────────────────────────────────────────────────\n\nenum AdminRole {\n SUPER_ADMIN\n SYSTEM_APPROVER // legacy: تایید مدیر سیستم\n SALES_EXPERT // legacy Customer.type=1, also acts as a referral \"reagent\"\n WORKSHOP_SUPERVISOR\n ACCOUNTANT\n}\n\nenum VerificationStep {\n UNVERIFIED\n STEP_ONE_SUBMITTED\n STEP_TWO_SUBMITTED\n VERIFIED\n}\n\nenum OrderStatus {\n SUSPENDED // credit limit (goldCreditLimitGrams) exceeded at placement\n PLACED\n ADMIN_APPROVED\n SOURCING\n PREPARING\n DELIVERED_TO_AGENT\n DELIVERED_TO_CUSTOMER // debt recognition point — mirrors legacy sts>4\n CANCELLED\n}\n\nenum PreOrderStatus {\n PLACED\n ADMIN_APPROVED\n WORKSHOP_APPROVED\n READY_TO_SHIP\n DELIVERED\n CANCELLED\n}\n\nenum LedgerCurrency {\n GOLD_GRAM\n RIAL\n}\n\nenum LedgerDirection {\n DEBIT // increases what the customer owes\n CREDIT // decreases what the customer owes\n}\n\nenum LedgerSourceType {\n ORDER_STOCK\n ORDER_PRE_ORDER\n REPAYMENT_MELTED_GOLD // karat-normalized: amount * karatPerMille / 750\n REPAYMENT_TRANSFER\n REPAYMENT_CHEQUE\n REPAYMENT_CASH // price-per-gram-normalized via pricePerGramRialAtEntry\n WALLET_BONUS\n ADJUSTMENT\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Identity\n// ─────────────────────────────────────────────────────────────────────────\n\nmodel City {\n id String @id @default(cuid())\n name String\n province String?\n customers Customer[]\n addresses CustomerAddress[]\n branches Branch[]\n preOrders PreOrder[]\n}\n\nmodel AdminUser {\n id String @id @default(cuid())\n fullName String\n mobile String @unique\n passwordHash String\n role AdminRole\n branchId String?\n branch Branch? @relation(fields: [branchId], references: [id])\n wagePercent Decimal? @db.Decimal(6, 3) // legacy Customer.percent, commission on referred orders\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n\n referredCustomers Customer[] @relation(\"ReferralAgent\")\n postedLedgerEntries LedgerEntry[]\n orderStatusEvents OrderStatusEvent[]\n preOrderStatusEvents PreOrderStatusEvent[]\n\n @@index([role])\n}\n\nmodel Customer {\n id String @id @default(cuid())\n fullName String\n mobile String @unique\n nationalCode String @unique\n passwordHash String\n cityId String?\n city City? @relation(fields: [cityId], references: [id])\n\n referredByAgentId String?\n referredByAgent AdminUser? @relation(\"ReferralAgent\", fields: [referredByAgentId], references: [id])\n\n // Credit limit + cached ledger balances (source of truth is LedgerEntry; these
|
|
|
|
|
"inlineSchemaHash": "c0944da476bdb47884e1c9d2aeeb374e6077907fd89970148d89eff210dfe8ab",
|
2026-09-10 12:53:23 +03:30
|
|
|
"copyEngine": true
|
|
|
|
|
}
|
|
|
|
|
config.dirname = '/'
|
|
|
|
|
|
|
|
|
|
config.runtimeDataModel = JSON.parse("{\"models\":{\"City\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"cuid\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"province\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customers\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CityToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addresses\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerAddress\",\"relationName\":\"CityToCustomerAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"branches\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Branch\",\"relationName\":\"BranchToCity\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"preOrders\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PreOrder\",\"relationName\":\"CityToPreOrder\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"AdminUser\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"cuid\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fullName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobile\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"AdminRole\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"branchId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"branch\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Branch\",\"relationName\":\"AdminUserToBranch\",\"relationFromFields\":[\"branchId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"wagePercent\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Deci
|
|
|
|
|
defineDmmfProperty(exports.Prisma, config.runtimeDataModel)
|
|
|
|
|
config.engineWasm = undefined
|
|
|
|
|
|
|
|
|
|
config.injectableEdgeEnv = () => ({
|
|
|
|
|
parsed: {
|
|
|
|
|
DATABASE_URL: typeof globalThis !== 'undefined' && globalThis['DATABASE_URL'] || typeof process !== 'undefined' && process.env && process.env.DATABASE_URL || undefined
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (typeof globalThis !== 'undefined' && globalThis['DEBUG'] || typeof process !== 'undefined' && process.env && process.env.DEBUG || undefined) {
|
|
|
|
|
Debug.enable(typeof globalThis !== 'undefined' && globalThis['DEBUG'] || typeof process !== 'undefined' && process.env && process.env.DEBUG || undefined)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const PrismaClient = getPrismaClient(config)
|
|
|
|
|
exports.PrismaClient = PrismaClient
|
|
|
|
|
Object.assign(exports, Prisma)
|
|
|
|
|
|