Skip to content

Commit 405a972

Browse files
committed
refactor: expand data to parse whole record instead of values
1 parent 326670d commit 405a972

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

apps/api/src/instrument-records/instrument-records.service.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,19 @@ export class InstrumentRecordsService {
423423
throw new Error('Record Array is Empty');
424424
}
425425
for (const objectEntry of Object.values(listEntry)) {
426-
for (const [dataKey, dataValue] of Object.entries(objectEntry as { [key: string]: any })) {
427-
const parseResult = $RecordArrayFieldValue.safeParse(dataValue);
428-
if (!parseResult.success) {
429-
validRecordArrayList.push({
430-
message: `Error interpreting value ${dataValue} and record array key ${dataKey}`,
431-
success: false
432-
});
433-
}
426+
const parseResult = $RecordArrayFieldValue.safeParse(objectEntry);
427+
if (!parseResult.success) {
428+
validRecordArrayList.push({
429+
message: `Error interpreting value of record array entry`,
430+
success: false
431+
});
432+
}
433+
for (const [dataKey, dataValue] of Object.entries(
434+
objectEntry as { [key: string]: boolean | Date | number | string | undefined }
435+
)) {
434436
validRecordArrayList.push({
435437
measure: dataKey,
436-
measureValue: parseResult.data,
438+
measureValue: dataValue,
437439
success: true
438440
});
439441
}

0 commit comments

Comments
 (0)