Preserve null remaining_events in package normalization
This commit is contained in:
@@ -1011,7 +1011,7 @@ function normalizeDashboard(payload: JsonValue | null): DashboardSummary | null
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeTenantPackage(pkg: JsonValue): TenantPackageSummary {
|
||||
export function normalizeTenantPackage(pkg: JsonValue): TenantPackageSummary {
|
||||
const packageData = pkg.package ?? {};
|
||||
return {
|
||||
id: Number(pkg.id ?? 0),
|
||||
@@ -1031,7 +1031,8 @@ function normalizeTenantPackage(pkg: JsonValue): TenantPackageSummary {
|
||||
: null,
|
||||
active: Boolean(pkg.active ?? false),
|
||||
used_events: Number(pkg.used_events ?? 0),
|
||||
remaining_events: pkg.remaining_events !== undefined ? Number(pkg.remaining_events) : null,
|
||||
remaining_events:
|
||||
pkg.remaining_events === undefined || pkg.remaining_events === null ? null : Number(pkg.remaining_events),
|
||||
price: packageData.price !== undefined ? Number(packageData.price) : pkg.price ?? null,
|
||||
currency: packageData.currency ?? pkg.currency ?? 'EUR',
|
||||
purchased_at: pkg.purchased_at ?? pkg.created_at ?? null,
|
||||
|
||||
Reference in New Issue
Block a user