File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -49,22 +49,26 @@ export class ImportArchiveDataProvider
49
49
const headers = Object . keys ( jsonArray [ 0 ] ) ;
50
50
for ( const entry of jsonArray ) {
51
51
for ( const key of headers ) {
52
- //sonarignore:start
53
52
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 ) ;
62
54
}
63
- //sonarignore:end
64
55
}
65
56
return jsonArray ;
66
57
} catch ( error ) {
67
58
throw new HttpErrors . UnprocessableEntity ( error . message ) ;
68
59
}
69
60
}
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
+ }
70
74
}
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import {
29
29
@injectable ( { scope : BindingScope . TRANSIENT } )
30
30
export class ImportArchivedDataService {
31
31
// eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- repo : any ;
32
+ repo : any ; //NOSONAR
33
33
constructor (
34
34
@repository ( JobDetailsRepository )
35
35
public jobDetailsRepo : JobDetailsRepository ,
You can’t perform that action at this time.
0 commit comments