-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(globals): correct UPPER_CASE casing for globals (#446)
- Loading branch information
1 parent
b3472bd
commit 669ffa1
Showing
261 changed files
with
12,567 additions
and
12,154 deletions.
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
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
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
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
48 changes: 0 additions & 48 deletions
48
src/modules/game/constants/game-additional-card/game-additional-card.constant.ts
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
src/modules/game/constants/game-additional-cards/game-additional-cards.constant.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
|
||
import type { GameAdditionalCard } from "@/modules/game/schemas/game-additional-card/game-additional-card.schema"; | ||
import { ROLES } from "@/modules/role/constants/role.constant"; | ||
import { RoleNames } from "@/modules/role/enums/role.enum"; | ||
|
||
const GAME_ADDITIONAL_CARDS_THIEF_ROLE_NAMES: Readonly<RoleNames[]> = Object.freeze(ROLES.filter(({ minInGame, name }) => name !== RoleNames.THIEF && minInGame === undefined).map(({ name }) => name)); | ||
|
||
const GAME_ADDITIONAL_CARDS_FIELDS_SPECS: Readonly<Record<keyof GameAdditionalCard, ApiPropertyOptions>> = Object.freeze({ | ||
_id: { required: true }, | ||
roleName: { | ||
required: true, | ||
enum: RoleNames, | ||
}, | ||
recipient: { | ||
required: true, | ||
enum: [RoleNames.THIEF], | ||
}, | ||
isUsed: { | ||
required: true, | ||
default: false, | ||
}, | ||
}); | ||
|
||
const GAME_ADDITIONAL_CARDS_API_PROPERTIES: Readonly<Record<keyof GameAdditionalCard, ApiPropertyOptions>> = Object.freeze({ | ||
_id: { | ||
description: "Game additional card Mongo Object Id", | ||
...GAME_ADDITIONAL_CARDS_FIELDS_SPECS._id, | ||
}, | ||
roleName: { | ||
description: `Game additional card role name. If \`recipient\` is \`${RoleNames.THIEF}\`, possible values are : ${GAME_ADDITIONAL_CARDS_THIEF_ROLE_NAMES.toString()}`, | ||
...GAME_ADDITIONAL_CARDS_FIELDS_SPECS.roleName, | ||
}, | ||
recipient: { | ||
description: "Game additional card recipient", | ||
...GAME_ADDITIONAL_CARDS_FIELDS_SPECS.recipient, | ||
}, | ||
isUsed: { | ||
description: "If set to `true`, the card has been used by its recipient", | ||
...GAME_ADDITIONAL_CARDS_FIELDS_SPECS.isUsed, | ||
}, | ||
}); | ||
|
||
export { | ||
GAME_ADDITIONAL_CARDS_THIEF_ROLE_NAMES, | ||
GAME_ADDITIONAL_CARDS_FIELDS_SPECS, | ||
GAME_ADDITIONAL_CARDS_API_PROPERTIES, | ||
}; |
17 changes: 10 additions & 7 deletions
17
.../game-history-record/game-history-record-play/game-history-record-play-source.constant.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,28 +1,31 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
|
||
import { gameSourceValues } from "@/modules/game/constants/game.constant"; | ||
import { GAME_SOURCE_VALUES } from "@/modules/game/constants/game.constant"; | ||
import type { GameHistoryRecordPlaySource } from "@/modules/game/schemas/game-history-record/game-history-record-play/game-history-record-play-source.schema"; | ||
|
||
const gameHistoryRecordPlaySourceFieldsSpecs = Object.freeze<Record<keyof GameHistoryRecordPlaySource, ApiPropertyOptions>>({ | ||
const GAME_HISTORY_RECORD_PLAY_SOURCE_FIELDS_SPECS = Object.freeze<Record<keyof GameHistoryRecordPlaySource, ApiPropertyOptions>>({ | ||
name: { | ||
required: true, | ||
enum: gameSourceValues, | ||
enum: GAME_SOURCE_VALUES, | ||
}, | ||
players: { | ||
minItems: 1, | ||
required: true, | ||
}, | ||
}); | ||
|
||
const gameHistoryRecordPlaySourceApiProperties = Object.freeze<Record<keyof GameHistoryRecordPlaySource, ApiPropertyOptions>>({ | ||
const GAME_HISTORY_RECORD_PLAY_SOURCE_API_PROPERTIES = Object.freeze<Record<keyof GameHistoryRecordPlaySource, ApiPropertyOptions>>({ | ||
name: { | ||
description: "Source of the play", | ||
...gameHistoryRecordPlaySourceFieldsSpecs.name, | ||
...GAME_HISTORY_RECORD_PLAY_SOURCE_FIELDS_SPECS.name, | ||
}, | ||
players: { | ||
description: "Players that made the play", | ||
...gameHistoryRecordPlaySourceFieldsSpecs.players, | ||
...GAME_HISTORY_RECORD_PLAY_SOURCE_FIELDS_SPECS.players, | ||
}, | ||
}); | ||
|
||
export { gameHistoryRecordPlaySourceFieldsSpecs, gameHistoryRecordPlaySourceApiProperties }; | ||
export { | ||
GAME_HISTORY_RECORD_PLAY_SOURCE_FIELDS_SPECS, | ||
GAME_HISTORY_RECORD_PLAY_SOURCE_API_PROPERTIES, | ||
}; |
19 changes: 11 additions & 8 deletions
19
.../game-history-record/game-history-record-play/game-history-record-play-target.constant.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,30 +1,33 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
|
||
import { WITCH_POTIONS } from "@/modules/game/enums/game-play.enum"; | ||
import { WitchPotions } from "@/modules/game/enums/game-play.enum"; | ||
import type { GameHistoryRecordPlayTarget } from "@/modules/game/schemas/game-history-record/game-history-record-play/game-history-record-play-target.schema"; | ||
|
||
const gameHistoryRecordPlayTargetFieldsSpecs = Object.freeze<Record<keyof GameHistoryRecordPlayTarget, ApiPropertyOptions>>({ | ||
const GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS = Object.freeze<Record<keyof GameHistoryRecordPlayTarget, ApiPropertyOptions>>({ | ||
player: { required: true }, | ||
isInfected: { required: false }, | ||
drankPotion: { | ||
enum: WITCH_POTIONS, | ||
enum: WitchPotions, | ||
required: false, | ||
}, | ||
}); | ||
|
||
const gameHistoryRecordPlayTargetApiProperties = Object.freeze<Record<keyof GameHistoryRecordPlayTarget, ApiPropertyOptions>>({ | ||
const GAME_HISTORY_RECORD_PLAY_TARGET_API_PROPERTIES = Object.freeze<Record<keyof GameHistoryRecordPlayTarget, ApiPropertyOptions>>({ | ||
player: { | ||
description: "Targeted player of this play", | ||
...gameHistoryRecordPlayTargetFieldsSpecs.player, | ||
...GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS.player, | ||
}, | ||
isInfected: { | ||
description: "Only if there is the `vile father of wolves` in the game and the action is eat from werewolves. If set to `true`, the target joined the werewolves side", | ||
...gameHistoryRecordPlayTargetFieldsSpecs.isInfected, | ||
...GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS.isInfected, | ||
}, | ||
drankPotion: { | ||
description: "Only if there is the `witch` in the game. The consequences depends on the type of potion", | ||
...gameHistoryRecordPlayTargetFieldsSpecs.drankPotion, | ||
...GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS.drankPotion, | ||
}, | ||
}); | ||
|
||
export { gameHistoryRecordPlayTargetFieldsSpecs, gameHistoryRecordPlayTargetApiProperties }; | ||
export { | ||
GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS, | ||
GAME_HISTORY_RECORD_PLAY_TARGET_API_PROPERTIES, | ||
}; |
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
16 changes: 8 additions & 8 deletions
16
.../game-history-record/game-history-record-play/game-history-record-play-voting.constant.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,28 +1,28 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
|
||
import { GAME_HISTORY_RECORD_VOTING_RESULTS } from "@/modules/game/enums/game-history-record.enum"; | ||
import { GameHistoryRecordVotingResults } from "@/modules/game/enums/game-history-record.enum"; | ||
import type { GameHistoryRecordPlayVoting } from "@/modules/game/schemas/game-history-record/game-history-record-play/game-history-record-play-voting.schema"; | ||
|
||
const gameHistoryRecordPlayVotingFieldsSpecs = Object.freeze<Record<keyof GameHistoryRecordPlayVoting, ApiPropertyOptions>>({ | ||
const GAME_HISTORY_RECORD_PLAY_VOTING_FIELDS_SPECS = Object.freeze<Record<keyof GameHistoryRecordPlayVoting, ApiPropertyOptions>>({ | ||
result: { | ||
required: true, | ||
enum: GAME_HISTORY_RECORD_VOTING_RESULTS, | ||
enum: GameHistoryRecordVotingResults, | ||
}, | ||
nominatedPlayers: { required: false }, | ||
}); | ||
|
||
const gameHistoryRecordPlayVotingApiProperties = Object.freeze<Record<keyof GameHistoryRecordPlayVoting, ApiPropertyOptions>>({ | ||
const GAME_HISTORY_RECORD_PLAY_VOTING_API_PROPERTIES = Object.freeze<Record<keyof GameHistoryRecordPlayVoting, ApiPropertyOptions>>({ | ||
result: { | ||
description: "Define the results and their consequences", | ||
...gameHistoryRecordPlayVotingFieldsSpecs.result, | ||
...GAME_HISTORY_RECORD_PLAY_VOTING_FIELDS_SPECS.result, | ||
}, | ||
nominatedPlayers: { | ||
description: "Nominated players from the play votes", | ||
...gameHistoryRecordPlayVotingFieldsSpecs.nominatedPlayers, | ||
...GAME_HISTORY_RECORD_PLAY_VOTING_FIELDS_SPECS.nominatedPlayers, | ||
}, | ||
}); | ||
|
||
export { | ||
gameHistoryRecordPlayVotingFieldsSpecs, | ||
gameHistoryRecordPlayVotingApiProperties, | ||
GAME_HISTORY_RECORD_PLAY_VOTING_FIELDS_SPECS, | ||
GAME_HISTORY_RECORD_PLAY_VOTING_API_PROPERTIES, | ||
}; |
Oops, something went wrong.