core/billing-finance-core/src/modules/plans/plan.service.ts
2025-12-27 13:58:47 -03:00

24 lines
565 B
TypeScript

import { Injectable } from '@nestjs/common';
import { BillingCycle } from '../../core/enums';
import { PrismaService } from '../../lib/postgres';
interface CreatePlanInput {
name: string;
priceCents: number;
billingCycle: BillingCycle;
softLimit?: number;
hardLimit?: number;
}
@Injectable()
export class PlanService {
constructor(private readonly prisma: PrismaService) {}
create(data: CreatePlanInput) {
return this.prisma.plan.create({ data });
}
list() {
return this.prisma.plan.findMany({ orderBy: { createdAt: 'desc' } });
}
}