Files
tehran_taj/apps/api/release/vendor/.prisma/client/wasm.js
T
s.esmaeiliandClaude Sonnet 5 2b6795d007 api: fix migration runner, serve uploads correctly, add product photos
Three real bugs found and fixed while wiring up product images end-to-end:

1. src/prisma/migrate.ts only discovered flat prisma/migrations/<name>.sql
   files, never Prisma's own folder-per-migration layout
   (<timestamp>_<name>/migration.sql). Every migration created the normal
   way (via 'prisma migrate dev') was silently skipped; only a hand-added
   flat duplicate (prisma/migrations/0001_init.sql, now removed) ever ran.
   This meant schema.prisma had drifted well ahead of what any real deploy
   database actually had (missing columns on City, Customer, Branch,
   Product, several new tables). Fixed to discover both layouts; the
   drift is closed with a new 20260914165255_sync_schema_drift migration.

2. Neither nginx.conf (production) nor vite.config.ts (dev) proxied
   /uploads/ to the API — only /api/. UploadedFile/ProductImage URLs
   (/uploads/<file>, served by main.ts's useStaticAssets OUTSIDE the /api
   prefix) 404'd through both. Both now proxy /uploads/ the same way /api/
   already was.

3. docker-compose.yml's api service had no volume for storage/uploads, so
   every uploaded file — and by extension every ProductImage row pointing
   at one — was lost on the next container recreate/redeploy. Added a
   named volume.

Also: main.ts's static file serving now sets Content-Type: image/avif
explicitly (serve-static's bundled mime table predates .avif and served it
as application/octet-stream; browsers rendered it anyway by sniffing, but
a stricter client would not have).

Product photos: copied 15 real jewelry photos into the uploads volume,
registered them as UploadedFile rows, and assigned each of the 5 existing
Product rows a randomly picked one (duplicates allowed, per request),
replacing their /img/no-items.png placeholder ProductImage row. Verified
end-to-end in a real browser against the real containerized API+DB: logged
in, opened the admin product list, confirmed all 5 rows render their photo
(naturalWidth/Height populated, network 200s, no console errors).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 20:56:17 +03:30

681 lines
18 KiB
JavaScript

