@merkaly/api 0.1.10-1 → 0.1.10-2
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 +3 -3
- package/src/account/app.exception.d.ts +11 -0
- package/src/account/app.exception.d.ts.map +1 -0
- package/src/account/app.exception.ts +23 -0
- package/src/account/organizations/organization.validator.d.ts +3 -0
- package/src/account/organizations/organization.validator.d.ts.map +1 -1
- package/src/account/organizations/organization.validator.ts +6 -0
- package/src/account/roles/role.exception.d.ts +5 -0
- package/src/account/roles/role.exception.d.ts.map +1 -0
- package/src/account/roles/role.exception.ts +11 -0
- package/src/account/roles/role.validator.d.ts +3 -0
- package/src/account/roles/role.validator.d.ts.map +1 -1
- package/src/account/roles/role.validator.ts +6 -0
- package/src/account/roles/users/user.router.ts +1 -1
- package/src/account/users/user.validator.d.ts +3 -0
- package/src/account/users/user.validator.d.ts.map +1 -1
- package/src/account/users/user.validator.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/api",
|
|
3
|
-
"version": "0.1.10-
|
|
3
|
+
"version": "0.1.10-2",
|
|
4
4
|
"description": "NestJS Backend ApiRest Service",
|
|
5
5
|
"author": "Randy Tellez Galan <kronhyx@gmail.com>",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@nestjs/event-emitter": "^1.0.0",
|
|
44
44
|
"@nestjs/jwt": "8.0.0",
|
|
45
45
|
"@nestjs/passport": "8.1.0",
|
|
46
|
-
"@nestjs/platform-express": "8.
|
|
46
|
+
"@nestjs/platform-express": "8.3.1",
|
|
47
47
|
"@nestjs/schematics": "8.0.7",
|
|
48
48
|
"@nestjs/testing": "8.3.1",
|
|
49
49
|
"@semantic-release/exec": "^6.0.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"firebase-admin": "^10.0.2",
|
|
65
65
|
"husky": "^7.0.0",
|
|
66
66
|
"jest": "27.5.1",
|
|
67
|
-
"passport": "^0.
|
|
67
|
+
"passport": "^0.5.2",
|
|
68
68
|
"passport-jwt": "^4.0.0",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
70
70
|
"rxjs": "^7.2.0",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArgumentsHost, ExceptionFilter, HttpException } from '@nestjs/common';
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
export default abstract class AppException implements ExceptionFilter {
|
|
4
|
+
protected request: Request;
|
|
5
|
+
protected response: Response;
|
|
6
|
+
protected exception: HttpException;
|
|
7
|
+
protected host: ArgumentsHost;
|
|
8
|
+
catch(exception: HttpException, host: ArgumentsHost): any;
|
|
9
|
+
protected abstract handle(): any;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app.exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.exception.d.ts","sourceRoot":"","sources":["app.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAa,YAAW,eAAe;IACnE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC5B,SAAS,CAAC,SAAS,EAAE,aAAa,CAAA;IAClC,SAAS,CAAC,IAAI,EAAE,aAAa,CAAA;IAE7B,KAAK,CAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa;IAYpD,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAK,GAAG;CAClC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ArgumentsHost, ExceptionFilter, HttpException } from '@nestjs/common'
|
|
2
|
+
import { Request, Response } from 'express'
|
|
3
|
+
|
|
4
|
+
export default abstract class AppException implements ExceptionFilter {
|
|
5
|
+
protected request: Request
|
|
6
|
+
protected response: Response
|
|
7
|
+
protected exception: HttpException
|
|
8
|
+
protected host: ArgumentsHost
|
|
9
|
+
|
|
10
|
+
catch (exception: HttpException, host: ArgumentsHost) {
|
|
11
|
+
this.host = host
|
|
12
|
+
|
|
13
|
+
const ctx = this.host.switchToHttp()
|
|
14
|
+
|
|
15
|
+
this.response = ctx.getResponse<Response>()
|
|
16
|
+
this.request = ctx.getRequest<Request>()
|
|
17
|
+
this.exception = exception
|
|
18
|
+
|
|
19
|
+
return this.handle()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected abstract handle (): any
|
|
23
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare class FindOrganizationValidator {
|
|
2
|
+
}
|
|
1
3
|
export declare class CreateOrganizationValidator {
|
|
2
4
|
name: string;
|
|
3
5
|
display_name: string;
|
|
@@ -5,6 +7,7 @@ export declare class CreateOrganizationValidator {
|
|
|
5
7
|
primary_color?: string;
|
|
6
8
|
secondary_color?: string;
|
|
7
9
|
}
|
|
10
|
+
export declare type IdOrganizationValidator = string;
|
|
8
11
|
export declare class UpdateOrganizationValidator {
|
|
9
12
|
display_name?: string;
|
|
10
13
|
logo_url?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.validator.d.ts","sourceRoot":"","sources":["organization.validator.ts"],"names":[],"mappings":"AAEA,qBAAa,2BAA2B;IAEtC,IAAI,EAAE,MAAM,CAAA;IAGZ,YAAY,EAAE,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,aAAa,CAAC,EAAE,MAAM,CAAA;IAItB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,qBAAa,2BAA2B;IAGtC,YAAY,CAAC,EAAE,MAAM,CAAA;IAIrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,aAAa,CAAC,EAAE,MAAM,CAAA;IAKtB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB"}
|
|
1
|
+
{"version":3,"file":"organization.validator.d.ts","sourceRoot":"","sources":["organization.validator.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAAyB;CAErC;AAED,qBAAa,2BAA2B;IAEtC,IAAI,EAAE,MAAM,CAAA;IAGZ,YAAY,EAAE,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,aAAa,CAAC,EAAE,MAAM,CAAA;IAItB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,oBAAY,uBAAuB,GAAG,MAAM,CAAA;AAE5C,qBAAa,2BAA2B;IAGtC,YAAY,CAAC,EAAE,MAAM,CAAA;IAIrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,aAAa,CAAC,EAAE,MAAM,CAAA;IAKtB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IsHexColor, IsOptional, IsString, IsUrl } from 'class-validator'
|
|
2
2
|
|
|
3
|
+
export class FindOrganizationValidator {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
export class CreateOrganizationValidator {
|
|
4
8
|
@IsString()
|
|
5
9
|
name: string
|
|
@@ -20,6 +24,8 @@ export class CreateOrganizationValidator {
|
|
|
20
24
|
secondary_color?: string
|
|
21
25
|
}
|
|
22
26
|
|
|
27
|
+
export type IdOrganizationValidator = string
|
|
28
|
+
|
|
23
29
|
export class UpdateOrganizationValidator {
|
|
24
30
|
@IsString()
|
|
25
31
|
@IsOptional()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.exception.d.ts","sourceRoot":"","sources":["role.exception.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,kBAAkB,CAAA;AAG3C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,YAAY;IACrD,MAAM;CAKP"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Catch, HttpStatus } from '@nestjs/common'
|
|
2
|
+
import AppException from '../app.exception'
|
|
3
|
+
|
|
4
|
+
@Catch()
|
|
5
|
+
export default class RoleException extends AppException {
|
|
6
|
+
handle () {
|
|
7
|
+
this.response
|
|
8
|
+
.status(HttpStatus.NOT_FOUND)
|
|
9
|
+
.json(this.exception)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CreateRoleData, UpdateRoleData } from 'auth0';
|
|
2
|
+
export declare class FindRoleValidator {
|
|
3
|
+
}
|
|
2
4
|
export declare class CreateRoleValidator implements CreateRoleData {
|
|
3
5
|
name: string;
|
|
4
6
|
description: string;
|
|
5
7
|
}
|
|
8
|
+
export declare type IdRoleValidator = string;
|
|
6
9
|
export declare class UpdateRoleValidator implements UpdateRoleData {
|
|
7
10
|
name: string;
|
|
8
11
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.validator.d.ts","sourceRoot":"","sources":["role.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAGtD,qBAAa,mBAAoB,YAAW,cAAc;IAExD,IAAI,EAAE,MAAM,CAAA;IAIZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,mBAAoB,YAAW,cAAc;IAGxD,IAAI,EAAE,MAAM,CAAA;IAIZ,WAAW,EAAE,MAAM,CAAA;CACpB"}
|
|
1
|
+
{"version":3,"file":"role.validator.d.ts","sourceRoot":"","sources":["role.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAGtD,qBAAa,iBAAiB;CAE7B;AAED,qBAAa,mBAAoB,YAAW,cAAc;IAExD,IAAI,EAAE,MAAM,CAAA;IAIZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,oBAAY,eAAe,GAAG,MAAM,CAAA;AAEpC,qBAAa,mBAAoB,YAAW,cAAc;IAGxD,IAAI,EAAE,MAAM,CAAA;IAIZ,WAAW,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { CreateRoleData, UpdateRoleData } from 'auth0'
|
|
2
2
|
import { IsOptional, IsString } from 'class-validator'
|
|
3
3
|
|
|
4
|
+
export class FindRoleValidator {
|
|
5
|
+
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
export class CreateRoleValidator implements CreateRoleData {
|
|
5
9
|
@IsString()
|
|
6
10
|
name: string
|
|
@@ -10,6 +14,8 @@ export class CreateRoleValidator implements CreateRoleData {
|
|
|
10
14
|
description: string
|
|
11
15
|
}
|
|
12
16
|
|
|
17
|
+
export type IdRoleValidator = string
|
|
18
|
+
|
|
13
19
|
export class UpdateRoleValidator implements UpdateRoleData {
|
|
14
20
|
@IsOptional()
|
|
15
21
|
@IsString()
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { CreateUserData, UpdateUserData } from 'auth0';
|
|
2
|
+
export declare class FindUserValidator {
|
|
3
|
+
}
|
|
2
4
|
export declare class CreateUserValidator implements CreateUserData {
|
|
3
5
|
email: string;
|
|
4
6
|
password: string;
|
|
5
7
|
name: string;
|
|
6
8
|
connection: string;
|
|
7
9
|
}
|
|
10
|
+
export declare type IdUserValidator = string;
|
|
8
11
|
export declare class UpdateUserValidator implements UpdateUserData {
|
|
9
12
|
name?: string;
|
|
10
13
|
nickname?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.validator.d.ts","sourceRoot":"","sources":["user.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAItD,qBAAa,mBAAoB,YAAW,cAAc;IAExD,KAAK,EAAE,MAAM,CAAA;IAGb,QAAQ,EAAE,MAAM,CAAA;IAIhB,IAAI,EAAE,MAAM,CAAA;IAIZ,UAAU,EAAE,MAAM,CAAwB;CAC3C;AAED,qBAAa,mBAAoB,YAAW,cAAc;IAGxD,IAAI,CAAC,EAAE,MAAM,CAAA;IAIb,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
1
|
+
{"version":3,"file":"user.validator.d.ts","sourceRoot":"","sources":["user.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAItD,qBAAa,iBAAiB;CAC7B;AAED,qBAAa,mBAAoB,YAAW,cAAc;IAExD,KAAK,EAAE,MAAM,CAAA;IAGb,QAAQ,EAAE,MAAM,CAAA;IAIhB,IAAI,EAAE,MAAM,CAAA;IAIZ,UAAU,EAAE,MAAM,CAAwB;CAC3C;AAED,oBAAY,eAAe,GAAG,MAAM,CAAA;AAEpC,qBAAa,mBAAoB,YAAW,cAAc;IAGxD,IAAI,CAAC,EAAE,MAAM,CAAA;IAIb,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -2,6 +2,9 @@ import { CreateUserData, UpdateUserData } from 'auth0'
|
|
|
2
2
|
import { IsEmail, IsOptional, IsString, IsUrl } from 'class-validator'
|
|
3
3
|
import AppConfig from '../../app.config'
|
|
4
4
|
|
|
5
|
+
export class FindUserValidator {
|
|
6
|
+
}
|
|
7
|
+
|
|
5
8
|
export class CreateUserValidator implements CreateUserData {
|
|
6
9
|
@IsEmail()
|
|
7
10
|
email: string
|
|
@@ -18,6 +21,8 @@ export class CreateUserValidator implements CreateUserData {
|
|
|
18
21
|
connection: string = AppConfig.auth0.realm
|
|
19
22
|
}
|
|
20
23
|
|
|
24
|
+
export type IdUserValidator = string
|
|
25
|
+
|
|
21
26
|
export class UpdateUserValidator implements UpdateUserData {
|
|
22
27
|
@IsOptional()
|
|
23
28
|
@IsString()
|