2022-10-30 02:03:54 +00:00
|
|
|
import type { GameType, SavedGameType } from '$lib/types';
|
|
|
|
|
|
|
|
|
|
export function mapSavedGameToGame(game: SavedGameType): GameType {
|
2022-11-02 03:10:02 +00:00
|
|
|
const { id, name, thumb_url, min_players, max_players, playtime } = game;
|
2022-10-30 02:03:54 +00:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
id,
|
|
|
|
|
name,
|
2022-11-02 03:10:02 +00:00
|
|
|
thumb_url,
|
|
|
|
|
min_players,
|
|
|
|
|
max_players,
|
|
|
|
|
playtime
|
2022-10-30 02:03:54 +00:00
|
|
|
};
|
|
|
|
|
}
|
2022-07-27 22:05:22 +00:00
|
|
|
|
|
|
|
|
export function mapAPIGameToBoredGame(game): GameType {
|
|
|
|
|
const {
|
|
|
|
|
id,
|
|
|
|
|
handle,
|
|
|
|
|
name,
|
|
|
|
|
url,
|
|
|
|
|
edit_url,
|
|
|
|
|
thumb_url,
|
|
|
|
|
image_url,
|
|
|
|
|
price,
|
|
|
|
|
price_ca,
|
|
|
|
|
price_uk,
|
|
|
|
|
price_au,
|
|
|
|
|
msrp,
|
|
|
|
|
year_published,
|
|
|
|
|
min_players,
|
|
|
|
|
max_players,
|
|
|
|
|
min_playtime,
|
|
|
|
|
max_playtime,
|
|
|
|
|
min_age,
|
|
|
|
|
description,
|
|
|
|
|
description_preview,
|
|
|
|
|
players,
|
2022-07-28 00:05:54 +00:00
|
|
|
playtime
|
2022-07-27 22:05:22 +00:00
|
|
|
} = game;
|
|
|
|
|
return {
|
|
|
|
|
id,
|
|
|
|
|
handle,
|
|
|
|
|
name,
|
|
|
|
|
url,
|
|
|
|
|
edit_url,
|
|
|
|
|
thumb_url,
|
|
|
|
|
image_url,
|
|
|
|
|
price,
|
|
|
|
|
price_ca,
|
|
|
|
|
price_uk,
|
|
|
|
|
price_au,
|
|
|
|
|
msrp,
|
|
|
|
|
year_published,
|
|
|
|
|
min_players,
|
|
|
|
|
max_players,
|
|
|
|
|
min_playtime,
|
|
|
|
|
max_playtime,
|
|
|
|
|
min_age,
|
|
|
|
|
description,
|
|
|
|
|
description_preview,
|
|
|
|
|
players,
|
2022-07-28 00:05:54 +00:00
|
|
|
playtime
|
2022-07-27 22:05:22 +00:00
|
|
|
};
|
2022-07-28 00:05:54 +00:00
|
|
|
}
|