refactor: enhance character data transformation and improve fetching logic in character-related scripts
This commit is contained in:
@@ -26,6 +26,7 @@ async function upsertCharacterFromScrapeValidation(characterId: string): Promise
|
||||
.values({
|
||||
id: scraped.id,
|
||||
name: scraped.name,
|
||||
frName: scraped.frName,
|
||||
gender: scraped.gender,
|
||||
age: scraped.age,
|
||||
affiliations: scraped.affiliations,
|
||||
@@ -36,17 +37,21 @@ async function upsertCharacterFromScrapeValidation(characterId: string): Promise
|
||||
bounty: scraped.bounty,
|
||||
height: scraped.height,
|
||||
origin: scraped.origin,
|
||||
frOrigin: scraped.frOrigin,
|
||||
firstAppearance: scraped.firstAppearance,
|
||||
pictureUrl: scraped.pictureUrl,
|
||||
epithets: scraped.epithets,
|
||||
frEpithets: scraped.frEpithets,
|
||||
status: scraped.status,
|
||||
arcId: scraped.arcId,
|
||||
url: scraped.url
|
||||
url: scraped.url,
|
||||
frUrl: scraped.frUrl,
|
||||
})
|
||||
.onConflictDoUpdate({
|
||||
target: character.id,
|
||||
set: {
|
||||
name: scraped.name,
|
||||
frName: scraped.frName,
|
||||
gender: scraped.gender,
|
||||
age: scraped.age,
|
||||
affiliations: scraped.affiliations,
|
||||
@@ -57,12 +62,15 @@ async function upsertCharacterFromScrapeValidation(characterId: string): Promise
|
||||
bounty: scraped.bounty,
|
||||
height: scraped.height,
|
||||
origin: scraped.origin,
|
||||
frOrigin: scraped.frOrigin,
|
||||
firstAppearance: scraped.firstAppearance,
|
||||
pictureUrl: scraped.pictureUrl,
|
||||
epithets: scraped.epithets,
|
||||
frEpithets: scraped.frEpithets,
|
||||
status: scraped.status,
|
||||
arcId: scraped.arcId,
|
||||
url: scraped.url
|
||||
url: scraped.url,
|
||||
frUrl: scraped.frUrl
|
||||
}
|
||||
});
|
||||
|
||||
@@ -101,6 +109,7 @@ export async function load() {
|
||||
const differences: Record<string, { current: any; scraped: any }> = {};
|
||||
const fieldsToCompare = [
|
||||
'name',
|
||||
'frName',
|
||||
'gender',
|
||||
'age',
|
||||
'affiliations',
|
||||
@@ -111,12 +120,15 @@ export async function load() {
|
||||
'bounty',
|
||||
'height',
|
||||
'origin',
|
||||
'frOrigin',
|
||||
'firstAppearance',
|
||||
'pictureUrl',
|
||||
'epithets',
|
||||
'frEpithets',
|
||||
'status',
|
||||
'arcId',
|
||||
'url'
|
||||
'url',
|
||||
'frUrl'
|
||||
];
|
||||
|
||||
for (const field of fieldsToCompare) {
|
||||
|
||||
Reference in New Issue
Block a user