changed portrait shape
This commit is contained in:
@@ -2992,6 +2992,12 @@ app.get('/api/admin/summary', requireAuth, requireSessionAuth, requireAdmin, asy
|
||||
rescueBirds: Number(summary?.rescue_birds ?? 0),
|
||||
pendingRescues: Number(summary?.pending_rescues ?? 0),
|
||||
dailyUsers: Number(summary?.daily_users ?? 0),
|
||||
subscriptionsByPlan: {
|
||||
household_basic: Number(summary?.household_basic_subscriptions ?? 0),
|
||||
household_plus: Number(summary?.household_plus_subscriptions ?? 0),
|
||||
household_macaw: Number(summary?.household_macaw_subscriptions ?? 0),
|
||||
household_hyacinth_macaw: Number(summary?.household_hyacinth_macaw_subscriptions ?? 0),
|
||||
},
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -531,6 +531,10 @@ test('getPlatformAdminSummary counts memorialized birds separately', async () =>
|
||||
rescue_birds: 5,
|
||||
pending_rescues: 1,
|
||||
daily_users: 2,
|
||||
household_basic_subscriptions: 2,
|
||||
household_plus_subscriptions: 1,
|
||||
household_macaw_subscriptions: 0,
|
||||
household_hyacinth_macaw_subscriptions: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -543,4 +547,7 @@ test('getPlatformAdminSummary counts memorialized birds separately', async () =>
|
||||
assert.match(calls[0].text, /memorialized_at IS NOT NULL/);
|
||||
assert.match(calls[0].text, /rescue_birds/);
|
||||
assert.match(calls[0].text, /workspaces\.workspace_type = 'rescue'/);
|
||||
assert.equal(summary?.household_basic_subscriptions, 2);
|
||||
assert.match(calls[0].text, /billing_plan = 'household_basic'/);
|
||||
assert.match(calls[0].text, /subscription_status IN \('active', 'trialing'\)/);
|
||||
});
|
||||
|
||||
@@ -605,6 +605,10 @@ export const getPlatformAdminSummary = async () => {
|
||||
rescue_birds: number;
|
||||
pending_rescues: number;
|
||||
daily_users: number;
|
||||
household_basic_subscriptions: number;
|
||||
household_plus_subscriptions: number;
|
||||
household_macaw_subscriptions: number;
|
||||
household_hyacinth_macaw_subscriptions: number;
|
||||
}>(
|
||||
`SELECT
|
||||
(SELECT COUNT(*)::int FROM birds) AS total_birds,
|
||||
@@ -614,7 +618,11 @@ export const getPlatformAdminSummary = async () => {
|
||||
(SELECT COUNT(*)::int FROM workspaces WHERE workspace_type = 'rescue') AS rescue_workspaces,
|
||||
(SELECT COUNT(*)::int FROM birds INNER JOIN workspaces ON workspaces.id = birds.workspace_id WHERE workspaces.workspace_type = 'rescue') AS rescue_birds,
|
||||
(SELECT COUNT(*)::int FROM workspaces WHERE workspace_type = 'rescue' AND rescue_verification_status = 'pending') AS pending_rescues,
|
||||
(SELECT COUNT(DISTINCT user_id)::int FROM auth_sessions WHERE created_at >= CURRENT_DATE) AS daily_users`,
|
||||
(SELECT COUNT(DISTINCT user_id)::int FROM auth_sessions WHERE created_at >= CURRENT_DATE) AS daily_users,
|
||||
(SELECT COUNT(*)::int FROM workspaces WHERE billing_plan = 'household_basic' AND subscription_status IN ('active', 'trialing')) AS household_basic_subscriptions,
|
||||
(SELECT COUNT(*)::int FROM workspaces WHERE billing_plan = 'household_plus' AND subscription_status IN ('active', 'trialing')) AS household_plus_subscriptions,
|
||||
(SELECT COUNT(*)::int FROM workspaces WHERE billing_plan = 'household_macaw' AND subscription_status IN ('active', 'trialing')) AS household_macaw_subscriptions,
|
||||
(SELECT COUNT(*)::int FROM workspaces WHERE billing_plan = 'household_hyacinth_macaw' AND subscription_status IN ('active', 'trialing')) AS household_hyacinth_macaw_subscriptions`,
|
||||
);
|
||||
|
||||
return result.rows[0];
|
||||
|
||||
Reference in New Issue
Block a user