feat: getting subscription endpoint

This commit is contained in:
Ahmed Bouhuolia
2024-07-27 17:39:50 +02:00
parent db634cbb79
commit 7720b1cc34
5 changed files with 87 additions and 10 deletions

View File

@@ -1,8 +1,13 @@
import { Service } from 'typedi';
import { Inject, Service } from 'typedi';
import { PlanSubscription } from '@/system/models';
import { TransformerInjectable } from '@/lib/Transformer/TransformerInjectable';
import { GetSubscriptionsTransformer } from './GetSubscriptionsTransformer';
@Service()
export default class SubscriptionService {
@Inject()
private transformer: TransformerInjectable;
/**
* Retrieve all subscription of the given tenant.
* @param {number} tenantId
@@ -12,6 +17,10 @@ export default class SubscriptionService {
'tenant_id',
tenantId
);
return subscriptions;
return this.transformer.transform(
tenantId,
subscriptions,
new GetSubscriptionsTransformer()
);
}
}