made s3 uploader and apis

This commit is contained in:
2025-11-12 19:59:54 +05:30
parent c0e58fe1ce
commit 8e19bb566d
12 changed files with 3083 additions and 385 deletions

View File

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