mirror of
https://github.com/Pandipipas/scoreko-dev.git
synced 2026-06-06 03:32:06 +00:00
Remove legacy realName fallback from player normalization (#31)
This commit is contained in:
+8
-23
@@ -9,7 +9,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
"team": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
@@ -17,36 +17,21 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
|
"team": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
"twitter": {
|
"twitter": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
|
||||||
"realName": {
|
|
||||||
"type": "string",
|
|
||||||
"default": ""
|
|
||||||
},
|
|
||||||
"pronouns": {
|
|
||||||
"type": "string",
|
|
||||||
"default": ""
|
|
||||||
},
|
|
||||||
"twitch": {
|
|
||||||
"type": "string",
|
|
||||||
"default": ""
|
|
||||||
},
|
|
||||||
"notes": {
|
|
||||||
"type": "string",
|
|
||||||
"default": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"gamertag",
|
"gamertag",
|
||||||
"team",
|
"name",
|
||||||
"country",
|
"country",
|
||||||
"twitter",
|
"team",
|
||||||
"realName",
|
"twitter"
|
||||||
"pronouns",
|
|
||||||
"twitch",
|
|
||||||
"notes"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": {}
|
"default": {}
|
||||||
|
|||||||
@@ -12,13 +12,10 @@ const normalizePlayer = (input: unknown): Player => {
|
|||||||
const candidate = typeof input === 'object' && input !== null ? (input as Record<string, unknown>) : {};
|
const candidate = typeof input === 'object' && input !== null ? (input as Record<string, unknown>) : {};
|
||||||
return {
|
return {
|
||||||
gamertag: typeof candidate.gamertag === 'string' ? candidate.gamertag : '',
|
gamertag: typeof candidate.gamertag === 'string' ? candidate.gamertag : '',
|
||||||
|
name: typeof candidate.name === 'string' ? candidate.name : '',
|
||||||
team: typeof candidate.team === 'string' ? candidate.team : '',
|
team: typeof candidate.team === 'string' ? candidate.team : '',
|
||||||
country: typeof candidate.country === 'string' ? candidate.country : '',
|
country: typeof candidate.country === 'string' ? candidate.country : '',
|
||||||
twitter: typeof candidate.twitter === 'string' ? candidate.twitter : '',
|
twitter: typeof candidate.twitter === 'string' ? candidate.twitter : '',
|
||||||
realName: typeof candidate.realName === 'string' ? candidate.realName : '',
|
|
||||||
pronouns: typeof candidate.pronouns === 'string' ? candidate.pronouns : '',
|
|
||||||
twitch: typeof candidate.twitch === 'string' ? candidate.twitch : '',
|
|
||||||
notes: typeof candidate.notes === 'string' ? candidate.notes : '',
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -25,13 +25,10 @@ const fileInput = ref<HTMLInputElement | null>(null);
|
|||||||
|
|
||||||
const emptyPlayer: Player = {
|
const emptyPlayer: Player = {
|
||||||
gamertag: '',
|
gamertag: '',
|
||||||
team: '',
|
name: '',
|
||||||
country: '',
|
country: '',
|
||||||
|
team: '',
|
||||||
twitter: '',
|
twitter: '',
|
||||||
realName: '',
|
|
||||||
pronouns: '',
|
|
||||||
twitch: '',
|
|
||||||
notes: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const form = reactive<Player>({ ...emptyPlayer });
|
const form = reactive<Player>({ ...emptyPlayer });
|
||||||
@@ -88,7 +85,8 @@ const openCreateDialog = () => {
|
|||||||
|
|
||||||
const openEditDialog = (row: PlayerRow) => {
|
const openEditDialog = (row: PlayerRow) => {
|
||||||
editingId.value = row.id;
|
editingId.value = row.id;
|
||||||
const { id: _id, ...playerData } = row;
|
const { id, ...playerData } = row;
|
||||||
|
void id;
|
||||||
Object.assign(form, playerData);
|
Object.assign(form, playerData);
|
||||||
isDialogOpen.value = true;
|
isDialogOpen.value = true;
|
||||||
};
|
};
|
||||||
@@ -132,7 +130,7 @@ const handleImport = async (event: Event) => {
|
|||||||
const text = await file.text();
|
const text = await file.text();
|
||||||
const parsed = JSON.parse(text) as unknown;
|
const parsed = JSON.parse(text) as unknown;
|
||||||
playersStore.setPlayers(parsed as PlayersMap);
|
playersStore.setPlayers(parsed as PlayersMap);
|
||||||
} catch (error) {
|
} catch {
|
||||||
window.alert('No se pudo importar el JSON. Verifica el formato.');
|
window.alert('No se pudo importar el JSON. Verifica el formato.');
|
||||||
} finally {
|
} finally {
|
||||||
if (target) {
|
if (target) {
|
||||||
@@ -242,8 +240,8 @@ const handleImport = async (event: Event) => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<QInput
|
<QInput
|
||||||
v-model="form.team"
|
v-model="form.name"
|
||||||
label="Team"
|
label="Name"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
/>
|
/>
|
||||||
@@ -268,6 +266,14 @@ const handleImport = async (event: Event) => {
|
|||||||
outlined
|
outlined
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
<QInput
|
||||||
|
v-model="form.team"
|
||||||
|
label="Team"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<QInput
|
<QInput
|
||||||
v-model="form.twitter"
|
v-model="form.twitter"
|
||||||
@@ -276,40 +282,6 @@ const handleImport = async (event: Event) => {
|
|||||||
outlined
|
outlined
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
|
||||||
<QInput
|
|
||||||
v-model="form.realName"
|
|
||||||
label="Nombre real"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md-6">
|
|
||||||
<QInput
|
|
||||||
v-model="form.pronouns"
|
|
||||||
label="Pronombres"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md-6">
|
|
||||||
<QInput
|
|
||||||
v-model="form.twitch"
|
|
||||||
label="Twitch"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
<QInput
|
|
||||||
v-model="form.notes"
|
|
||||||
type="textarea"
|
|
||||||
label="Notas"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
autogrow
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</QForm>
|
</QForm>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
|||||||
Vendored
+2
-5
@@ -9,12 +9,9 @@
|
|||||||
export interface Players {
|
export interface Players {
|
||||||
[k: string]: {
|
[k: string]: {
|
||||||
gamertag: string;
|
gamertag: string;
|
||||||
team: string;
|
name: string;
|
||||||
country: string;
|
country: string;
|
||||||
|
team: string;
|
||||||
twitter: string;
|
twitter: string;
|
||||||
realName: string;
|
|
||||||
pronouns: string;
|
|
||||||
twitch: string;
|
|
||||||
notes: string;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user