diff --git a/src/claim-request-management/claim-request-management.v2.controller.ts b/src/claim-request-management/claim-request-management.v2.controller.ts index 17afc98..04572a7 100644 --- a/src/claim-request-management/claim-request-management.v2.controller.ts +++ b/src/claim-request-management/claim-request-management.v2.controller.ts @@ -560,8 +560,7 @@ Returns status of each item (uploaded/captured or not). description: ` **Workflow Step:** UPLOAD_REQUIRED_DOCUMENTS (Step 5 of Claim) -**Upload one of the required documents** (13 for THIRD_PARTY; CAR_BODY may require fewer — see capture-requirements): -- car_green_card +**Upload one of the required documents** (12 for THIRD_PARTY; CAR_BODY may require fewer — see capture-requirements): - damaged_driving_license_front/back - damaged_chassis_number, damaged_engine_photo - damaged_car_card_front/back, damaged_metal_plate diff --git a/src/helpers/mongoose-fa-timestamps.plugin.ts b/src/helpers/mongoose-fa-timestamps.plugin.ts index 47f56c5..4241cfc 100644 --- a/src/helpers/mongoose-fa-timestamps.plugin.ts +++ b/src/helpers/mongoose-fa-timestamps.plugin.ts @@ -46,15 +46,24 @@ function writeFaTimestampsOnUpdate(query: Query): void { update.$set = {}; } - if (update.$set.createdAtFa == null && update.createdAtFa == null) { - update.$set.createdAtFa = nowFa; - } update.$set.updatedAtFa = nowFa; + + // Keep createdAtFa immutable on regular updates; set only for upsert inserts. + const opts = (query as any).getOptions?.() ?? {}; + if (opts.upsert) { + if (!update.$setOnInsert || typeof update.$setOnInsert !== "object") { + update.$setOnInsert = {}; + } + if (update.$setOnInsert.createdAtFa == null) { + update.$setOnInsert.createdAtFa = nowFa; + } + } + query.setUpdate(update); } /** - * Adds `createdAtFa` / `updatedAtFa` (Iran timezone, UTC+03:30 offset string) + * Adds `createdAtFa` / `updatedAtFa` (Iran timezone tuple: [date, time]) * to all schemas that use mongoose timestamps. */ export function applyIranFaTimestampPlugin(connection: Connection): void {