fix: Wrap admin subscriptions response to match frontend contract
All checks were successful
Test Asgard Runner / test (push) Successful in 3s

Frontend expects { subscriptions: [{ owner_email, module_name, license_id }] }
but backend returned raw WebstoreSubscription entities. Shaped the response
with license.owner join for owner_email and plan_id mapped to module_name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-02-16 00:25:05 -05:00
parent 0576cb33ea
commit a5e9d02a9a

View File

@@ -151,10 +151,18 @@ export class AdminService {
} }
async getSubscriptions() { async getSubscriptions() {
return this.webstoreSubRepo.find({ const subs = await this.webstoreSubRepo.find({
relations: ['license'], relations: ['license', 'license.owner'],
order: { created_at: 'DESC' }, order: { created_at: 'DESC' },
}); });
return {
subscriptions: subs.map(sub => ({
owner_email: sub.license?.owner?.email ?? 'Unknown',
module_name: sub.plan_id,
license_id: sub.license_id,
})),
};
} }
async getServers() { async getServers() {