-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(game-options): lovers reveal each other role game option (#710)
Closes #702
- Loading branch information
1 parent
1bd783c
commit 7b284d9
Showing
26 changed files
with
8,706 additions
and
8,572 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
const { OFF } = require("../../constants"); | ||
const { OFF, ERROR } = require("../../constants"); | ||
|
||
const factoryFilesOverride = Object.freeze({ | ||
files: ["*.factory.ts"], | ||
rules: { "@typescript-eslint/no-magic-numbers": OFF }, | ||
rules: { | ||
"@typescript-eslint/no-magic-numbers": OFF, | ||
"import/max-dependencies": [ | ||
ERROR, { | ||
max: 30, | ||
ignoreTypeImports: true, | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
module.exports = { factoryFilesOverride }; |
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
20 changes: 20 additions & 0 deletions
20
...ions/create-roles-game-options/create-cupid-game-options/create-cupid-game-options.dto.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,20 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { Type } from "class-transformer"; | ||
import { IsOptional, ValidateNested } from "class-validator"; | ||
|
||
import { CreateCupidLoversGameOptionsDto } from "@/modules/game/dto/create-game/create-game-options/create-roles-game-options/create-cupid-game-options/create-cupid-lovers-game-options.dto"; | ||
import { CUPID_GAME_OPTIONS_API_PROPERTIES } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-game-options.schema.constant"; | ||
|
||
class CreateCupidGameOptionsDto { | ||
@ApiProperty({ | ||
...CUPID_GAME_OPTIONS_API_PROPERTIES.lovers, | ||
required: false, | ||
} as ApiPropertyOptions) | ||
@IsOptional() | ||
@Type(() => CreateCupidLoversGameOptionsDto) | ||
@ValidateNested() | ||
public lovers: CreateCupidLoversGameOptionsDto = new CreateCupidLoversGameOptionsDto(); | ||
} | ||
|
||
export { CreateCupidGameOptionsDto }; |
17 changes: 17 additions & 0 deletions
17
...eate-roles-game-options/create-cupid-game-options/create-cupid-lovers-game-options.dto.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,17 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { IsBoolean, IsOptional } from "class-validator"; | ||
|
||
import { CUPID_LOVERS_GAME_OPTIONS_API_PROPERTIES, CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-lovers-game-options/cupid-game-options.schema.constant"; | ||
|
||
class CreateCupidLoversGameOptionsDto { | ||
@ApiProperty({ | ||
...CUPID_LOVERS_GAME_OPTIONS_API_PROPERTIES.doRevealRoleToEachOther, | ||
required: false, | ||
} as ApiPropertyOptions) | ||
@IsOptional() | ||
@IsBoolean() | ||
public doRevealRoleToEachOther: boolean = CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS.doRevealRoleToEachOther.default; | ||
} | ||
|
||
export { CreateCupidLoversGameOptionsDto }; |
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
29 changes: 29 additions & 0 deletions
29
.../game-options/roles-game-options/cupid-game-options/cupid-game-options.schema.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,29 @@ | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
import type { ReadonlyDeep } from "type-fest"; | ||
|
||
import type { CupidGameOptions } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-game-options.schema"; | ||
import { CUPID_LOVERS_GAME_OPTIONS_SCHEMA } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-lovers-game-options/cupid-game-options.schema"; | ||
import { DEFAULT_GAME_OPTIONS } from "@/modules/game/constants/game-options/game-options.constant"; | ||
|
||
import { convertMongoosePropOptionsToApiPropertyOptions } from "@/shared/api/helpers/api.helper"; | ||
import type { MongoosePropOptions } from "@/shared/mongoose/types/mongoose.types"; | ||
|
||
const CUPID_GAME_OPTIONS_FIELDS_SPECS = { | ||
lovers: { | ||
required: true, | ||
type: CUPID_LOVERS_GAME_OPTIONS_SCHEMA, | ||
default: DEFAULT_GAME_OPTIONS.roles.cupid.lovers, | ||
}, | ||
} as const satisfies Record<keyof CupidGameOptions, MongoosePropOptions>; | ||
|
||
const CUPID_GAME_OPTIONS_API_PROPERTIES: ReadonlyDeep<Record<keyof CupidGameOptions, ApiPropertyOptions>> = { | ||
lovers: { | ||
description: "Game lovers from `cupid` role options.", | ||
...convertMongoosePropOptionsToApiPropertyOptions(CUPID_GAME_OPTIONS_FIELDS_SPECS.lovers), | ||
}, | ||
}; | ||
|
||
export { | ||
CUPID_GAME_OPTIONS_API_PROPERTIES, | ||
CUPID_GAME_OPTIONS_FIELDS_SPECS, | ||
}; |
27 changes: 27 additions & 0 deletions
27
...e/schemas/game-options/roles-game-options/cupid-game-options/cupid-game-options.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,27 @@ | ||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { Expose, Type } from "class-transformer"; | ||
|
||
import { CUPID_GAME_OPTIONS_API_PROPERTIES, CUPID_GAME_OPTIONS_FIELDS_SPECS } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-game-options.schema.constant"; | ||
import { CupidLoversGameOptions } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-lovers-game-options/cupid-game-options.schema"; | ||
|
||
@Schema({ | ||
versionKey: false, | ||
id: false, | ||
_id: false, | ||
}) | ||
class CupidGameOptions { | ||
@ApiProperty(CUPID_GAME_OPTIONS_API_PROPERTIES.lovers as ApiPropertyOptions) | ||
@Prop(CUPID_GAME_OPTIONS_FIELDS_SPECS.lovers) | ||
@Type(() => CupidLoversGameOptions) | ||
@Expose() | ||
public lovers: CupidLoversGameOptions; | ||
} | ||
|
||
const CUPID_GAME_OPTIONS_SCHEMA = SchemaFactory.createForClass(CupidGameOptions); | ||
|
||
export { | ||
CupidGameOptions, | ||
CUPID_GAME_OPTIONS_SCHEMA, | ||
}; |
27 changes: 27 additions & 0 deletions
27
...ptions/cupid-game-options/cupid-lovers-game-options/cupid-game-options.schema.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 type { ReadonlyDeep } from "type-fest"; | ||
|
||
import type { CupidLoversGameOptions } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-lovers-game-options/cupid-game-options.schema"; | ||
import { DEFAULT_GAME_OPTIONS } from "@/modules/game/constants/game-options/game-options.constant"; | ||
|
||
import { convertMongoosePropOptionsToApiPropertyOptions } from "@/shared/api/helpers/api.helper"; | ||
import type { MongoosePropOptions } from "@/shared/mongoose/types/mongoose.types"; | ||
|
||
const CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS = { | ||
doRevealRoleToEachOther: { | ||
required: true, | ||
default: DEFAULT_GAME_OPTIONS.roles.cupid.lovers.doRevealRoleToEachOther, | ||
}, | ||
} as const satisfies Record<keyof CupidLoversGameOptions, MongoosePropOptions>; | ||
|
||
const CUPID_LOVERS_GAME_OPTIONS_API_PROPERTIES: ReadonlyDeep<Record<keyof CupidLoversGameOptions, ApiPropertyOptions>> = { | ||
doRevealRoleToEachOther: { | ||
description: "If set to `true`, the lovers will know each other's role when they are meeting at the beginning of the game", | ||
...convertMongoosePropOptionsToApiPropertyOptions(CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS.doRevealRoleToEachOther), | ||
}, | ||
}; | ||
|
||
export { | ||
CUPID_LOVERS_GAME_OPTIONS_API_PROPERTIES, | ||
CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS, | ||
}; |
25 changes: 25 additions & 0 deletions
25
...es-game-options/cupid-game-options/cupid-lovers-game-options/cupid-game-options.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,25 @@ | ||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; | ||
import type { ApiPropertyOptions } from "@nestjs/swagger"; | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { Expose } from "class-transformer"; | ||
|
||
import { CUPID_LOVERS_GAME_OPTIONS_API_PROPERTIES, CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS } from "@/modules/game/schemas/game-options/roles-game-options/cupid-game-options/cupid-lovers-game-options/cupid-game-options.schema.constant"; | ||
|
||
@Schema({ | ||
versionKey: false, | ||
id: false, | ||
_id: false, | ||
}) | ||
class CupidLoversGameOptions { | ||
@ApiProperty(CUPID_LOVERS_GAME_OPTIONS_API_PROPERTIES.doRevealRoleToEachOther as ApiPropertyOptions) | ||
@Prop(CUPID_LOVERS_GAME_OPTIONS_FIELDS_SPECS.doRevealRoleToEachOther) | ||
@Expose() | ||
public doRevealRoleToEachOther: boolean; | ||
} | ||
|
||
const CUPID_LOVERS_GAME_OPTIONS_SCHEMA = SchemaFactory.createForClass(CupidLoversGameOptions); | ||
|
||
export { | ||
CupidLoversGameOptions, | ||
CUPID_LOVERS_GAME_OPTIONS_SCHEMA, | ||
}; |
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
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.