feat(plans): 📋 added subscription plans (Starter/Pro/Enterprise)

This commit is contained in:
Tiago Yamamoto 2025-12-15 09:44:20 -03:00
parent 7132b0cb67
commit 38acc0e670
4 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,3 @@
export * from './plans.module';
export * from './plans.service';
export * from './plans.controller';

View file

@ -0,0 +1,15 @@
import { Controller, Get, Param } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { PlansService } from './plans.service';
@ApiTags('Plans')
@Controller('plans')
export class PlansController {
constructor(private readonly plansService: PlansService) { }
@Get() @ApiOperation({ summary: 'Get all plans' })
getAllPlans() { return this.plansService.getAllPlans(); }
@Get(':id') @ApiOperation({ summary: 'Get plan by ID' })
getPlanById(@Param('id') id: string) { return this.plansService.getPlanById(id); }
}

View file

@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { PlansService } from './plans.service';
import { PlansController } from './plans.controller';
@Module({
providers: [PlansService],
controllers: [PlansController],
exports: [PlansService],
})
export class PlansModule { }

View file

@ -0,0 +1,35 @@
import { Injectable } from '@nestjs/common';
export interface Plan {
id: string;
name: string;
description: string;
monthlyPrice: number;
yearlyPrice: number;
features: string[];
popular?: boolean;
}
@Injectable()
export class PlansService {
private readonly plans: Plan[] = [
{
id: 'starter', name: 'Starter', description: 'For small companies',
monthlyPrice: 99, yearlyPrice: 990,
features: ['5 job postings', 'Basic analytics', 'Email support'],
},
{
id: 'professional', name: 'Professional', description: 'For growing companies',
monthlyPrice: 299, yearlyPrice: 2990, popular: true,
features: ['25 job postings', 'Advanced analytics', 'Priority support', 'Featured listings'],
},
{
id: 'enterprise', name: 'Enterprise', description: 'For large organizations',
monthlyPrice: 799, yearlyPrice: 7990,
features: ['Unlimited postings', 'Custom analytics', 'Dedicated support', 'API access'],
},
];
getAllPlans(): Plan[] { return this.plans; }
getPlanById(id: string): Plan | undefined { return this.plans.find(p => p.id === id); }
}