Logging Update - IPadress & user Email if possible

This commit is contained in:
2024-09-23 13:45:46 +02:00
parent 974a6503ef
commit 1282d30b49
16 changed files with 163 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
import { Body, Controller, Delete, Get, HttpCode, 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 { Checkout } from 'src/models/main.model';
import Stripe from 'stripe';
import { PaymentService } from './payment.service';
@@ -19,16 +20,20 @@ export class PaymentController {
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('paymentmethod/:email')
async getStripePaymentMethods(@Param('email') email: string): Promise<Stripe.PaymentMethod[]> {
return await this.paymentService.getStripePaymentMethod(email);
}
@UseGuards(OptionalJwtAuthGuard)
@Post('create-checkout-session')
async createCheckoutSession(@Body() checkout: Checkout) {
return await this.paymentService.createCheckoutSession(checkout);
@@ -53,6 +58,8 @@ export class PaymentController {
throw new HttpException('Webhook Error', HttpStatus.BAD_REQUEST);
}
}
@UseGuards(OptionalJwtAuthGuard)
@Get('subscriptions/:email')
async findSubscriptionsById(@Param('email') email: string): Promise<any> {
return await this.paymentService.getSubscription(email);