@laboratory-one/api-components 0.0.7 → 0.0.8

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": "@laboratory-one/api-components",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "API components for Laboratory One",
5
5
  "author": "Laboratory One",
6
6
  "private": false,
@@ -1,4 +1,4 @@
1
- import { IsOptional, IsString } from 'class-validator';
1
+ import { IsNumber, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiProperty } from '@nestjs/swagger';
3
3
 
4
4
  export class UpdateUserRequestDto {
@@ -18,7 +18,7 @@ export class UpdateUserRequestDto {
18
18
  pushToken?: string | undefined;
19
19
 
20
20
  @IsOptional()
21
- @IsString()
21
+ @IsNumber()
22
22
  @ApiProperty()
23
- tz?: string | undefined;
23
+ tz?: number | undefined;
24
24
  }
@@ -23,7 +23,6 @@ import {
23
23
  cleanString,
24
24
  cleanStringAndLowercase,
25
25
  handleError,
26
- tzToInt,
27
26
  } from '../utils';
28
27
  import { AuthGuard } from '../guard';
29
28
 
@@ -152,13 +151,13 @@ export class UserController {
152
151
  ? cleanStringAndLowercase(dto.fullName)
153
152
  : undefined,
154
153
  pushToken: dto.pushToken ? cleanString(dto.pushToken) : undefined,
155
- tz: dto.tz ? tzToInt(dto.tz) : undefined,
154
+ tz: dto.tz ? dto.tz : undefined,
156
155
  };
157
156
 
158
- const user: User = await this.userService.update(req.user.userId, {
159
- ...cleanDto,
160
- tz: parseInt(cleanDto.tz, 10),
161
- });
157
+ const user: User = await this.userService.update(
158
+ req.user.userId,
159
+ cleanDto,
160
+ );
162
161
 
163
162
  if (user.fullName && user.phoneNumber) {
164
163
  await this.userService.update(req.user.userId, {
@@ -2,12 +2,6 @@ export const cleanString = (str: string): string => {
2
2
  return str.trim();
3
3
  };
4
4
 
5
- export const tzToInt = (str: string): string => {
6
- const trimmed = cleanString(str);
7
- const split = trimmed.split(':');
8
- return split[0];
9
- };
10
-
11
5
  export const cleanStringAndLowercase = (str: string): string => {
12
6
  const trimmed: string = cleanString(str);
13
7
  return trimmed.toLowerCase();