fix: Persian duplicate-value errors; admin panel favicon uses the project logo
- PrismaExceptionFilter returned "Unique constraint failed on: mobile" in English for a duplicate. It now answers in Persian, naming the field (mobile, national code, member code, order number), with a safe generic fallback. Covered by a unit test. - The admin panel still shipped the old "NZ" favicon. favicon.png/.ico are now generated from the project logo (the same one the user apps use), in both public/ and dist/, and the links carry ?v=2 so browsers drop the cached icon. - Rebuilt apps/api/release/app.js. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
0c52adcd26
commit
600ce06d15
+14
-1
@@ -164101,8 +164101,21 @@ var require_prisma_exception_filter = __commonJS({
|
||||
};
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.PrismaExceptionFilter = void 0;
|
||||
exports2.uniqueViolationMessage = uniqueViolationMessage;
|
||||
var common_12 = require_common();
|
||||
var client_1 = require("@prisma/client");
|
||||
function uniqueViolationMessage(target) {
|
||||
const fields = (Array.isArray(target) ? target : [target]).map((t) => String(t ?? "")).join(",").toLowerCase();
|
||||
if (fields.includes("mobile"))
|
||||
return "\u0627\u06CC\u0646 \u0634\u0645\u0627\u0631\u0647 \u0645\u0648\u0628\u0627\u06CC\u0644 \u0642\u0628\u0644\u0627\u064B \u062B\u0628\u062A \u0634\u062F\u0647 \u0627\u0633\u062A";
|
||||
if (fields.includes("nationalcode"))
|
||||
return "\u0627\u06CC\u0646 \u06A9\u062F \u0645\u0644\u06CC \u0642\u0628\u0644\u0627\u064B \u062B\u0628\u062A \u0634\u062F\u0647 \u0627\u0633\u062A";
|
||||
if (fields.includes("membercode"))
|
||||
return "\u0627\u06CC\u0646 \u06A9\u062F \u0639\u0636\u0648\u06CC\u062A \u0642\u0628\u0644\u0627\u064B \u062B\u0628\u062A \u0634\u062F\u0647 \u0627\u0633\u062A";
|
||||
if (fields.includes("ordernumber"))
|
||||
return "\u0627\u06CC\u0646 \u0634\u0645\u0627\u0631\u0647 \u0633\u0641\u0627\u0631\u0634 \u0642\u0628\u0644\u0627\u064B \u062B\u0628\u062A \u0634\u062F\u0647 \u0627\u0633\u062A";
|
||||
return "\u0627\u06CC\u0646 \u0645\u0642\u062F\u0627\u0631 \u0642\u0628\u0644\u0627\u064B \u062B\u0628\u062A \u0634\u062F\u0647 \u0627\u0633\u062A \u0648 \u062A\u06A9\u0631\u0627\u0631\u06CC \u0627\u0633\u062A";
|
||||
}
|
||||
var PrismaExceptionFilter = class PrismaExceptionFilter {
|
||||
logger = new common_12.Logger("PrismaExceptionFilter");
|
||||
catch(exception, host) {
|
||||
@@ -164133,7 +164146,7 @@ var require_prisma_exception_filter = __commonJS({
|
||||
return response.status(common_12.HttpStatus.CONFLICT).json({
|
||||
statusCode: common_12.HttpStatus.CONFLICT,
|
||||
error: "Conflict",
|
||||
message: `Unique constraint failed on: ${exception.meta?.target?.join(", ")}`
|
||||
message: uniqueViolationMessage(exception.meta?.target)
|
||||
});
|
||||
case "P2003":
|
||||
return response.status(common_12.HttpStatus.BAD_REQUEST).json({
|
||||
|
||||
Reference in New Issue
Block a user