-
-
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.
feat(game-play): handle sheriff election tie in votes (#314)
- Loading branch information
1 parent
460e242
commit 09c8606
Showing
13 changed files
with
27,968 additions
and
26,773 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
.../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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
import { GAME_HISTORY_RECORD_VOTING_RESULTS } from "../../../enums/game-history-record.enum"; | ||
import type { GameHistoryRecordPlayVoting } from "../../../schemas/game-history-record/game-history-record-play/game-history-record-play-voting.schema"; | ||
|
||
const gameHistoryRecordPlayVotingFieldsSpecs = Object.freeze<Record<keyof GameHistoryRecordPlayVoting, ApiPropertyOptions>>({ | ||
result: { | ||
required: true, | ||
enum: GAME_HISTORY_RECORD_VOTING_RESULTS, | ||
}, | ||
nominatedPlayers: { required: false }, | ||
}); | ||
|
||
const gameHistoryRecordPlayVotingApiProperties = Object.freeze<Record<keyof GameHistoryRecordPlayVoting, ApiPropertyOptions>>({ | ||
result: { | ||
description: "Define the results and their consequences", | ||
...gameHistoryRecordPlayVotingFieldsSpecs.result, | ||
}, | ||
nominatedPlayers: { | ||
description: "Nominated players from the play votes", | ||
...gameHistoryRecordPlayVotingFieldsSpecs.nominatedPlayers, | ||
}, | ||
}); | ||
|
||
export { | ||
gameHistoryRecordPlayVotingFieldsSpecs, | ||
gameHistoryRecordPlayVotingApiProperties, | ||
}; |
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
35 changes: 35 additions & 0 deletions
35
...as/game-history-record/game-history-record-play/game-history-record-play-voting.schema.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,35 @@ | ||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { Expose, Type } from "class-transformer"; | ||
import { gameHistoryRecordPlayVotingApiProperties, gameHistoryRecordPlayVotingFieldsSpecs } from "../../../constants/game-history-record/game-history-record-play/game-history-record-play-voting.constant"; | ||
import { GAME_HISTORY_RECORD_VOTING_RESULTS } from "../../../enums/game-history-record.enum"; | ||
import { Player, PlayerSchema } from "../../player/player.schema"; | ||
|
||
@Schema({ | ||
versionKey: false, | ||
id: false, | ||
_id: false, | ||
}) | ||
class GameHistoryRecordPlayVoting { | ||
@ApiProperty(gameHistoryRecordPlayVotingApiProperties.result) | ||
@Prop({ | ||
required: gameHistoryRecordPlayVotingFieldsSpecs.result.required, | ||
enum: gameHistoryRecordPlayVotingFieldsSpecs.result.enum, | ||
}) | ||
@Expose() | ||
public result: GAME_HISTORY_RECORD_VOTING_RESULTS; | ||
|
||
@ApiProperty(gameHistoryRecordPlayVotingApiProperties.nominatedPlayers) | ||
@Prop({ | ||
required: gameHistoryRecordPlayVotingFieldsSpecs.nominatedPlayers.required, | ||
type: [PlayerSchema], | ||
default: undefined, | ||
}) | ||
@Type(() => Player) | ||
@Expose() | ||
public nominatedPlayers?: Player[]; | ||
} | ||
|
||
const GameHistoryRecordPlayVotingSchema = SchemaFactory.createForClass(GameHistoryRecordPlayVoting); | ||
|
||
export { GameHistoryRecordPlayVoting, GameHistoryRecordPlayVotingSchema }; |
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
Oops, something went wrong.