rez_core 2.2.102 → 2.2.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.102",
3
+ "version": "2.2.103",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Body,
3
3
  Controller,
4
+ HttpCode,
4
5
  HttpStatus,
5
6
  Inject,
6
7
  Post,
@@ -11,13 +12,13 @@ import { UserService } from '../service/user.service';
11
12
  import { CreateUserDto } from '../dto/create-user.dto';
12
13
  import { Response } from 'express';
13
14
 
14
- @Controller('user')
15
+ @Controller()
15
16
  export class UserController {
16
17
  constructor(
17
18
  @Inject('UserService') private readonly userService: UserService,
18
19
  ) {}
19
20
 
20
- @Post('signup')
21
+ @Post('user/signup')
21
22
  async signup(
22
23
  @Body(new ValidationPipe()) createUserDto: CreateUserDto,
23
24
  @Res() res: Response,
@@ -25,4 +26,10 @@ export class UserController {
25
26
  const result = await this.userService.createEntity(createUserDto, null);
26
27
  res.status(HttpStatus.OK).json(result);
27
28
  }
29
+
30
+ @Post('check-email')
31
+ @HttpCode(HttpStatus.OK)
32
+ async checkEmail(@Body('email_id') email: string) {
33
+ return await this.userService.checkEmailExists(email);
34
+ }
28
35
  }
@@ -1,5 +1,10 @@
1
1
  import { RoleService } from './role.service';
2
- import { BadRequestException, Inject, Injectable } from '@nestjs/common';
2
+ import {
3
+ BadRequestException,
4
+ ForbiddenException,
5
+ Inject,
6
+ Injectable,
7
+ } from '@nestjs/common';
3
8
  import { EntityServiceImpl } from '../../meta/service/entity-service-impl.service';
4
9
  import { UserData } from '../entity/user.entity';
5
10
  import { BaseEntity } from '../../meta/entity/base-entity.entity';
@@ -288,8 +293,27 @@ export class UserService extends EntityServiceImpl {
288
293
 
289
294
  user.last_level_type = levelType;
290
295
  user.last_level_id = levelId;
291
- user.last_app_access = appcode ;
296
+ user.last_app_access = appcode;
292
297
 
293
298
  await this.userRepository.saveUser(user); // This persists the updated field
294
299
  }
300
+
301
+ async checkEmailExists(email: string) {
302
+ if (!email) {
303
+ return { success: false, message: 'Email is required' };
304
+ }
305
+
306
+ const user = await this.userRepository.findByEmailId(email);
307
+
308
+ if (user) {
309
+ return {
310
+ success: true,
311
+ message:
312
+ 'An account already exists for this email address. Login or use a different email address to sign up.',
313
+ userId: user.id,
314
+ };
315
+ } else {
316
+ throw new ForbiddenException('No account found with this email address.');
317
+ }
318
+ }
295
319
  }
@@ -121,10 +121,15 @@ export class StageService extends EntityServiceImpl {
121
121
  }
122
122
  }
123
123
 
124
- const result = allStages.map((stage) => ({
125
- stage_id: stage.id,
126
- full_name: stage.name,
127
- }));
124
+ // Build "StageGroupName - StageName"
125
+ const result = allStages.map((stage) => {
126
+ const groupName = groupNameMap.get(Number(stage.stage_group_id)) || '';
127
+ return {
128
+ stage_id: stage.id,
129
+ full_name: `${groupName} - ${stage.name}`, // Combined format
130
+ };
131
+ });
132
+
128
133
  return result;
129
134
  }
130
135
  }
@@ -1,5 +0,0 @@
1
- {
2
- "recommendations": [
3
- "dbaeumer.vscode-eslint"
4
- ]
5
- }