chore: formatting updates and lockfile changes
This commit is contained in:
parent
5c45557537
commit
3be9807d88
8 changed files with 4851 additions and 89 deletions
|
|
@ -3,8 +3,8 @@ import { AdminService } from './admin.service';
|
|||
import { AdminController } from './admin.controller';
|
||||
|
||||
@Module({
|
||||
providers: [AdminService],
|
||||
controllers: [AdminController],
|
||||
exports: [AdminService],
|
||||
providers: [AdminService],
|
||||
controllers: [AdminController],
|
||||
exports: [AdminService],
|
||||
})
|
||||
export class AdminModule { }
|
||||
export class AdminModule {}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ import { AdminModule } from './admin';
|
|||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,17 @@ import { PlansService } from './plans.service';
|
|||
@ApiTags('Plans')
|
||||
@Controller('plans')
|
||||
export class PlansController {
|
||||
constructor(private readonly plansService: PlansService) { }
|
||||
constructor(private readonly plansService: PlansService) {}
|
||||
|
||||
@Get() @ApiOperation({ summary: 'Get all plans' })
|
||||
getAllPlans() { return this.plansService.getAllPlans(); }
|
||||
@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); }
|
||||
@Get(':id')
|
||||
@ApiOperation({ summary: 'Get plan by ID' })
|
||||
getPlanById(@Param('id') id: string) {
|
||||
return this.plansService.getPlanById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { PlansService } from './plans.service';
|
|||
import { PlansController } from './plans.controller';
|
||||
|
||||
@Module({
|
||||
providers: [PlansService],
|
||||
controllers: [PlansController],
|
||||
exports: [PlansService],
|
||||
providers: [PlansService],
|
||||
controllers: [PlansController],
|
||||
exports: [PlansService],
|
||||
})
|
||||
export class PlansModule { }
|
||||
export class PlansModule {}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,59 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
export interface Plan {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
monthlyPrice: number;
|
||||
yearlyPrice: number;
|
||||
features: string[];
|
||||
popular?: boolean;
|
||||
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'],
|
||||
},
|
||||
];
|
||||
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); }
|
||||
getAllPlans(): Plan[] {
|
||||
return this.plans;
|
||||
}
|
||||
getPlanById(id: string): Plan | undefined {
|
||||
return this.plans.find((p) => p.id === id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import { StripeService } from './stripe.service';
|
|||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [ConfigModule],
|
||||
providers: [StripeService],
|
||||
exports: [StripeService],
|
||||
imports: [ConfigModule],
|
||||
providers: [StripeService],
|
||||
exports: [StripeService],
|
||||
})
|
||||
export class StripeModule { }
|
||||
export class StripeModule {}
|
||||
|
|
|
|||
|
|
@ -4,59 +4,74 @@ import Stripe from 'stripe';
|
|||
|
||||
@Injectable()
|
||||
export class StripeService implements OnModuleInit {
|
||||
private stripe: Stripe;
|
||||
private stripe: Stripe;
|
||||
|
||||
constructor(private configService: ConfigService) { }
|
||||
constructor(private configService: ConfigService) {}
|
||||
|
||||
onModuleInit() {
|
||||
const secretKey = this.configService.get<string>('STRIPE_SECRET_KEY');
|
||||
if (!secretKey) {
|
||||
console.warn('STRIPE_SECRET_KEY not configured');
|
||||
return;
|
||||
}
|
||||
this.stripe = new Stripe(secretKey, { apiVersion: '2025-11-17.clover' as const });
|
||||
onModuleInit() {
|
||||
const secretKey = this.configService.get<string>('STRIPE_SECRET_KEY');
|
||||
if (!secretKey) {
|
||||
console.warn('STRIPE_SECRET_KEY not configured');
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
return this.stripe.customers.create({ email, name });
|
||||
}
|
||||
async createCustomer(email: string, name: string) {
|
||||
return this.stripe.customers.create({ email, name });
|
||||
}
|
||||
|
||||
async createSubscription(customerId: string, priceId: string) {
|
||||
return this.stripe.subscriptions.create({
|
||||
customer: customerId,
|
||||
items: [{ price: priceId }],
|
||||
payment_behavior: 'default_incomplete',
|
||||
expand: ['latest_invoice.payment_intent'],
|
||||
});
|
||||
}
|
||||
async createSubscription(customerId: string, priceId: string) {
|
||||
return this.stripe.subscriptions.create({
|
||||
customer: customerId,
|
||||
items: [{ price: priceId }],
|
||||
payment_behavior: 'default_incomplete',
|
||||
expand: ['latest_invoice.payment_intent'],
|
||||
});
|
||||
}
|
||||
|
||||
async cancelSubscription(subscriptionId: string) {
|
||||
return this.stripe.subscriptions.cancel(subscriptionId);
|
||||
}
|
||||
async cancelSubscription(subscriptionId: string) {
|
||||
return this.stripe.subscriptions.cancel(subscriptionId);
|
||||
}
|
||||
|
||||
async listSubscriptions(customerId: string) {
|
||||
return this.stripe.subscriptions.list({ customer: customerId, status: 'all' });
|
||||
}
|
||||
async listSubscriptions(customerId: string) {
|
||||
return this.stripe.subscriptions.list({
|
||||
customer: customerId,
|
||||
status: 'all',
|
||||
});
|
||||
}
|
||||
|
||||
async createCheckoutSession(customerId: string, priceId: string, successUrl: string, cancelUrl: string) {
|
||||
return this.stripe.checkout.sessions.create({
|
||||
customer: customerId,
|
||||
payment_method_types: ['card'],
|
||||
line_items: [{ price: priceId, quantity: 1 }],
|
||||
mode: 'subscription',
|
||||
success_url: successUrl,
|
||||
cancel_url: cancelUrl,
|
||||
});
|
||||
}
|
||||
async createCheckoutSession(
|
||||
customerId: string,
|
||||
priceId: string,
|
||||
successUrl: string,
|
||||
cancelUrl: string,
|
||||
) {
|
||||
return this.stripe.checkout.sessions.create({
|
||||
customer: customerId,
|
||||
payment_method_types: ['card'],
|
||||
line_items: [{ price: priceId, quantity: 1 }],
|
||||
mode: 'subscription',
|
||||
success_url: successUrl,
|
||||
cancel_url: cancelUrl,
|
||||
});
|
||||
}
|
||||
|
||||
async createBillingPortalSession(customerId: string, returnUrl: string) {
|
||||
return this.stripe.billingPortal.sessions.create({ customer: customerId, return_url: returnUrl });
|
||||
}
|
||||
async createBillingPortalSession(customerId: string, returnUrl: string) {
|
||||
return this.stripe.billingPortal.sessions.create({
|
||||
customer: customerId,
|
||||
return_url: returnUrl,
|
||||
});
|
||||
}
|
||||
|
||||
constructWebhookEvent(body: Buffer, signature: string): Stripe.Event {
|
||||
const secret = this.configService.get<string>('STRIPE_WEBHOOK_SECRET')!;
|
||||
return this.stripe.webhooks.constructEvent(body, signature, secret);
|
||||
}
|
||||
constructWebhookEvent(body: Buffer, signature: string): Stripe.Event {
|
||||
const secret = this.configService.get<string>('STRIPE_WEBHOOK_SECRET')!;
|
||||
return this.stripe.webhooks.constructEvent(body, signature, secret);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4719
frontend/package-lock.json
generated
4719
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue