Skip to content

Commit

Permalink
refactor(back): use .dat instead of .json.deflate for static map list…
Browse files Browse the repository at this point in the history
… file extension

fucking source
  • Loading branch information
tsa96 committed Mar 5, 2024
1 parent c7f4a9e commit 1756e60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions apps/backend/src/app/modules/maps/map-list.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ describe('MapListService', () => {

it('should set version values based on files in storage', async () => {
fileStoreMock.listFileKeys.mockResolvedValueOnce([
'maplist/approved/1.json.deflate'
'maplist/approved/1.dat'
]);
fileStoreMock.listFileKeys.mockResolvedValueOnce([
'maplist/submissions/15012024.json.deflate'
'maplist/submissions/15012024.dat'
]);

await service.onModuleInit();
Expand All @@ -58,10 +58,10 @@ describe('MapListService', () => {

it('should pick most recent when multiple versions exist in storage, and wipe old versions', async () => {
fileStoreMock.listFileKeys.mockResolvedValueOnce([
'maplist/approved/4.json.deflate',
'maplist/approved/5.json.deflate',
'maplist/approved/3.json.deflate',
'maplist/approved/1.json.deflate'
'maplist/approved/4.dat',
'maplist/approved/5.dat',
'maplist/approved/3.dat',
'maplist/approved/1.dat'
]);

await service.onModuleInit();
Expand All @@ -72,9 +72,9 @@ describe('MapListService', () => {
});

expect(fileStoreMock.deleteFiles).toHaveBeenCalledWith([
'maplist/approved/4.json.deflate',
'maplist/approved/3.json.deflate',
'maplist/approved/1.json.deflate'
'maplist/approved/4.dat',
'maplist/approved/3.dat',
'maplist/approved/1.dat'
]);
});
});
Expand Down
2 changes: 1 addition & 1 deletion libs/constants/src/consts/file-store-paths.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function mapListPath(
): string {
return `maplist/${
type === FlatMapList.APPROVED ? 'approved' : 'submissions'
}/${version}.json.deflate`;
}/${version}.dat`;
}

export function mapListDir(type: FlatMapList) {
Expand Down
2 changes: 1 addition & 1 deletion libs/test-utils/src/utils/s3.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class FileStoreUtil {
const file = await this.get(
`maplist/${
type === FlatMapList.APPROVED ? 'approved' : 'submissions'
}/${version}.json.deflate`
}/${version}.dat`
);
return JSON.parse(zlib.inflateSync(file).toString());
}
Expand Down

0 comments on commit 1756e60

Please sign in to comment.