Files
bigcapital/packages/server/src/system/repositories/SubscriptionRepository.ts
2024-08-25 12:42:42 +02:00

23 lines
606 B
TypeScript

import SystemRepository from '@/system/repositories/SystemRepository';
import { PlanSubscription } from '@/system/models';
export default class SubscriptionRepository extends SystemRepository {
/**
* Gets the repository's model.
*/
get model() {
return PlanSubscription.bindKnex(this.knex);
}
/**
* Retrieve subscription from a given slug in specific tenant.
* @param {string} slug
* @param {number} tenantId
*/
getBySlugInTenant(slug: string, tenantId: number) {
return PlanSubscription.query()
.findOne('slug', slug)
.where('tenant_id', tenantId);
}
}