@laboratory-one/api-components 0.0.8 → 0.0.10
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/dist/cjs/user/user.controller.d.ts.map +1 -1
- package/dist/cjs/user/user.controller.js +1 -1
- package/dist/cjs/user/user.controller.js.map +1 -1
- package/dist/cjs/utils/input.d.ts +1 -0
- package/dist/cjs/utils/input.d.ts.map +1 -1
- package/dist/cjs/utils/input.js +9 -1
- package/dist/cjs/utils/input.js.map +1 -1
- package/dist/esm/user/user.controller.d.ts.map +1 -1
- package/dist/esm/user/user.controller.js +2 -2
- package/dist/esm/user/user.controller.js.map +1 -1
- package/dist/esm/utils/input.d.ts +1 -0
- package/dist/esm/utils/input.d.ts.map +1 -1
- package/dist/esm/utils/input.js +7 -0
- package/dist/esm/utils/input.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/user/user.controller.ts +2 -1
- package/src/utils/input.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laboratory-one/api-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "API components for Laboratory One",
|
|
5
5
|
"author": "Laboratory One",
|
|
6
6
|
"private": false,
|
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"lint": "eslint 'src/**/*.{js,ts,tsx}'",
|
|
21
|
-
"lint:fix": "
|
|
21
|
+
"lint:fix": "yarn format && yarn lint --fix",
|
|
22
22
|
"format": "prettier --write 'src/**/*.{js,ts,tsx}'",
|
|
23
23
|
"build": "yarn build:esm && yarn build:cjs",
|
|
24
24
|
"build:esm": "tsc",
|
|
25
25
|
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
26
26
|
"generate": "prisma generate",
|
|
27
|
-
"publish": "npm publish --access public",
|
|
28
27
|
"publish:local": "yalc publish",
|
|
29
28
|
"push:local": "yalc push",
|
|
30
|
-
"push": "yarn build && yarn push:local"
|
|
29
|
+
"push": "yarn build && yarn push:local",
|
|
30
|
+
"version:patch": "./scripts/version.sh patch",
|
|
31
|
+
"version:minor": "./scripts/version.sh minor"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@nestjs/axios": "3.0.2",
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
cleanString,
|
|
24
24
|
cleanStringAndLowercase,
|
|
25
25
|
handleError,
|
|
26
|
+
utcOffsetToHours,
|
|
26
27
|
} from '../utils';
|
|
27
28
|
import { AuthGuard } from '../guard';
|
|
28
29
|
|
|
@@ -151,7 +152,7 @@ export class UserController {
|
|
|
151
152
|
? cleanStringAndLowercase(dto.fullName)
|
|
152
153
|
: undefined,
|
|
153
154
|
pushToken: dto.pushToken ? cleanString(dto.pushToken) : undefined,
|
|
154
|
-
tz: dto.tz ? dto.tz : undefined,
|
|
155
|
+
tz: dto.tz ? utcOffsetToHours(dto.tz) : undefined,
|
|
155
156
|
};
|
|
156
157
|
|
|
157
158
|
const user: User = await this.userService.update(
|
package/src/utils/input.ts
CHANGED
|
@@ -20,3 +20,13 @@ export const cleanPhoneNumber = (str: string): string => {
|
|
|
20
20
|
|
|
21
21
|
return `+1${trimmed}`;
|
|
22
22
|
};
|
|
23
|
+
|
|
24
|
+
export const utcOffsetToHours = (utcOffset: number): number => {
|
|
25
|
+
const hours = Math.floor(utcOffset / 60);
|
|
26
|
+
|
|
27
|
+
if (hours > 0) {
|
|
28
|
+
return 24 - hours;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return Math.abs(hours);
|
|
32
|
+
};
|