starshard/peafowl
Template
1
Fork 0
mirror of https://github.com/starshardstudio/peafowl.git synced 2024-11-25 06:24:20 +00:00

Fix CMS not understanding identifier kinds

This commit is contained in:
Steffo 2024-07-04 06:10:54 +02:00
parent bc006a7366
commit 110c7abec9
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
4 changed files with 7 additions and 13 deletions

View file

@ -184,14 +184,8 @@ cms.collection(
name: "steam", name: "steam",
type: "object", type: "object",
label: "Steam", label: "Steam",
description: "", description: "The game, as it is available on Steam.",
fields: [ fields: [
{
name: "platform",
type: "hidden",
label: "Platform",
value: "steam",
},
{ {
name: "appid", name: "appid",
type: "text", type: "text",

View file

@ -119,7 +119,7 @@ export default function(data: GameData, helpers: Lume.Helpers) {
const milestonesSeparator = ((data.identifiers?.length ?? 0) > 0) ? <hr/> : null const milestonesSeparator = ((data.identifiers?.length ?? 0) > 0) ? <hr/> : null
const identifiersRows = data.identifiers?.map((identifier: GameIdentifier, index: number) => { const identifiersRows = data.identifiers?.map((identifier: GameIdentifier, index: number) => {
switch(identifier.platform) { switch(identifier.type) {
case "steam": case "steam":
return ( return (
<ReviewInfo.MetadataRow <ReviewInfo.MetadataRow

View file

@ -39,7 +39,7 @@ const filenameToAppId: {[filename: string]: string | null} = {}
for(const _page of site.search.pages("game")) { for(const _page of site.search.pages("game")) {
const page = _page as GameData const page = _page as GameData
const file: string = page.sourcePath const file: string = page.sourcePath
const identifiers: GameIdentifier[] = page.data.identifiers.filter((i: GameIdentifier) => i.platform === "steam") const identifiers: GameIdentifier[] = page.data.identifiers.filter((i: GameIdentifier) => i.type === "steam")
let nullify: boolean = false let nullify: boolean = false
for(const identifier of identifiers) { for(const identifier of identifiers) {
@ -103,9 +103,9 @@ for(const game of games) {
completed_on: page?.completed_on, completed_on: page?.completed_on,
mastered_on: page?.mastered_on, mastered_on: page?.mastered_on,
identifiers: [ identifiers: [
...(page?.identifiers?.filter(i => i.platform !== "steam") ?? []), ...(page?.identifiers?.filter(i => i.type !== "steam") ?? []),
{ {
platform: "steam", type: "steam",
appid: appId, appid: appId,
name: game.name, name: game.name,
synced_on: formatDateIso(new Date()) synced_on: formatDateIso(new Date())

View file

@ -3,12 +3,12 @@ import {ReviewData} from "./review.ts"
export interface GameBaseIdentifier { export interface GameBaseIdentifier {
platform: string, type: string,
synced_on?: string, synced_on?: string,
} }
export interface GameSteamIdentifier extends GameBaseIdentifier { export interface GameSteamIdentifier extends GameBaseIdentifier {
platform: "steam", type: "steam",
appid: string, appid: string,
name?: string, name?: string,
} }