chore: formatting updates and lockfile changes

This commit is contained in:
Tiago Yamamoto 2025-12-15 10:40:55 -03:00
parent 5c45557537
commit 3be9807d88
8 changed files with 4851 additions and 89 deletions

View file

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

View file

@ -14,22 +14,46 @@ export interface Plan {
export class PlansService { export class PlansService {
private readonly plans: Plan[] = [ private readonly plans: Plan[] = [
{ {
id: 'starter', name: 'Starter', description: 'For small companies', id: 'starter',
monthlyPrice: 99, yearlyPrice: 990, name: 'Starter',
description: 'For small companies',
monthlyPrice: 99,
yearlyPrice: 990,
features: ['5 job postings', 'Basic analytics', 'Email support'], features: ['5 job postings', 'Basic analytics', 'Email support'],
}, },
{ {
id: 'professional', name: 'Professional', description: 'For growing companies', id: 'professional',
monthlyPrice: 299, yearlyPrice: 2990, popular: true, name: 'Professional',
features: ['25 job postings', 'Advanced analytics', 'Priority support', 'Featured listings'], 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', id: 'enterprise',
monthlyPrice: 799, yearlyPrice: 7990, name: 'Enterprise',
features: ['Unlimited postings', 'Custom analytics', 'Dedicated support', 'API access'], description: 'For large organizations',
monthlyPrice: 799,
yearlyPrice: 7990,
features: [
'Unlimited postings',
'Custom analytics',
'Dedicated support',
'API access',
],
}, },
]; ];
getAllPlans(): Plan[] { return this.plans; } getAllPlans(): Plan[] {
getPlanById(id: string): Plan | undefined { return this.plans.find(p => p.id === id); } return this.plans;
}
getPlanById(id: string): Plan | undefined {
return this.plans.find((p) => p.id === id);
}
} }

View file

@ -14,10 +14,14 @@ export class StripeService implements OnModuleInit {
console.warn('STRIPE_SECRET_KEY not configured'); console.warn('STRIPE_SECRET_KEY not configured');
return; return;
} }
this.stripe = new Stripe(secretKey, { apiVersion: '2025-11-17.clover' as const }); this.stripe = new Stripe(secretKey, {
apiVersion: '2025-11-17.clover' as const,
});
} }
getClient(): Stripe { return this.stripe; } getClient(): Stripe {
return this.stripe;
}
async createCustomer(email: string, name: string) { async createCustomer(email: string, name: string) {
return this.stripe.customers.create({ email, name }); return this.stripe.customers.create({ email, name });
@ -37,10 +41,18 @@ export class StripeService implements OnModuleInit {
} }
async listSubscriptions(customerId: string) { async listSubscriptions(customerId: string) {
return this.stripe.subscriptions.list({ customer: customerId, status: 'all' }); return this.stripe.subscriptions.list({
customer: customerId,
status: 'all',
});
} }
async createCheckoutSession(customerId: string, priceId: string, successUrl: string, cancelUrl: string) { async createCheckoutSession(
customerId: string,
priceId: string,
successUrl: string,
cancelUrl: string,
) {
return this.stripe.checkout.sessions.create({ return this.stripe.checkout.sessions.create({
customer: customerId, customer: customerId,
payment_method_types: ['card'], payment_method_types: ['card'],
@ -52,7 +64,10 @@ export class StripeService implements OnModuleInit {
} }
async createBillingPortalSession(customerId: string, returnUrl: string) { async createBillingPortalSession(customerId: string, returnUrl: string) {
return this.stripe.billingPortal.sessions.create({ customer: customerId, return_url: returnUrl }); return this.stripe.billingPortal.sessions.create({
customer: customerId,
return_url: returnUrl,
});
} }
constructWebhookEvent(body: Buffer, signature: string): Stripe.Event { constructWebhookEvent(body: Buffer, signature: string): Stripe.Event {

File diff suppressed because it is too large Load diff