refactor: remove retired data format support
This commit is contained in:
@@ -6,7 +6,7 @@ import { getSessionUser } from '$lib/server/auth/session';
|
||||
import { getDatabase } from '$lib/server/database';
|
||||
import { recordIsacAudit } from '$lib/server/audit';
|
||||
import { getPagination, getRegistrySearch } from '$lib/server/pagination';
|
||||
import { migrateLoadoutDraft } from '$lib/builder/loadout';
|
||||
import { parseLoadoutDraft } from '$lib/builder/loadout';
|
||||
|
||||
const operators = new Set([
|
||||
'base_damage', 'flat_add', 'additive_percent', 'multiplicative_percent',
|
||||
@@ -250,8 +250,8 @@ export const actions: Actions = {
|
||||
const snapshotText = String(form.get('loadoutSnapshot') ?? '').trim();
|
||||
let snapshot: unknown;
|
||||
try { snapshot = JSON.parse(snapshotText); } catch { return fail(400, { calibrationError: 'The loadout snapshot is not valid JSON.' }); }
|
||||
const migrated = migrateLoadoutDraft(snapshot);
|
||||
if (!migrated) return fail(400, { calibrationError: 'The loadout snapshot is not a recognized SHD.build loadout.' });
|
||||
const parsedLoadout = parseLoadoutDraft(snapshot);
|
||||
if (!parsedLoadout) return fail(400, { calibrationError: 'The loadout snapshot does not match the current SHD.build loadout format.' });
|
||||
const observed = {
|
||||
bodyHit: optionalNumber(form.get('bodyHit')),
|
||||
criticalBodyHit: optionalNumber(form.get('criticalBodyHit')),
|
||||
@@ -279,7 +279,7 @@ export const actions: Actions = {
|
||||
if (id && !before) return fail(404, { calibrationError: 'That calibration case no longer exists.' });
|
||||
const now = new Date().toISOString();
|
||||
const values = [
|
||||
name, status, JSON.stringify(migrated), Number(form.get('selectedWeapon') ?? 0),
|
||||
name, status, JSON.stringify(parsedLoadout), Number(form.get('selectedWeapon') ?? 0),
|
||||
clean(form.get('gameVersion')) || null, clean(form.get('observedAt')) || null,
|
||||
clean(form.get('notes')).slice(0, 4000) || null,
|
||||
observed.bodyHit, observed.criticalBodyHit, observed.headshot, observed.criticalHeadshot,
|
||||
|
||||
Reference in New Issue
Block a user