mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat: retrieve organization subscriptions list api.
feat: subscriptions reducers.
This commit is contained in:
@@ -100,7 +100,7 @@ export default class OrganizationService {
|
||||
this.logger.info('[organization] trying to list all organizations.', { user });
|
||||
|
||||
const { tenantRepository } = this.sysRepositories;
|
||||
const tenant = await tenantRepository.getByIdWithSubscriptions(user.tenantId);
|
||||
const tenant = await tenantRepository.getById(user.tenantId);
|
||||
|
||||
return [tenant];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { Plan, Tenant } from 'system/models';
|
||||
import { Plan, PlanSubscription } from 'system/models';
|
||||
import Subscription from 'services/Subscription/Subscription';
|
||||
import LicensePaymentMethod from 'services/Payment/LicensePaymentMethod';
|
||||
import PaymentContext from 'services/Payment';
|
||||
@@ -29,7 +29,7 @@ export default class SubscriptionService {
|
||||
* @param {string} licenseCode
|
||||
* @return {Promise}
|
||||
*/
|
||||
async subscriptionViaLicense(
|
||||
public async subscriptionViaLicense(
|
||||
tenantId: number,
|
||||
planSlug: string,
|
||||
paymentModel?: ILicensePaymentModel,
|
||||
@@ -53,4 +53,15 @@ export default class SubscriptionService {
|
||||
tenantId, paymentModel
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all subscription of the given tenant.
|
||||
* @param {number} tenantId
|
||||
*/
|
||||
public async getSubscriptions(tenantId: number) {
|
||||
this.logger.info('[subscription] trying to get tenant subscriptions.', { tenantId });
|
||||
const subscriptions = await PlanSubscription.query().where('tenant_id', tenantId);
|
||||
|
||||
return subscriptions;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user