Object.defineProperty(exports, "__esModule", { value: true });
const {
Decimal,
objectEnumValues,
makeStrictEnum,
Public,
getRuntime,
skip
} = require('@prisma/client/runtime/index-browser.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 = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`PrismaClientKnownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)};
Prisma.PrismaClientUnknownRequestError = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`PrismaClientUnknownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.PrismaClientRustPanicError = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`PrismaClientRustPanicError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.PrismaClientInitializationError = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`PrismaClientInitializationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.PrismaClientValidationError = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`PrismaClientValidationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.NotFoundError = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`NotFoundError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.Decimal = Decimal
/**
* Re-export of sql-template-tag
*/
Prisma.sql = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`sqltag is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.empty = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`empty is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.join = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`join is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.raw = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`raw is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.validator = Public.validator
/**
* Extensions
*/
Prisma.getExtensionContext = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`Extensions.getExtensionContext is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
Prisma.defineExtension = () => {
const runtimeName = getRuntime().prettyName;
throw new Error(`Extensions.defineExtension is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
)}
/**
* 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',
percent: 'percent',
percentAux: 'percentAux'
};
exports.Prisma.AdminUserScalarFieldEnum = {
id: 'id',
fullName: 'fullName',
mobile: 'mobile',
passwordHash: 'passwordHash',
role: 'role',
userTypeId: 'userTypeId',
branchId: 'branchId',
wagePercent: 'wagePercent',
isActive: 'isActive',
createdAt: 'createdAt'
};
exports.Prisma.CustomerScalarFieldEnum = {
id: 'id',
fullName: 'fullName',
mobile: 'mobile',
nationalCode: 'nationalCode',
passwordHash: 'passwordHash',
cityId: 'cityId',
kind: 'kind',
phone: 'phone',
address: 'address',
storeName: 'storeName',
pasazhName: 'pasazhName',
zone: 'zone',
memberCode: 'memberCode',
referredByAgentId: 'referredByAgentId',
goldCreditLimitGrams: 'goldCreditLimitGrams',
goldDebtGrams: 'goldDebtGrams',
fiatDebtRial: 'fiatDebtRial',
verificationStep: 'verificationStep',
nationalIdImageUrl: 'nationalIdImageUrl',
businessLicenseUrl: 'businessLicenseUrl',
shopImageUrl: 'shopImageUrl',
avatarFileId: 'avatarFileId',
canPlaceOrders: 'canPlaceOrders',
isActive: 'isActive',
isArchived: 'isArchived',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};
exports.Prisma.CustomerAddressScalarFieldEnum = {
id: 'id',
customerId: 'customerId',
cityId: 'cityId',
addressLine: 'addressLine',
isDefault: 'isDefault'
};
exports.Prisma.BranchScalarFieldEnum = {
id: 'id',
name: 'name',
address: 'address',
phone: 'phone',
isActive: 'isActive',
cityId: 'cityId'
};
exports.Prisma.WorkshopScalarFieldEnum = {
id: 'id',
name: 'name',
address: 'address',
phone: 'phone',
supervisorId: 'supervisorId',
isActive: 'isActive'
};
exports.Prisma.CategoryScalarFieldEnum = {
id: 'id',
title: 'title',
type: 'type',
imageUrl: 'imageUrl',
iconUrl: 'iconUrl',
metaTag: 'metaTag',
description: 'description',
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',
productCode: 'productCode',
showType: 'showType',
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',
qty: 'qty',
isPreOrder: 'isPreOrder',
isActive: 'isActive'
};
exports.Prisma.OrderScalarFieldEnum = {
id: 'id',
orderNumber: 'orderNumber',
customerId: 'customerId',
branchId: 'branchId',
channel: 'channel',
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',
labName: 'labName',
hallmark: 'hallmark',
accountName: 'accountName',
bankName: 'bankName',
transferTo: 'transferTo',
originalValue: 'originalValue',
priceRial: 'priceRial',
receivedAt: 'receivedAt',
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.UserTypeScalarFieldEnum = {
id: 'id',
title: 'title',
isActive: 'isActive',
createdAt: 'createdAt'
};
exports.Prisma.PermissionScalarFieldEnum = {
rid: 'rid',
userTypeId: 'userTypeId'
};
exports.Prisma.CommentScalarFieldEnum = {
id: 'id',
productId: 'productId',
customerId: 'customerId',
body: 'body',
status: 'status',
replyToId: 'replyToId',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};
exports.Prisma.SettingScalarFieldEnum = {
key: 'key',
value: 'value',
updatedAt: 'updatedAt'
};
exports.Prisma.PromotionScalarFieldEnum = {
id: 'id',
title: 'title',
description: 'description',
scope: 'scope',
usage: 'usage',
discountPercent: 'discountPercent',
isActive: 'isActive',
platform: 'platform',
startsAt: 'startsAt',
endsAt: 'endsAt',
productId: 'productId',
categoryId: 'categoryId',
customerId: 'customerId',
brandId: 'brandId',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};
exports.Prisma.PromotionExclusionScalarFieldEnum = {
id: 'id',
type: 'type',
itemId: 'itemId',
createdAt: 'createdAt'
};
exports.Prisma.BranchAllocationScalarFieldEnum = {
id: 'id',
branchId: 'branchId',
allocatorAdminUserId: 'allocatorAdminUserId',
note: 'note',
createdAt: 'createdAt'
};
exports.Prisma.BranchAllocationItemScalarFieldEnum = {
id: 'id',
allocationId: 'allocationId',
productId: 'productId',
weightGrams: 'weightGrams'
};
exports.Prisma.SmsMessageScalarFieldEnum = {
id: 'id',
audience: 'audience',
recipients: 'recipients',
body: 'body',
sentCount: 'sentCount',
sentByAdminUserId: 'sentByAdminUserId',
createdAt: 'createdAt'
};
exports.Prisma.NotificationScalarFieldEnum = {
id: 'id',
title: 'title',
body: 'body',
audience: 'audience',
sentByAdminUserId: 'sentByAdminUserId',
createdAt: 'createdAt'
};
exports.Prisma.NotificationRecipientScalarFieldEnum = {
id: 'id',
notificationId: 'notificationId',
customerId: 'customerId',
readAt: 'readAt'
};
exports.Prisma.NewsletterSubscriberScalarFieldEnum = {
id: 'id',
email: 'email',
mobile: 'mobile',
createdAt: 'createdAt'
};
exports.Prisma.CustomerActivityLogScalarFieldEnum = {
id: 'id',
customerId: 'customerId',
action: 'action',
detail: 'detail',
createdAt: 'createdAt'
};
exports.Prisma.UploadedFileScalarFieldEnum = {
id: 'id',
url: 'url',
originalName: 'originalName',
mimeType: 'mimeType',
sizeBytes: 'sizeBytes',
purpose: 'purpose',
uploadedByAdminUserId: 'uploadedByAdminUserId',
createdAt: 'createdAt'
};
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.CustomerKind = exports.$Enums.CustomerKind = {
SALES_AGENT: 'SALES_AGENT',
APP_SHOPKEEPER: 'APP_SHOPKEEPER',
WALK_IN_SHOPKEEPER: 'WALK_IN_SHOPKEEPER',
BANKER: 'BANKER',
WORKSHOP_SUPERVISOR: 'WORKSHOP_SUPERVISOR'
};
exports.VerificationStep = exports.$Enums.VerificationStep = {
UNVERIFIED: 'UNVERIFIED',
STEP_ONE_SUBMITTED: 'STEP_ONE_SUBMITTED',
STEP_TWO_SUBMITTED: 'STEP_TWO_SUBMITTED',
VERIFIED: 'VERIFIED'
};
exports.OrderChannel = exports.$Enums.OrderChannel = {
RETAIL: 'RETAIL',
WHOLESALE: 'WHOLESALE'
};
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.CommentStatus = exports.$Enums.CommentStatus = {
PENDING: 'PENDING',
APPROVED: 'APPROVED',
REJECTED: 'REJECTED'
};
exports.PromotionScope = exports.$Enums.PromotionScope = {
PRODUCT: 'PRODUCT',
CATEGORY: 'CATEGORY',
CUSTOMER: 'CUSTOMER',
BRAND: 'BRAND'
};
exports.PromotionUsage = exports.$Enums.PromotionUsage = {
ONCE: 'ONCE',
UNTIL_END_DATE: 'UNTIL_END_DATE'
};
exports.MessageAudience = exports.$Enums.MessageAudience = {
SINGLE_NUMBER: 'SINGLE_NUMBER',
MULTIPLE_NUMBERS: 'MULTIPLE_NUMBERS',
ALL_CUSTOMERS: 'ALL_CUSTOMERS',
WHOLESALE_CUSTOMERS: 'WHOLESALE_CUSTOMERS',
RETAIL_CUSTOMERS: 'RETAIL_CUSTOMERS',
SALES_AGENTS: 'SALES_AGENTS'
};
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',
UserType: 'UserType',
Permission: 'Permission',
Comment: 'Comment',
Setting: 'Setting',
Promotion: 'Promotion',
PromotionExclusion: 'PromotionExclusion',
BranchAllocation: 'BranchAllocation',
BranchAllocationItem: 'BranchAllocationItem',
SmsMessage: 'SmsMessage',
Notification: 'Notification',
NotificationRecipient: 'NotificationRecipient',
NewsletterSubscriber: 'NewsletterSubscriber',
CustomerActivityLog: 'CustomerActivityLog',
UploadedFile: 'UploadedFile'
};
/**
* This is a stub Prisma Client that will error at runtime if called.
*/
class PrismaClient {
constructor() {
return new Proxy(this, {
get(target, prop) {
let message
const runtime = getRuntime()
if (runtime.isEdge) {
message = `PrismaClient is not configured to run in ${runtime.prettyName}. In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
`;
} else {
message = 'PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in `' + runtime.prettyName + '`).'
}
message += `
If this is unexpected, please open an issue: https://pris.ly/prisma-prisma-bug-report`
throw new Error(message)
}
})
}
}
exports.PrismaClient = PrismaClient
Object.assign(exports, Prisma)