hh-contracts 0.0.68 → 0.0.70

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: {
@@ -9,7 +9,7 @@ const BaseQuerySchema = role_models_1.RoleListItemSchema.pick({
9
9
  type: true,
10
10
  isActive: true,
11
11
  })
12
- .extend({ roleIds: zod_1.z.array(zod_1.z.string().uuid()).optional() })
12
+ .extend({ permissionIds: zod_1.z.array(zod_1.z.string().uuid()).optional() })
13
13
  .partial();
14
14
  const OrderBySchema = role_models_1.RoleListItemSchema.omit({
15
15
  id: true,
@@ -13,7 +13,7 @@ exports.RolePersistedSchema = zod_1.z
13
13
  })
14
14
  .merge(common_1.TimestampSchema);
15
15
  exports.RoleWithPermissionsSchema = exports.RolePersistedSchema.extend({
16
- permissionIds: zod_1.z.array(zod_1.z.string().uuid()),
16
+ permissionIds: zod_1.z.array(zod_1.z.string().uuid()).optional(),
17
17
  });
18
18
  exports.RoleWithTranslationsSchema = exports.RoleWithPermissionsSchema.extend({
19
19
  translations: common_1.TranslationsSchema.pick({
@@ -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.68",
3
+ "version": "0.0.70",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -7,7 +7,7 @@ const BaseQuerySchema = RoleListItemSchema.pick({
7
7
  type: true,
8
8
  isActive: true,
9
9
  })
10
- .extend({ roleIds: z.array(z.string().uuid()).optional() })
10
+ .extend({ permissionIds: z.array(z.string().uuid()).optional() })
11
11
  .partial();
12
12
 
13
13
  const OrderBySchema = RoleListItemSchema.omit({
@@ -13,7 +13,7 @@ export const RolePersistedSchema = z
13
13
  export type TRolePersisted = z.infer<typeof RolePersistedSchema>;
14
14
 
15
15
  export const RoleWithPermissionsSchema = RolePersistedSchema.extend({
16
- permissionIds: z.array(z.string().uuid()),
16
+ permissionIds: z.array(z.string().uuid()).optional(),
17
17
  });
18
18
  export type TRoleWithPermissions = z.infer<typeof RoleWithPermissionsSchema>;
19
19