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
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}
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import {
2929@injectable ( { scope : BindingScope . TRANSIENT } )
3030export 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 ,
You can’t perform that action at this time.
0 commit comments