hh-contracts 0.0.69 → 0.0.71

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.
@@ -2,43 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.APP_ERRORS = void 0;
4
4
  exports.APP_ERRORS = {
5
- // system: {
6
- // network: {
7
- // statusCode: 0,
8
- // code: 'SYSTEM-NETWORK',
9
- // messageKey: 'errors.system.network',
10
- // },
11
- // timeout: {
12
- // statusCode: 0,
13
- // code: 'SYSTEM-TIMEOUT',
14
- // messageKey: 'errors.system.timeout',
15
- // },
16
- // canceled: {
17
- // statusCode: 0,
18
- // code: 'SYSTEM-CANCELED',
19
- // messageKey: 'errors.system.canceled',
20
- // },
21
- // badResponse: {
22
- // statusCode: 0,
23
- // code: 'SYSTEM-BAD_RESPONSE',
24
- // messageKey: 'errors.system.badResponse',
25
- // },
26
- // invalidUrl: {
27
- // statusCode: 0,
28
- // code: 'SYSTEM-INVALID_URL',
29
- // messageKey: 'errors.system.invalidUrl',
30
- // },
31
- // tooManyRedirects: {
32
- // statusCode: 0,
33
- // code: 'SYSTEM-TOO_MANY_REDIRECTS',
34
- // messageKey: 'errors.system.tooManyRedirects',
35
- // },
36
- // unknown: {
37
- // statusCode: 0,
38
- // code: 'SYSTEM-UNKNOWN',
39
- // messageKey: 'errors.system.unknown',
40
- // },
41
- // },
42
5
  common: {
43
6
  validation: {
44
7
  statusCode: 400, // HttpStatus.BAD_REQUEST,
@@ -151,10 +114,10 @@ exports.APP_ERRORS = {
151
114
  code: 'ROLE-01',
152
115
  messageKey: 'errors.role.notFound',
153
116
  },
154
- alreadyExists: {
155
- statusCode: 409, // HttpStatus.CONFLICT,
117
+ cannotDeleteDefault: {
118
+ statusCode: 400, // HttpStatus.BAD_REQUEST,
156
119
  code: 'ROLE-02',
157
- messageKey: 'errors.role.alreadyExists',
120
+ messageKey: 'errors.role.cannotDeleteDefault',
158
121
  },
159
122
  },
160
123
  permission: {
@@ -163,11 +126,6 @@ exports.APP_ERRORS = {
163
126
  code: 'PERMISSION-01',
164
127
  messageKey: 'errors.permission.notFound',
165
128
  },
166
- alreadyExists: {
167
- statusCode: 409, // HttpStatus.CONFLICT,
168
- code: 'PERMISSION-02',
169
- messageKey: 'errors.permission.alreadyExists',
170
- },
171
129
  },
172
130
  hotel: {
173
131
  notFound: {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindAllPermissionsContract = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ const permission_models_1 = require("../permission.models");
7
+ const permissions_api_1 = require("../permissions.api");
8
+ var FindAllPermissionsContract;
9
+ (function (FindAllPermissionsContract) {
10
+ FindAllPermissionsContract.getUrl = permissions_api_1.PERMISSIONS_API.findAll;
11
+ FindAllPermissionsContract.endpoint = permissions_api_1.PERMISSIONS_CONTROLLER.endpoints.findAll;
12
+ FindAllPermissionsContract.httpMethod = common_1.HTTP_METHODS.get;
13
+ FindAllPermissionsContract.ResponseSchema = zod_1.z.array(permission_models_1.PermissionListItemSchema);
14
+ })(FindAllPermissionsContract || (exports.FindAllPermissionsContract = FindAllPermissionsContract = {}));
@@ -19,3 +19,4 @@ __exportStar(require("./delete-permission.contract"), exports);
19
19
  __exportStar(require("./update-permission.contract"), exports);
20
20
  __exportStar(require("./find-permission.contract"), exports);
21
21
  __exportStar(require("./find-many-permission.contract"), exports);
22
+ __exportStar(require("./find-all-permission.contract"), exports);
@@ -7,6 +7,7 @@ exports.PERMISSIONS_CONTROLLER = {
7
7
  endpoints: {
8
8
  find: ':id',
9
9
  findMany: '',
10
+ findAll: 'all',
10
11
  create: '',
11
12
  update: ':id',
12
13
  delete: ':id',
@@ -1,43 +1,6 @@
1
1
  import { TZodErorrKey } from './zod-error-mapping.constant';
2
2
 
3
3
  export const APP_ERRORS = {
4
- // system: {
5
- // network: {
6
- // statusCode: 0,
7
- // code: 'SYSTEM-NETWORK',
8
- // messageKey: 'errors.system.network',
9
- // },
10
- // timeout: {
11
- // statusCode: 0,
12
- // code: 'SYSTEM-TIMEOUT',
13
- // messageKey: 'errors.system.timeout',
14
- // },
15
- // canceled: {
16
- // statusCode: 0,
17
- // code: 'SYSTEM-CANCELED',
18
- // messageKey: 'errors.system.canceled',
19
- // },
20
- // badResponse: {
21
- // statusCode: 0,
22
- // code: 'SYSTEM-BAD_RESPONSE',
23
- // messageKey: 'errors.system.badResponse',
24
- // },
25
- // invalidUrl: {
26
- // statusCode: 0,
27
- // code: 'SYSTEM-INVALID_URL',
28
- // messageKey: 'errors.system.invalidUrl',
29
- // },
30
- // tooManyRedirects: {
31
- // statusCode: 0,
32
- // code: 'SYSTEM-TOO_MANY_REDIRECTS',
33
- // messageKey: 'errors.system.tooManyRedirects',
34
- // },
35
- // unknown: {
36
- // statusCode: 0,
37
- // code: 'SYSTEM-UNKNOWN',
38
- // messageKey: 'errors.system.unknown',
39
- // },
40
- // },
41
4
  common: {
42
5
  validation: {
43
6
  statusCode: 400, // HttpStatus.BAD_REQUEST,
@@ -150,10 +113,10 @@ export const APP_ERRORS = {
150
113
  code: 'ROLE-01',
151
114
  messageKey: 'errors.role.notFound',
152
115
  },
153
- alreadyExists: {
154
- statusCode: 409, // HttpStatus.CONFLICT,
116
+ cannotDeleteDefault: {
117
+ statusCode: 400, // HttpStatus.BAD_REQUEST,
155
118
  code: 'ROLE-02',
156
- messageKey: 'errors.role.alreadyExists',
119
+ messageKey: 'errors.role.cannotDeleteDefault',
157
120
  },
158
121
  },
159
122
  permission: {
@@ -162,11 +125,6 @@ export const APP_ERRORS = {
162
125
  code: 'PERMISSION-01',
163
126
  messageKey: 'errors.permission.notFound',
164
127
  },
165
- alreadyExists: {
166
- statusCode: 409, // HttpStatus.CONFLICT,
167
- code: 'PERMISSION-02',
168
- messageKey: 'errors.permission.alreadyExists',
169
- },
170
128
  },
171
129
  hotel: {
172
130
  notFound: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { HTTP_METHODS, CommonQueryParamsSchema, PaginationResponseSchema } from '../../common';
3
+ import { PermissionListItemSchema } from '../permission.models';
4
+ import { PERMISSIONS_API, PERMISSIONS_CONTROLLER } from '../permissions.api';
5
+
6
+ export namespace FindAllPermissionsContract {
7
+ export const getUrl = PERMISSIONS_API.findAll;
8
+ export const endpoint = PERMISSIONS_CONTROLLER.endpoints.findAll;
9
+ export const httpMethod = HTTP_METHODS.get;
10
+
11
+ export const ResponseSchema = z.array(PermissionListItemSchema);
12
+ export type TResponse = z.infer<typeof ResponseSchema>;
13
+ }
@@ -3,3 +3,4 @@ export * from './delete-permission.contract';
3
3
  export * from './update-permission.contract';
4
4
  export * from './find-permission.contract';
5
5
  export * from './find-many-permission.contract';
6
+ export * from './find-all-permission.contract';
@@ -5,6 +5,7 @@ export const PERMISSIONS_CONTROLLER = {
5
5
  endpoints: {
6
6
  find: ':id',
7
7
  findMany: '',
8
+ findAll: 'all',
8
9
  create: '',
9
10
  update: ':id',
10
11
  delete: ':id',