made s3 uploader and apis
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// src/modules/host/services/host.service.ts
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { PrismaService } from '../../../common/database/prisma.service';
|
||||
import { CreateHostDto, UpdateHostDto } from '../dto/host.dto';
|
||||
import { AddPaymentDetailsDTO, CreateHostDto, UpdateHostDto } from '../dto/host.dto';
|
||||
import * as bcrypt from 'bcryptjs';
|
||||
import ApiError from '../../../common/utils/helper/ApiError';
|
||||
import { User } from '@prisma/client';
|
||||
@@ -143,4 +143,24 @@ export class HostService {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
async addPaymentDetails(id: number, data: AddPaymentDetailsDTO): Promise<AddPaymentDetailsDTO> {
|
||||
const existingUser = await this.prisma.user.findUnique({
|
||||
where: { id },
|
||||
});
|
||||
|
||||
if (!existingUser) {
|
||||
throw new ApiError(404, 'User not found');
|
||||
}
|
||||
|
||||
const addedPaymentDetails = await this.prisma.hostBankDetails.create({
|
||||
data,
|
||||
});
|
||||
|
||||
if (!addedPaymentDetails) {
|
||||
throw new ApiError(400, 'Failed to add payment details');
|
||||
}
|
||||
|
||||
return addedPaymentDetails;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user