Refactor character affiliations to singular form
- Updated character data structure to replace 'affiliations' and 'frAffiliations' with 'affiliation' and 'frAffiliation'. - Modified related functions and components to accommodate the new structure. - Adjusted database schema and server-side logic to reflect the changes in character affiliation handling. - Ensured all references in the UI components and data import/export scripts are updated accordingly.
This commit is contained in:
@@ -34,7 +34,8 @@ async function applyCharacterChangeFromScrapeValidation(characterId: string): Pr
|
||||
frName: scraped.frName,
|
||||
gender: scraped.gender,
|
||||
age: scraped.age,
|
||||
affiliations: scraped.affiliations,
|
||||
affiliation: scraped.affiliation,
|
||||
frAffiliation: scraped.frAffiliation,
|
||||
devilFruitId: scraped.devilFruitId,
|
||||
hakiObservation: scraped.hakiObservation,
|
||||
hakiArmament: scraped.hakiArmament,
|
||||
@@ -59,7 +60,8 @@ async function applyCharacterChangeFromScrapeValidation(characterId: string): Pr
|
||||
frName: scraped.frName,
|
||||
gender: scraped.gender,
|
||||
age: scraped.age,
|
||||
affiliations: scraped.affiliations,
|
||||
affiliation: scraped.affiliation,
|
||||
frAffiliation: scraped.frAffiliation,
|
||||
devilFruitId: scraped.devilFruitId,
|
||||
hakiObservation: scraped.hakiObservation,
|
||||
hakiArmament: scraped.hakiArmament,
|
||||
@@ -129,7 +131,8 @@ export async function load() {
|
||||
'frName',
|
||||
'gender',
|
||||
'age',
|
||||
'affiliations',
|
||||
'affiliation',
|
||||
'frAffiliation',
|
||||
'devilFruitId',
|
||||
'hakiObservation',
|
||||
'hakiArmament',
|
||||
|
||||
@@ -26,7 +26,7 @@ export const load: PageServerLoad = async () => {
|
||||
name: character.name,
|
||||
gender: character.gender,
|
||||
age: character.age,
|
||||
affiliations: normalizeArray(character.affiliations),
|
||||
affiliation: character.affiliation,
|
||||
devilFruitId: character.devilFruitId,
|
||||
hakiObservation: character.hakiObservation,
|
||||
hakiArmament: character.hakiArmament,
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
bounty: 0,
|
||||
height: 0,
|
||||
origin: '',
|
||||
affiliations: '',
|
||||
affiliation: '',
|
||||
epithets: '',
|
||||
pictureUrl: '',
|
||||
url: '',
|
||||
@@ -101,7 +101,7 @@
|
||||
bounty: override.bounty ?? null,
|
||||
height: override.height ?? null,
|
||||
origin: override.origin ?? '',
|
||||
affiliations: override.affiliations ?? '',
|
||||
affiliation: override.affiliation ?? '',
|
||||
epithets: override.epithets ?? '',
|
||||
pictureUrl: override.pictureUrl ?? '',
|
||||
url: override.url ?? '',
|
||||
@@ -127,7 +127,7 @@
|
||||
bounty: 0,
|
||||
height: 0,
|
||||
origin: '',
|
||||
affiliations: '',
|
||||
affiliation: '',
|
||||
epithets: '',
|
||||
pictureUrl: '',
|
||||
url: '',
|
||||
@@ -341,12 +341,8 @@
|
||||
<td class="px-4 py-4 text-sm text-gray-400">{char.gender || '-'}</td>
|
||||
<!-- Affiliations -->
|
||||
<td class="px-4 py-4 text-sm text-gray-400">
|
||||
{#if char.affiliations}
|
||||
{#if Array.isArray(char.affiliations) && char.affiliations.length > 0}
|
||||
<span class="inline-block" title={char.affiliations.join(', ')}>{char.affiliations[0]}</span>
|
||||
{:else}
|
||||
{char.affiliations}
|
||||
{/if}
|
||||
{#if char.affiliation}
|
||||
{char.affiliation}
|
||||
{:else}
|
||||
-
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user