fix(backend): correct syntax for prisma transaction in renameSymptom
Deploy Canina / deploy (push) Failing after 1m15s
Deploy Canina / deploy (push) Failing after 1m15s
This commit is contained in:
1 parent
468170349d
commit
305995cbe2
1 file changed
+4
-4
@@ -1894,16 +1894,16 @@ export class AdminService {
|
||||
const cleanOld = oldName.trim();
|
||||
const cleanNew = newName.trim();
|
||||
|
||||
return await this.prisma.(async (tx) => {
|
||||
return await this.prisma.$transaction(async (tx) => {
|
||||
// 1. Rename in product_symptoms join table
|
||||
const updatedJoin = await tx.`
|
||||
const updatedJoin = await tx.$executeRaw`
|
||||
UPDATE product_symptoms
|
||||
SET symptom = ${cleanNew}
|
||||
WHERE symptom = ${cleanOld};
|
||||
`;
|
||||
|
||||
// 2. Cascade rename in products.dosage_config->'symptoms' jsonb array
|
||||
await tx.`
|
||||
await tx.$executeRaw`
|
||||
UPDATE products
|
||||
SET dosage_config = jsonb_set(
|
||||
dosage_config,
|
||||
@@ -1924,7 +1924,7 @@ export class AdminService {
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: \`علامت «${cleanOld}» با موفقیت به «${cleanNew}» در سراسر سیستم تغییر یافت\`,
|
||||
message: `علامت «${cleanOld}» با موفقیت به «${cleanNew}» در سراسر سیستم تغییر یافت`,
|
||||
updatedCount: updatedJoin,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user