diff --git a/backoffice/src/plans/index.ts b/backoffice/src/plans/index.ts new file mode 100644 index 0000000..83d7c7f --- /dev/null +++ b/backoffice/src/plans/index.ts @@ -0,0 +1,3 @@ +export * from './plans.module'; +export * from './plans.service'; +export * from './plans.controller'; diff --git a/backoffice/src/plans/plans.controller.ts b/backoffice/src/plans/plans.controller.ts new file mode 100644 index 0000000..539f778 --- /dev/null +++ b/backoffice/src/plans/plans.controller.ts @@ -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); } +} diff --git a/backoffice/src/plans/plans.module.ts b/backoffice/src/plans/plans.module.ts new file mode 100644 index 0000000..9e73db7 --- /dev/null +++ b/backoffice/src/plans/plans.module.ts @@ -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 { } diff --git a/backoffice/src/plans/plans.service.ts b/backoffice/src/plans/plans.service.ts new file mode 100644 index 0000000..486f5d0 --- /dev/null +++ b/backoffice/src/plans/plans.service.ts @@ -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); } +}