feat: Auto-fix cost_credits <= 0 to 3 on every furniture import
- Extended fixDatabaseConsistencyAfterImport() to also set cost_credits = 3 where <= 0 - Integrated into both single and batch import routes - API responses now include costCreditsFixed count Ensures 100% of catalog_items have cost_credits > 0 after import - Typecheck, lint, tests all pass - Pushed to GitLab
This commit is contained in:
1 parent
86f3d82c5d
commit
0b0cf4f37f
3 files changed
+30
-14
No files matched your search
@@ -266,8 +266,9 @@ export const POST = withAdmin(
|
||||
);
|
||||
}
|
||||
|
||||
// Fix database consistency (catalog_name + have_offer) after import
|
||||
const dbFix = await fixDatabaseConsistencyAfterImport();
|
||||
// Fix database consistency (catalog_name + have_offer + cost_credits) after import
|
||||
const { catalogNameFixed, haveOfferFixed, costCreditsFixed } =
|
||||
await fixDatabaseConsistencyAfterImport();
|
||||
|
||||
send({
|
||||
type: "batch_complete",
|
||||
@@ -285,8 +286,9 @@ export const POST = withAdmin(
|
||||
offerRebuildFixed,
|
||||
spriteFixed,
|
||||
interactionFixed,
|
||||
catalogNameFixed: dbFix.catalogNameFixed,
|
||||
haveOfferFixed: dbFix.haveOfferFixed,
|
||||
catalogNameFixed,
|
||||
haveOfferFixed,
|
||||
costCreditsFixed,
|
||||
languages,
|
||||
duration: Date.now() - startTime,
|
||||
});
|
||||
|
||||
@@ -481,8 +481,9 @@ export const POST = withAdmin(
|
||||
// Verify + fix interaction_modes_count once for the whole batch
|
||||
const verification = await verifyAndFixInteractionModesCount();
|
||||
|
||||
// Fix database consistency (catalog_name + have_offer) after import
|
||||
const dbFix = await fixDatabaseConsistencyAfterImport();
|
||||
// Fix database consistency (catalog_name + have_offer + cost_credits) after import
|
||||
const { catalogNameFixed, haveOfferFixed, costCreditsFixed } =
|
||||
await fixDatabaseConsistencyAfterImport();
|
||||
|
||||
// Rebuild all localized furnidata files (best effort)
|
||||
let languages: Awaited<ReturnType<typeof buildLocalizedFurniDataFiles>> =
|
||||
@@ -517,8 +518,9 @@ export const POST = withAdmin(
|
||||
spriteChecked: spriteVerify.checked,
|
||||
spriteFixed: spriteVerify.fixed,
|
||||
interactionFixed: verification.fixed,
|
||||
catalogNameFixed: dbFix.catalogNameFixed,
|
||||
haveOfferFixed: dbFix.haveOfferFixed,
|
||||
catalogNameFixed,
|
||||
haveOfferFixed,
|
||||
costCreditsFixed,
|
||||
languages,
|
||||
});
|
||||
}
|
||||
@@ -581,8 +583,9 @@ export const POST = withAdmin(
|
||||
// Verify the furnidata matches the DB ids
|
||||
const furniReconcile = await reconcileFurniDataWithItemsBase();
|
||||
|
||||
// Fix database consistency (catalog_name + have_offer) after import
|
||||
const dbFix = await fixDatabaseConsistencyAfterImport();
|
||||
// Fix database consistency (catalog_name + have_offer + cost_credits) after import
|
||||
const { catalogNameFixed, haveOfferFixed, costCreditsFixed } =
|
||||
await fixDatabaseConsistencyAfterImport();
|
||||
|
||||
// Rebuild every catalog offer_id from the furnidata
|
||||
const offerRebuild = await rebuildCatalogOfferIds();
|
||||
@@ -641,8 +644,9 @@ export const POST = withAdmin(
|
||||
spriteChecked: spriteVerify.checked,
|
||||
spriteFixed: spriteVerify.fixed,
|
||||
interactionFixed: verification.fixed,
|
||||
catalogNameFixed: dbFix.catalogNameFixed,
|
||||
haveOfferFixed: dbFix.haveOfferFixed,
|
||||
catalogNameFixed,
|
||||
haveOfferFixed,
|
||||
costCreditsFixed,
|
||||
languages: languagesPatch,
|
||||
spriteCount: result.spriteCount,
|
||||
warnings: result.warnings,
|
||||
|
||||
Reference in new issue
Block a user