-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(back): expose full download URLs in maplistversion DTO
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,41 @@ | ||
import { MapListVersion } from '@momentum/constants'; | ||
import { FlatMapList, mapListPath, MapListVersion } from '@momentum/constants'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsInt } from 'class-validator'; | ||
import { Expose } from 'class-transformer'; | ||
import { Config } from '../../config'; | ||
|
||
const ENDPOINT_URL = Config.storage.endpointUrl; | ||
const BUCKET = Config.storage.bucketName; | ||
|
||
export class MapListVersionDto implements MapListVersion { | ||
@ApiProperty({ description: 'Latest version of the main map list' }) | ||
@IsInt() | ||
approved: number; | ||
|
||
@ApiProperty({ | ||
description: 'URL to the latest version of the main map list in file store' | ||
}) | ||
@Expose() | ||
get approvedURL(): string { | ||
return `${ENDPOINT_URL}/${BUCKET}/${mapListPath( | ||
FlatMapList.APPROVED, | ||
this.approved | ||
)}`; | ||
} | ||
|
||
@ApiProperty({ description: 'Latest version of the submission map list' }) | ||
@IsInt() | ||
submissions: number; | ||
|
||
@ApiProperty({ | ||
description: | ||
'URL to the latest version of the submission map list in file store' | ||
}) | ||
@Expose() | ||
get submissionsURL(): string { | ||
return `${ENDPOINT_URL}/${BUCKET}/${mapListPath( | ||
FlatMapList.SUBMISSION, | ||
this.submissions | ||
)}`; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
libs/constants/src/types/models/map/map-list-version.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export interface MapListVersion { | ||
approved: number; | ||
approvedURL: string; | ||
submissions: number; | ||
submissionsURL: string; | ||
} |