Update Prisma dependencies and refactor host onboarding handlers
- Updated Prisma client and adapter versions in package.json and package-lock.json. - Refactored host onboarding handlers to improve structure and naming conventions. - Added new handlers for onboarding processes including login, signup, and OTP verification. - Implemented new functionality for managing bank details and company submissions. - Enhanced error handling and validation across various handlers.
This commit is contained in:
@@ -8,7 +8,7 @@ import { TokenService } from "../services/token.service";
|
||||
|
||||
const prismaService = new PrismaService();
|
||||
const minglarSerivce = new MinglarService(prismaService);
|
||||
const tokenService = new TokenService();
|
||||
const tokenService = new TokenService(prismaService);
|
||||
|
||||
export const handler = safeHandler(async (
|
||||
event: APIGatewayProxyEvent,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { PrismaService } from "../../../common/database/prisma.service";
|
||||
import jwt, { JwtPayload } from "jsonwebtoken";
|
||||
import moment from "moment";
|
||||
import config from "../../../config/config";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export class TokenService {
|
||||
constructor(private readonly prisma: PrismaService = new PrismaService()) {}
|
||||
|
||||
private generateToken(
|
||||
user_xid: number,
|
||||
expiresIn: Date,
|
||||
@@ -53,7 +53,7 @@ export class TokenService {
|
||||
config.jwt.secret
|
||||
);
|
||||
|
||||
await prisma.token.create({
|
||||
await this.prisma.token.create({
|
||||
data: {
|
||||
token: refreshToken.token,
|
||||
expiringAt: refreshToken.expires,
|
||||
@@ -100,7 +100,7 @@ export class TokenService {
|
||||
config.jwt.secret
|
||||
);
|
||||
|
||||
await prisma.token.create({
|
||||
await this.prisma.token.create({
|
||||
data: {
|
||||
token: refreshToken.token,
|
||||
expiringAt: refreshToken.expires,
|
||||
@@ -119,7 +119,7 @@ export class TokenService {
|
||||
}
|
||||
|
||||
async revokeToken(user_xid: number, deviceId: string): Promise<boolean> {
|
||||
const existingToken = await prisma.token.findFirst({
|
||||
const existingToken = await this.prisma.token.findFirst({
|
||||
where: {
|
||||
id: user_xid,
|
||||
deviceId,
|
||||
@@ -128,12 +128,12 @@ export class TokenService {
|
||||
|
||||
if (!existingToken) return false;
|
||||
|
||||
await prisma.token.delete({ where: { id: existingToken.id } });
|
||||
await this.prisma.token.delete({ where: { id: existingToken.id } });
|
||||
return true;
|
||||
}
|
||||
|
||||
async isTokenBlackListed(token: string): Promise<boolean> {
|
||||
const existing = await prisma.token.findUnique({
|
||||
const existing = await this.prisma.token.findUnique({
|
||||
where: { token },
|
||||
});
|
||||
return existing ? true : false;
|
||||
|
||||
Reference in New Issue
Block a user