Umstellung auf firebase

This commit is contained in:
2025-02-20 17:51:54 -06:00
parent f6d1b8623c
commit 521e799bff
40 changed files with 495 additions and 261 deletions

View File

@@ -1,7 +1,6 @@
import { Body, Controller, Delete, Get, HttpCode, HttpException, HttpStatus, Param, Post, Req, Res, UseGuards } from '@nestjs/common';
import { Body, Controller, Get, HttpException, HttpStatus, Param, Post, Req, Res, UseGuards } from '@nestjs/common';
import { Request, Response } from 'express';
import { AdminAuthGuard } from 'src/jwt-auth/admin-auth.guard';
import { OptionalJwtAuthGuard } from 'src/jwt-auth/optional-jwt-auth.guard';
import { OptionalAuthGuard } from 'src/jwt-auth/optional-auth.guard';
import { Checkout } from 'src/models/main.model';
import Stripe from 'stripe';
import { PaymentService } from './payment.service';
@@ -15,25 +14,25 @@ export class PaymentController {
// return this.paymentService.createSubscription(subscriptionData);
// }
@UseGuards(AdminAuthGuard)
@Get('user/all')
async getAllStripeCustomer(): Promise<Stripe.Customer[]> {
return await this.paymentService.getAllStripeCustomer();
}
// @UseGuards(AdminAuthGuard)
// @Get('user/all')
// async getAllStripeCustomer(): Promise<Stripe.Customer[]> {
// return await this.paymentService.getAllStripeCustomer();
// }
@UseGuards(AdminAuthGuard)
@Get('subscription/all')
async getAllStripeSubscriptions(): Promise<Stripe.Subscription[]> {
return await this.paymentService.getAllStripeSubscriptions();
}
// @UseGuards(AdminAuthGuard)
// @Get('subscription/all')
// async getAllStripeSubscriptions(): Promise<Stripe.Subscription[]> {
// return await this.paymentService.getAllStripeSubscriptions();
// }
@UseGuards(AdminAuthGuard)
@Get('paymentmethod/:email')
async getStripePaymentMethods(@Param('email') email: string): Promise<Stripe.PaymentMethod[]> {
return await this.paymentService.getStripePaymentMethod(email);
}
// @UseGuards(AdminAuthGuard)
// @Get('paymentmethod/:email')
// async getStripePaymentMethods(@Param('email') email: string): Promise<Stripe.PaymentMethod[]> {
// return await this.paymentService.getStripePaymentMethod(email);
// }
@UseGuards(OptionalJwtAuthGuard)
@UseGuards(OptionalAuthGuard)
@Post('create-checkout-session')
async createCheckoutSession(@Body() checkout: Checkout) {
return await this.paymentService.createCheckoutSession(checkout);
@@ -59,7 +58,7 @@ export class PaymentController {
}
}
@UseGuards(OptionalJwtAuthGuard)
@UseGuards(OptionalAuthGuard)
@Get('subscriptions/:email')
async findSubscriptionsById(@Param('email') email: string): Promise<any> {
return await this.paymentService.getSubscription(email);
@@ -68,10 +67,10 @@ export class PaymentController {
* Endpoint zum Löschen eines Stripe-Kunden.
* Beispiel: DELETE /stripe/customer/cus_12345
*/
@UseGuards(AdminAuthGuard)
@Delete('customer/:id')
@HttpCode(HttpStatus.NO_CONTENT)
async deleteCustomer(@Param('id') customerId: string): Promise<void> {
await this.paymentService.deleteCustomerCompletely(customerId);
}
// @UseGuards(AdminAuthGuard)
// @Delete('customer/:id')
// @HttpCode(HttpStatus.NO_CONTENT)
// async deleteCustomer(@Param('id') customerId: string): Promise<void> {
// await this.paymentService.deleteCustomerCompletely(customerId);
// }
}