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:
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user