-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add stats dto to collection item
Add deserialization for: - BggCollectionItemDto.conditiontext - BggCollectionItemDto.stats Github: Close #46
- Loading branch information
1 parent
49ecb06
commit a9643e8
Showing
10 changed files
with
3,125 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import { JsonAlias, JsonClassType, JsonDeserialize, JsonManagedReference, JsonProperty } from "jackson-js"; | ||
|
||
export class BggCollectionItemStatsDto { | ||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_minplayers"] }) | ||
minplayers: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_maxplayers"] }) | ||
maxplayers: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_minplaytime"] }) | ||
minplaytime: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_maxplaytime"] }) | ||
maxplaytime: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_playingtime"] }) | ||
playingtime: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_numowned"] }) | ||
numowned: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [BggCollectionItemStatRatingDto] }) | ||
@JsonManagedReference() | ||
@JsonDeserialize({ | ||
//eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
using: (items: any[]) => items[0] | ||
}) | ||
rating!: BggCollectionItemStatRatingDto; | ||
} | ||
|
||
export class BggCollectionItemStatRatingDto { | ||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_value"] }) | ||
value: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonDeserialize({ | ||
using: (value: []) => value.map(item => item['@_value'])[0] | ||
}) | ||
usersrated!: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonDeserialize({ | ||
using: (value: []) => value.map(item => item['@_value'])[0] | ||
}) | ||
average!: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonDeserialize({ | ||
using: (value: []) => value.map(item => item['@_value'])[0] | ||
}) | ||
bayesaverage!: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonDeserialize({ | ||
using: (value: []) => value.map(item => item['@_value'])[0] | ||
}) | ||
stddev!: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonDeserialize({ | ||
using: (value: []) => value.map(item => item['@_value'])[0] | ||
}) | ||
median!: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Array, [BggCollectionItemStatRatingRanksDto]] }) | ||
@JsonManagedReference() | ||
@JsonDeserialize({ | ||
//eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
using: (items: any[]) => items[0]?.rank | ||
}) | ||
ranks!: BggCollectionItemStatRatingRanksDto[]; | ||
} | ||
|
||
export class BggCollectionItemStatRatingRanksDto { | ||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_type"] }) | ||
type: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_id"] }) | ||
id: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_name"] }) | ||
name: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_friendlyname"] }) | ||
friendlyname: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_value"] }) | ||
value: number; | ||
|
||
@JsonProperty() | ||
@JsonClassType({ type: () => [Number] }) | ||
@JsonAlias({ values: ["@_bayesaverage"] }) | ||
bayesaverage: number; | ||
} |
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.