Skip to content

Commit 09db749

Browse files
committed
chore(entity-archival): rebase
gh-1778
1 parent d12f712 commit 09db749

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

packages/archival/src/aws-s3/import-archive-data.provider.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,26 @@ export class ImportArchiveDataProvider
4949
const headers = Object.keys(jsonArray[0]);
5050
for (const entry of jsonArray) {
5151
for (const key of headers) {
52-
//sonarignore:start
5352
const value = entry[key];
54-
if (value === '') {
55-
entry[key] = null;
56-
} else if (
57-
typeof value === 'string' &&
58-
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(value)
59-
) {
60-
entry[key] = new Date(value);
61-
} else entry[key] = value;
53+
entry[key] = this.processEntryValue(key, value);
6254
}
63-
//sonarignore:end
6455
}
6556
return jsonArray;
6657
} catch (error) {
6758
throw new HttpErrors.UnprocessableEntity(error.message);
6859
}
6960
}
61+
62+
private processEntryValue(key: string, value: string) {
63+
if (value === '') {
64+
return null;
65+
}
66+
if (
67+
typeof value === 'string' &&
68+
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(value)
69+
) {
70+
return new Date(value);
71+
}
72+
return value;
73+
}
7074
}

packages/archival/src/services/import-archived-data.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
@injectable({scope: BindingScope.TRANSIENT})
3030
export class ImportArchivedDataService {
3131
// eslint-disable-next-line @typescript-eslint/no-explicit-any
32-
repo: any;
32+
repo: any; //NOSONAR
3333
constructor(
3434
@repository(JobDetailsRepository)
3535
public jobDetailsRepo: JobDetailsRepository,

0 commit comments

Comments
 (0)