Skip to content

Commit

Permalink
fix(backend): data not getting updated with latest csv upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp committed May 6, 2024
1 parent 06e157d commit 69655cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
15 changes: 5 additions & 10 deletions backend/src/v1/object-store/object.store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import * as process from 'process'
import { logger } from '../../logger'
import { Readable } from 'stream'
import Papa from 'papaparse'
import { OmrrData } from '../types/omrr-data'
import { OmrrResponse } from '../types/omrr-response'
let omrrResponse: OmrrResponse

@Injectable()
export class ObjectStoreService implements OnModuleDestroy, OnModuleInit {
private readonly _s3Client: S3Client
private _omrrData: OmrrData[] = []
private omrrResponse: OmrrResponse;

constructor() {
this._s3Client = new S3Client({
Expand Down Expand Up @@ -75,7 +73,7 @@ export class ObjectStoreService implements OnModuleDestroy, OnModuleInit {
}

async getLatestOMRRFileContents(): Promise<OmrrResponse> {
return this.omrrResponse
return omrrResponse
}

async getLatestOmrrDataFromObjectStore(): Promise<OmrrResponse> {
Expand All @@ -97,14 +95,11 @@ export class ObjectStoreService implements OnModuleDestroy, OnModuleInit {
)
const fileStream: any = result?.Body
if (fileStream) {
this._omrrData = await this.convertCSVToJson(fileStream)

this.omrrResponse = {
omrrResponse = {
lastModified: lastModified,
omrrData: this._omrrData,

omrrData: await this.convertCSVToJson(fileStream),
}
return this.omrrResponse
return omrrResponse
}
} catch (e) {
}
Expand Down
1 change: 0 additions & 1 deletion backend/src/v1/tasks/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class TasksService {
async refreshCache() {
logger.info('refresh cache every 5 minutes')
await this.objectStoreService.getLatestOmrrDataFromObjectStore()

}

}

0 comments on commit 69655cd

Please sign in to comment.