Refactor hostCompanyDetails validation schema to make address and location fields optional; update login handler to remove password comparison logic; enhance host service to include user status check and return specific user fields; clean up profile completion logic in MinglarService.

This commit is contained in:
2025-12-04 20:01:09 +05:30
parent 33b330a15b
commit ab9e02972e
4 changed files with 65 additions and 54 deletions

View File

@@ -291,11 +291,20 @@ export class HostService {
async loginForHost(emailAddress: string, userPassword: string) {
const existingUser = await this.prisma.user.findUnique({
where: { emailAddress: emailAddress },
select: {
id: true,
roleXid: true,
userPassword: true,
userStatus: true
}
});
if (!existingUser) {
throw new ApiError(404, 'User not found');
}
if (existingUser.userStatus == USER_STATUS.REJECTED) {
throw new ApiError(403, "You are not allowed to login. Please contact minglar admin.")
}
if (existingUser.roleXid !== 4) {
throw new ApiError(403, 'Access denied. Not a host user.');