forked from Yara724/api
Fixed some bugs on FaTimestamps
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -46,15 +46,24 @@ function writeFaTimestampsOnUpdate(query: Query<any, any>): 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 {
|
||||
|
||||
Reference in New Issue
Block a user