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:
paritosh18
2025-11-26 17:31:08 +05:30
parent a0ed3b9faa
commit abae9d9ac2
20 changed files with 1881 additions and 546 deletions

View File

@@ -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;