hh-contracts 0.0.108 → 0.0.110

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.
Files changed (180) hide show
  1. package/build/common/constants/app-statuses.constant.js +6 -0
  2. package/build/common/constants/icon.constants.js +4 -0
  3. package/build/index.js +1 -0
  4. package/build/users/contracts/assign-user-role.contract.js +15 -0
  5. package/build/users/contracts/create-user.contract.js +14 -0
  6. package/build/users/contracts/delete-user.contract.js +46 -0
  7. package/build/users/contracts/find-many-users.contract.js +71 -0
  8. package/build/users/contracts/find-user.contract.js +13 -0
  9. package/build/users/contracts/index.js +23 -0
  10. package/build/users/contracts/replace-user-role-assignments.contract.js +15 -0
  11. package/build/users/contracts/update-user.contract.js +14 -0
  12. package/build/users/index.js +20 -0
  13. package/build/users/user-role-assignments.models.js +107 -0
  14. package/build/users/user.models.js +80 -0
  15. package/build/users/users.api.js +17 -0
  16. package/package.json +15 -3
  17. package/app-menu/get.query.ts +0 -17
  18. package/app-menu/index.ts +0 -1
  19. package/common/constants/app-ability.constant.ts +0 -22
  20. package/common/constants/app-errors.constant.ts +0 -235
  21. package/common/constants/app-statuses.constant.ts +0 -26
  22. package/common/constants/array-splitter.constant.ts +0 -1
  23. package/common/constants/default-pagination-config.constant.ts +0 -5
  24. package/common/constants/domain-name.constant.ts +0 -8
  25. package/common/constants/entity.constant.ts +0 -10
  26. package/common/constants/http-method.constant.ts +0 -9
  27. package/common/constants/icon.constants.ts +0 -85
  28. package/common/constants/index.ts +0 -18
  29. package/common/constants/kind-of-app.constant.ts +0 -7
  30. package/common/constants/locales.constant.ts +0 -26
  31. package/common/constants/navigation-item-type.constant.ts +0 -6
  32. package/common/constants/order-direction.constant.ts +0 -10
  33. package/common/constants/role-types.constant.ts +0 -8
  34. package/common/constants/route-component-key.constants.ts +0 -5
  35. package/common/constants/slug.constant.ts +0 -8
  36. package/common/constants/time-zone.constant.ts +0 -4
  37. package/common/constants/translatable-field.constant.ts +0 -10
  38. package/common/index.ts +0 -5
  39. package/common/models/boolean-query-param.schema.ts +0 -8
  40. package/common/models/common-query-params.schema.ts +0 -10
  41. package/common/models/domain-name.schema.ts +0 -14
  42. package/common/models/icon-key.schema.ts +0 -4
  43. package/common/models/index.ts +0 -15
  44. package/common/models/info.schema.ts +0 -8
  45. package/common/models/language-keys.schema.ts +0 -4
  46. package/common/models/navigation-item.schemas.ts +0 -29
  47. package/common/models/order.schema.ts +0 -7
  48. package/common/models/pagination.schema.ts +0 -18
  49. package/common/models/search.schema.ts +0 -5
  50. package/common/models/slug.schema.ts +0 -14
  51. package/common/models/timestamp.schemas.ts +0 -14
  52. package/common/models/timezone.schema.ts +0 -10
  53. package/common/models/translations.schemas.ts +0 -14
  54. package/common/models/uuid.schemas.ts +0 -9
  55. package/common/types/index.ts +0 -1
  56. package/common/types/optionalized.type.ts +0 -40
  57. package/common/utils/create-api/create-api.ts +0 -28
  58. package/common/utils/create-api/index.ts +0 -2
  59. package/common/utils/create-api/types.ts +0 -34
  60. package/common/utils/index.ts +0 -2
  61. package/common/utils/zod-message-key/index.ts +0 -1
  62. package/common/utils/zod-message-key/types.ts +0 -7
  63. package/common/utils/zod-message-key/zod-message-key.util.ts +0 -31
  64. package/companies/company.models.ts +0 -11
  65. package/companies/index.ts +0 -1
  66. package/hotels/amenities/hotel-amenity.model.ts +0 -10
  67. package/hotels/amenities/index.ts +0 -1
  68. package/hotels/constants/hotel-amenity.constant.ts +0 -18
  69. package/hotels/constants/hotel-contact-type.constant.ts +0 -12
  70. package/hotels/constants/hotel-feature.constant.ts +0 -14
  71. package/hotels/constants/hotel-integration-connection-state.constant.ts +0 -13
  72. package/hotels/constants/hotel-integration-credential-status.constant.ts +0 -12
  73. package/hotels/constants/hotel-integration-provider.constant.ts +0 -11
  74. package/hotels/constants/hotel-integration-sync-status.constant.ts +0 -13
  75. package/hotels/constants/hotel-policy-type.constant.ts +0 -15
  76. package/hotels/constants/hotel-rating-source.constant.ts +0 -12
  77. package/hotels/constants/index.ts +0 -9
  78. package/hotels/contacts/hotel-contact.model.ts +0 -15
  79. package/hotels/contacts/index.ts +0 -1
  80. package/hotels/contracts/create-hotel.contract.ts +0 -16
  81. package/hotels/contracts/delete-hotel.contract.ts +0 -12
  82. package/hotels/contracts/find-hotel.contract.ts +0 -27
  83. package/hotels/contracts/find-many-hotels.contract.ts +0 -41
  84. package/hotels/contracts/index.ts +0 -5
  85. package/hotels/contracts/update-hotel.contract.ts +0 -17
  86. package/hotels/domains/contracts/find-hotel-domain-settings.contract.ts +0 -13
  87. package/hotels/domains/contracts/index.ts +0 -2
  88. package/hotels/domains/contracts/update-hotel-domain-settings.contract.ts +0 -16
  89. package/hotels/domains/hotel-domains.api.ts +0 -11
  90. package/hotels/domains/hotel-domains.schema.ts +0 -25
  91. package/hotels/domains/index.ts +0 -3
  92. package/hotels/features/hotel-feature.model.ts +0 -14
  93. package/hotels/features/index.ts +0 -1
  94. package/hotels/hotel.models.ts +0 -72
  95. package/hotels/hotels.api.ts +0 -22
  96. package/hotels/index.ts +0 -14
  97. package/hotels/integrations/configs/index.ts +0 -1
  98. package/hotels/integrations/configs/opera-integration-config.model.ts +0 -6
  99. package/hotels/integrations/contracts/create-hotel-integration.contract.ts +0 -21
  100. package/hotels/integrations/contracts/delete-hotel-integration.contract.ts +0 -14
  101. package/hotels/integrations/contracts/find-all-hotel-integrations.contract.ts +0 -18
  102. package/hotels/integrations/contracts/find-hotel-integration.contract.ts +0 -15
  103. package/hotels/integrations/contracts/index.ts +0 -5
  104. package/hotels/integrations/contracts/update-hotel-integration.contract.ts +0 -21
  105. package/hotels/integrations/hotel-integration.model.ts +0 -80
  106. package/hotels/integrations/hotel-integrations.api.ts +0 -16
  107. package/hotels/integrations/index.ts +0 -3
  108. package/hotels/location/hotel-location.model.ts +0 -17
  109. package/hotels/location/index.ts +0 -1
  110. package/hotels/policies/hotel-policy.model.ts +0 -16
  111. package/hotels/policies/index.ts +0 -1
  112. package/hotels/ratings/hotel-rating.model.ts +0 -15
  113. package/hotels/ratings/index.ts +0 -1
  114. package/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.ts +0 -26
  115. package/hotels/sites/contracts/index.ts +0 -1
  116. package/hotels/sites/hotel-pages.api.ts +0 -24
  117. package/hotels/sites/index.ts +0 -2
  118. package/hotels/themes/constants/accent-colors.constant.ts +0 -18
  119. package/hotels/themes/constants/fonts.constant.ts +0 -9
  120. package/hotels/themes/constants/index.ts +0 -3
  121. package/hotels/themes/constants/radius.constant.ts +0 -12
  122. package/hotels/themes/contracts/find-hotel-theme.contract.ts +0 -13
  123. package/hotels/themes/contracts/index.ts +0 -1
  124. package/hotels/themes/hotel-themes.api.ts +0 -20
  125. package/hotels/themes/index.ts +0 -4
  126. package/hotels/themes/theme.models.ts +0 -13
  127. package/index.ts +0 -10
  128. package/pages/constants/block-type.constant.ts +0 -11
  129. package/pages/constants/cta-actions.constant.ts +0 -5
  130. package/pages/constants/hero.constants.ts +0 -18
  131. package/pages/constants/image-loading.constant.ts +0 -8
  132. package/pages/constants/index.ts +0 -5
  133. package/pages/constants/media.constants.ts +0 -20
  134. package/pages/index.ts +0 -2
  135. package/pages/models/blocks/base-block.schema.ts +0 -11
  136. package/pages/models/blocks/block.schemas.ts +0 -57
  137. package/pages/models/blocks/cta.schema.ts +0 -58
  138. package/pages/models/blocks/hero-block.schema.ts +0 -27
  139. package/pages/models/blocks/html-block.schema.ts +0 -14
  140. package/pages/models/blocks/index.ts +0 -6
  141. package/pages/models/blocks/media.schemas.ts +0 -66
  142. package/pages/models/index.ts +0 -2
  143. package/pages/models/page.schema.ts +0 -29
  144. package/permissions/contracts/create-permission.contract.ts +0 -18
  145. package/permissions/contracts/delete-permission.contract.ts +0 -12
  146. package/permissions/contracts/find-all-permission.contract.ts +0 -13
  147. package/permissions/contracts/find-many-permission.contract.ts +0 -40
  148. package/permissions/contracts/find-permission.contract.ts +0 -13
  149. package/permissions/contracts/index.ts +0 -6
  150. package/permissions/contracts/update-permission.contract.ts +0 -17
  151. package/permissions/index.ts +0 -3
  152. package/permissions/permission.models.ts +0 -37
  153. package/permissions/permissions.api.ts +0 -15
  154. package/permissions/permisson-conditions.model.ts +0 -7
  155. package/roles/contracts/create-role.contract.ts +0 -16
  156. package/roles/contracts/delete-role.contract.ts +0 -12
  157. package/roles/contracts/find-many-roles.contract.ts +0 -55
  158. package/roles/contracts/find-role.contract.ts +0 -13
  159. package/roles/contracts/index.ts +0 -5
  160. package/roles/contracts/update-role.contract.ts +0 -17
  161. package/roles/index.ts +0 -3
  162. package/roles/role.models.ts +0 -52
  163. package/roles/roles.api.ts +0 -14
  164. package/tenants/contracts/index.ts +0 -1
  165. package/tenants/contracts/resolve-tenant.contract.ts +0 -32
  166. package/tenants/index.ts +0 -3
  167. package/tenants/tenant.model.ts +0 -19
  168. package/tenants/tenants.api.ts +0 -10
  169. package/translate/contracts/index.ts +0 -2
  170. package/translate/contracts/translate-object.contract.ts +0 -54
  171. package/translate/contracts/translate-text.contract.ts +0 -24
  172. package/translate/index.ts +0 -2
  173. package/translate/translate.api.ts +0 -11
  174. package/translate/translate.schemas.ts +0 -7
  175. package/translations/index.ts +0 -4
  176. package/translations/resolve-translation-value-type.helper.ts +0 -14
  177. package/translations/translation-value-type-policy.ts +0 -22
  178. package/translations/translation-value-types.constant.ts +0 -10
  179. package/translations/translation.models.ts +0 -13
  180. package/tsconfig.json +0 -112
@@ -1,235 +0,0 @@
1
- export const APP_ERRORS = {
2
- common: {
3
- validation: {
4
- statusCode: 400, // HttpStatus.BAD_REQUEST,
5
- code: 'COMMON-01',
6
- messageKey: 'errors.common.validation',
7
- },
8
- unauthorized: {
9
- statusCode: 401, // HttpStatus.UNAUTHORIZED,
10
- code: 'COMMON-02',
11
- messageKey: 'errors.common.unauthorized',
12
- },
13
- forbidden: {
14
- statusCode: 403, // HttpStatus.FORBIDDEN,
15
- code: 'COMMON-03',
16
- messageKey: 'errors.common.forbidden',
17
- },
18
- requestTimeout: {
19
- statusCode: 408, // HttpStatus.REQUEST_TIMEOUT,
20
- code: 'COMMON-04',
21
- messageKey: 'errors.common.requestTimeout',
22
- },
23
- unprocessableEntity: {
24
- statusCode: 422, // HttpStatus.UNPROCESSABLE_ENTITY,
25
- code: 'COMMON-05',
26
- messageKey: 'errors.common.unprocessableEntity',
27
- },
28
- internalServer: {
29
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
30
- code: 'COMMON-06',
31
- messageKey: 'errors.common.internalServer',
32
- },
33
- // Перенести в отдельную сущность
34
- // hotelClientNotConnected: {
35
- // statusCode: 503, // HttpStatus.SERVICE_UNAVAILABLE,
36
- // code: 'COMMON-05',
37
- // message: 'Hotel client is not connected.',
38
- // },
39
- // hotelClientInternalError: {
40
- // statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
41
- // code: 'COMMON-06',
42
- // message: 'Hotel client internal error.',
43
- // },
44
- },
45
- auth: {
46
- wrongCredentials: {
47
- statusCode: 401, // HttpStatus.UNAUTHORIZED,
48
- code: 'AUTH-01',
49
- messageKey: 'errors.auth.wrongCredentials',
50
- },
51
- },
52
- translation: {
53
- alreadyExists: {
54
- statusCode: 409, // HttpStatus.CONFLICT,
55
- code: 'TRANSLATION-02',
56
- messageKey: 'errors.translation.alreadyExists',
57
- },
58
- entityFieldExists: {
59
- statusCode: 409, // HttpStatus.CONFLICT,
60
- code: 'TRANSLATION-03',
61
- messageKey: 'errors.translation.entityFieldExists',
62
- },
63
- createFailed: {
64
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
65
- code: 'TRANSLATION-04',
66
- messageKey: 'errors.translation.createFailed',
67
- },
68
- updateFailed: {
69
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
70
- code: 'TRANSLATION-05',
71
- messageKey: 'errors.translation.updateFailed',
72
- },
73
- deleteFailed: {
74
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
75
- code: 'TRANSLATION-06',
76
- messageKey: 'errors.translation.deleteFailed',
77
- },
78
- findFailed: {
79
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
80
- code: 'TRANSLATION-07',
81
- messageKey: 'errors.translation.findFailed',
82
- },
83
- required: {
84
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
85
- code: 'TRANSLATION-08',
86
- messageKey: 'errors.translation.required',
87
- },
88
- },
89
- translate: {
90
- failed: {
91
- statusCode: 500, // HttpStatus.INTERNAL_SERVER_ERROR,
92
- code: 'TRANSLATE-01',
93
- messageKey: 'errors.translate.failed',
94
- },
95
- },
96
- user: {
97
- notFound: {
98
- statusCode: 404, // HttpStatus.NOT_FOUND,
99
- code: 'USER-01',
100
- messageKey: 'errors.user.notFound',
101
- },
102
- alreadyExists: {
103
- statusCode: 409, // HttpStatus.CONFLICT,
104
- code: 'USER-02',
105
- messageKey: 'errors.user.alreadyExists',
106
- },
107
- },
108
- role: {
109
- notFound: {
110
- statusCode: 404, // HttpStatus.NOT_FOUND,
111
- code: 'ROLE-01',
112
- messageKey: 'errors.role.notFound',
113
- },
114
- cannotDeleteDefault: {
115
- statusCode: 400, // HttpStatus.BAD_REQUEST,
116
- code: 'ROLE-02',
117
- messageKey: 'errors.role.cannotDeleteDefault',
118
- },
119
- },
120
- permission: {
121
- notFound: {
122
- statusCode: 404, // HttpStatus.NOT_FOUND,
123
- code: 'PERMISSION-01',
124
- messageKey: 'errors.permission.notFound',
125
- },
126
- },
127
- hotel: {
128
- notFound: {
129
- statusCode: 404, // HttpStatus.NOT_FOUND,
130
- code: 'HOTEL-01',
131
- messageKey: 'errors.hotel.notFound',
132
- },
133
- alreadyExists: {
134
- statusCode: 409, // HttpStatus.CONFLICT,
135
- code: 'HOTEL-02',
136
- messageKey: 'errors.hotel.alreadyExists',
137
- },
138
- },
139
- roomCategory: {
140
- notFound: {
141
- statusCode: 404, // HttpStatus.NOT_FOUND,
142
- code: 'ROOM-CATEGORY-01',
143
- messageKey: 'errors.roomCategory.notFound',
144
- },
145
- alreadyExists: {
146
- statusCode: 409, // HttpStatus.CONFLICT,
147
- code: 'ROOM-CATEGORY-02',
148
- messageKey: 'errors.roomCategory.alreadyExists',
149
- },
150
- },
151
- room: {
152
- notFound: {
153
- statusCode: 404, // HttpStatus.NOT_FOUND,
154
- code: 'ROOM-01',
155
- messageKey: 'errors.room.notFound',
156
- },
157
- },
158
-
159
- page: {
160
- notFound: {
161
- statusCode: 404,
162
- code: 'PAGE-01',
163
- messageKey: 'errors.page.notFound',
164
- },
165
- draft: {
166
- statusCode: 404,
167
- code: 'PAGE-02',
168
- messageKey: 'errors.page.draft',
169
- },
170
- inactive: {
171
- statusCode: 404,
172
- code: 'PAGE-03',
173
- messageKey: 'errors.page.inactive',
174
- },
175
- alreadyExists: {
176
- statusCode: 409,
177
- code: 'PAGE-04',
178
- messageKey: 'errors.page.alreadyExists',
179
- },
180
- createFailed: {
181
- statusCode: 500,
182
- code: 'PAGE-05',
183
- messageKey: 'errors.page.createFailed',
184
- },
185
- updateFailed: {
186
- statusCode: 500,
187
- code: 'PAGE-06',
188
- messageKey: 'errors.page.updateFailed',
189
- },
190
- deleteFailed: {
191
- statusCode: 500,
192
- code: 'PAGE-07',
193
- messageKey: 'errors.page.deleteFailed',
194
- },
195
- findFailed: {
196
- statusCode: 500,
197
- code: 'PAGE-08',
198
- messageKey: 'errors.page.findFailed',
199
- },
200
- },
201
- } as const;
202
-
203
- interface IError {
204
- statusCode: number;
205
- code: string;
206
- messageKey: string;
207
- }
208
-
209
- export type TMappedErrors<T extends Record<string, unknown>> = {
210
- [k in keyof T]: T[k] extends Record<string, unknown>
211
- ? T[k] extends IError
212
- ? T[k]
213
- : TMappedErrors<T[k]>
214
- : never;
215
- }[keyof T];
216
- export type TAppError = TMappedErrors<typeof APP_ERRORS>;
217
- export type TAppErrorCode = TAppError['code'];
218
- export type TAppErrorMessageKey = TAppError['messageKey'];
219
-
220
- export interface IBaseErrorDetails {
221
- type?: string;
222
- message?: string;
223
- messageKey?: string;
224
- params?: Record<string, unknown>;
225
- }
226
-
227
- export interface IErrorDetails extends IBaseErrorDetails {
228
- [key: string]: string | IErrorDetails | IErrorDetails[] | Record<string, unknown> | undefined;
229
- }
230
- export type TAppErrorDetails = Record<string, IErrorDetails | IErrorDetails[]>;
231
-
232
- export type TAppErrorWithDetails = TAppError & {
233
- message?: string;
234
- details?: TAppErrorDetails;
235
- };
@@ -1,26 +0,0 @@
1
- export namespace AppStatuses {
2
- export const COMMON = {
3
- active: 'active',
4
- disabled: 'disabled',
5
- } as const;
6
- export type TCommon = (typeof COMMON)[keyof typeof COMMON];
7
- export const COMMON_VALUES = Object.values(COMMON) as [TCommon];
8
-
9
- export const HOTEL = {
10
- ...COMMON,
11
- pending: 'pending',
12
- maintenance: 'maintenance',
13
- archived: 'archived',
14
- } as const;
15
- export type THotel = (typeof HOTEL)[keyof typeof HOTEL];
16
- export const HOTEL_VALUES = Object.values(HOTEL) as [THotel];
17
-
18
- export const PAGE = {
19
- ...COMMON,
20
- draft: 'draft',
21
- scheduled: 'scheduled',
22
- archived: 'archived',
23
- } as const;
24
- export type TPage = (typeof PAGE)[keyof typeof PAGE];
25
- export const PAGE_VALUES = Object.values(PAGE) as [TPage];
26
- }
@@ -1 +0,0 @@
1
- export const ARRAY_SPLITTER = ',';
@@ -1,5 +0,0 @@
1
- export const DEFAULT_PAGINATION_CONFIG = {
2
- page: 1,
3
- pageSize: 10,
4
- maxPageSize: 500,
5
- };
@@ -1,8 +0,0 @@
1
- import { minLength } from 'zod';
2
-
3
- export const DOMAIN_NAME_CONFIG = {
4
- minLength: 1,
5
- maxLength: 253,
6
- regex: /^(?!-)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i,
7
- messageKey: 'zod.domainName.invalidFormat',
8
- } as const;
@@ -1,10 +0,0 @@
1
- export const ENTITIES = {
2
- user: 'user',
3
- role: 'role',
4
- permission: 'permission',
5
- hotel: 'hotel',
6
- room: 'room',
7
- roomCategory: 'roomCategory',
8
- } as const;
9
- export type TEntity = (typeof ENTITIES)[keyof typeof ENTITIES];
10
- export const ENTITY_VALUES = Object.values(ENTITIES) as [TEntity, ...TEntity[]];
@@ -1,9 +0,0 @@
1
- export const HTTP_METHODS = {
2
- get: 'GET',
3
- post: 'POST',
4
- put: 'PUT',
5
- patch: 'PATCH',
6
- delete: 'DELETE',
7
- } as const;
8
-
9
- export type THttpMethod = (typeof HTTP_METHODS)[keyof typeof HTTP_METHODS];
@@ -1,85 +0,0 @@
1
- export const ICON_KEYS = {
2
- //interface
3
- chevronDown: 'chevronDown',
4
- chevronLeft: 'chevronLeft',
5
- chevronRight: 'chevronRight',
6
- arrowDown: 'arrowDown',
7
- arrowUp: 'arrowUp',
8
- arrowLeft: 'arrowLeft',
9
- ellipsis: 'ellipsis',
10
- plus: 'plus',
11
- moon: 'moon',
12
- sun: 'sun',
13
- menu: 'menu',
14
- filter: 'filter',
15
- resetFilter: 'resetFilter',
16
- sorting: 'sorting',
17
- circlePlus: 'circlePlus',
18
- squarePen: 'squarePen',
19
- trash: 'trash',
20
- search: 'search',
21
- language: 'language',
22
- magic: 'magic',
23
- play: 'play',
24
- clock: 'clock',
25
- // logos
26
- logo: 'logo',
27
- accorLogo: 'accorLogo',
28
- ibisLogo: 'ibisLogo',
29
- yandexTravelLogo: 'yandexTravelLogo',
30
- ostrovokLogo: 'ostrovokLogo',
31
- oneTwoTripLogo: 'oneTwoTripLogo',
32
- hotel101Logo: 'hotel101Logo',
33
- twoGisLogo: 'twoGisLogo',
34
- // advantages
35
- location: 'location',
36
- hotel: 'hotel',
37
- breakfast: 'breakfast',
38
- pets: 'pets',
39
- room: 'room',
40
- sweetBed: 'sweetBed',
41
- meeting: 'meeting',
42
- qualityStandards: 'qualityStandards',
43
- parking: 'parking',
44
- banqueting: 'banqueting',
45
- bar: 'bar',
46
- //room
47
- guests: 'guests',
48
- roomSquareMeter: 'roomSquareMeter',
49
- beds: 'beds',
50
- //amenities
51
- wifi: 'wifi',
52
- tv: 'tv',
53
- airConditioning: 'airConditioning',
54
- shower: 'shower',
55
- toiletries: 'toiletries',
56
- bathrobe: 'bathrobe',
57
- slippers: 'slippers',
58
- safe: 'safe',
59
- wardrobe: 'wardrobe',
60
- bed: 'bed',
61
- sofa: 'sofa',
62
- hairdryer: 'hairdryer',
63
- miniFridge: 'miniFridge',
64
- kettle: 'kettle',
65
- teaStation: 'teaStation',
66
- fridge: 'fridge',
67
- //conference
68
- conferenceSeatingTheatre: 'conferenceSeatingTheatre',
69
- conferenceSeatingClass: 'conferenceSeatingClass',
70
- conferenceSeatingUShape: 'conferenceSeatingUShape',
71
- conferenceSeatingCircle: 'conferenceSeatingCircle',
72
- conferenceSeatingBanquet: 'conferenceSeatingBanquet',
73
-
74
- flagGB: 'flagGB',
75
- flagRU: 'flagRU',
76
- } as const;
77
- export type TIconKey = (typeof ICON_KEYS)[keyof typeof ICON_KEYS];
78
- export const ICON_KEY_VALUES = Object.values(ICON_KEYS) as [TIconKey];
79
-
80
- export const ICON_POSITION = {
81
- start: 'start',
82
- end: 'end',
83
- } as const;
84
- export type TIconPosition = (typeof ICON_POSITION)[keyof typeof ICON_POSITION];
85
- export const ICON_POSITION_VALUES = Object.values(ICON_POSITION) as [TIconPosition];
@@ -1,18 +0,0 @@
1
- export * from './app-ability.constant';
2
- export * from './array-splitter.constant';
3
- export * from './app-errors.constant';
4
- export * from './app-statuses.constant';
5
- export * from './default-pagination-config.constant';
6
- export * from './entity.constant';
7
- export * from './http-method.constant';
8
- export * from './icon.constants';
9
- export * from './kind-of-app.constant';
10
- export * from './locales.constant';
11
- export * from './navigation-item-type.constant';
12
- export * from './order-direction.constant';
13
- export * from './role-types.constant';
14
- export * from './route-component-key.constants';
15
- export * from './slug.constant';
16
- export * from './time-zone.constant';
17
- export * from './domain-name.constant';
18
- export * from './translatable-field.constant';
@@ -1,7 +0,0 @@
1
- export const KIND_OF_APP = {
2
- site: 'site',
3
- services: 'services',
4
- } as const;
5
-
6
- export type TKindOfApp = (typeof KIND_OF_APP)[keyof typeof KIND_OF_APP];
7
- export const KIND_OF_APP_VALUES = Object.values(KIND_OF_APP) as [TKindOfApp, ...TKindOfApp[]];
@@ -1,26 +0,0 @@
1
- import { ICON_KEYS } from './icon.constants';
2
-
3
- export const LANGUAGES = {
4
- en: {
5
- value: 'en',
6
- label: 'English',
7
- flag: ICON_KEYS.flagGB,
8
- locale: 'en-US',
9
- postgressLocale: 'en_US',
10
- } as const,
11
- ru: {
12
- value: 'ru',
13
- label: 'Русский',
14
- flag: ICON_KEYS.flagRU,
15
- locale: 'ru-RU',
16
- postgressLocale: 'ru_RU',
17
- } as const,
18
- } as const;
19
-
20
- export type TLanguage = keyof typeof LANGUAGES;
21
- export type TLanguageValues = (typeof LANGUAGES)[keyof typeof LANGUAGES];
22
-
23
- export type TLocale = (typeof LANGUAGES)[TLanguage]['locale'];
24
- export type TPostgresLocale = (typeof LANGUAGES)[TLanguage]['postgressLocale'];
25
-
26
- export const LANGUAGE_KEYS = Object.keys(LANGUAGES) as [TLanguage, ...TLanguage[]];
@@ -1,6 +0,0 @@
1
- export const NAVIGATION_ITEM_TYPES = {
2
- group: 'group',
3
- link: 'link',
4
- } as const;
5
- export type TNavigationItemType =
6
- (typeof NAVIGATION_ITEM_TYPES)[keyof typeof NAVIGATION_ITEM_TYPES];
@@ -1,10 +0,0 @@
1
- export const ORDER_DIRECTION = {
2
- asc: 'asc',
3
- desc: 'desc',
4
- } as const;
5
-
6
- export type TOrderDirection = (typeof ORDER_DIRECTION)[keyof typeof ORDER_DIRECTION];
7
- export const ORDER_DIRECTION_VALUES = Object.values(ORDER_DIRECTION) as [
8
- TOrderDirection,
9
- ...TOrderDirection[],
10
- ];
@@ -1,8 +0,0 @@
1
- export const ROLE_TYPES = {
2
- superAdmin: 'superAdmin',
3
- system: 'system',
4
- hotel: 'hotel',
5
- guest: 'guest',
6
- } as const;
7
- export type TRoleType = (typeof ROLE_TYPES)[keyof typeof ROLE_TYPES];
8
- export const ROLE_TYPE_VALUES = Object.values(ROLE_TYPES) as [TRoleType];
@@ -1,5 +0,0 @@
1
- export const ROUTE_COMPONENT_KEYS = {
2
- NavigationItem: 'navigation-item',
3
- } as const;
4
-
5
- export type TRouteComponentKey = (typeof ROUTE_COMPONENT_KEYS)[keyof typeof ROUTE_COMPONENT_KEYS];
@@ -1,8 +0,0 @@
1
- import { maxLength } from 'zod';
2
-
3
- export const SLUG_CONFIG = {
4
- maxLength: 63,
5
- minLength: 3,
6
- regex: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
7
- messageKey: 'zod.slug.invalidFormat',
8
- } as const;
@@ -1,4 +0,0 @@
1
- export const TIME_ZONE_CONFIG = {
2
- regex: /^[A-Za-z]+(?:[_-][A-Za-z]+)?\/[A-Za-z]+(?:[_-][A-Za-z]+)?$/,
3
- messageKey: 'zod.timezone.invalidFormat',
4
- } as const;
@@ -1,10 +0,0 @@
1
- export const TRANSLATABLE_FIELDS = {
2
- name: 'name',
3
- description: 'description',
4
- } as const;
5
-
6
- export type TTranslatableField = (typeof TRANSLATABLE_FIELDS)[keyof typeof TRANSLATABLE_FIELDS];
7
- export const TRANSLATABLE_FIELD_VALUES = Object.values(TRANSLATABLE_FIELDS) as [
8
- TTranslatableField,
9
- ...TTranslatableField[],
10
- ];
package/common/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './constants';
2
- export * from './models';
3
- // export * from './transforms';
4
- export * from './types';
5
- export * from './utils';
@@ -1,8 +0,0 @@
1
- import * as z from 'zod';
2
-
3
- export const BooleanQueryParamSchema = z.union([z.boolean(), z.string()]).transform(value => {
4
- if (typeof value === 'boolean') return value;
5
- const v = value.trim().toLowerCase();
6
- if (v === 'true' || v === '1' || v === 'yes') return true;
7
- if (v === 'false' || v === '0' || v === 'no') return false;
8
- });
@@ -1,10 +0,0 @@
1
- import * as z from 'zod';
2
- import { OrderSchema } from './order.schema';
3
- import { PaginationRequestSchema } from './pagination.schema';
4
- import { SearchSchema } from './search.schema';
5
-
6
- export const CommonQueryParamsSchema = OrderSchema.extend({
7
- ...SearchSchema.shape,
8
- ...PaginationRequestSchema.shape,
9
- });
10
- export type TCommonQueryParams = z.infer<typeof CommonQueryParamsSchema>;
@@ -1,14 +0,0 @@
1
- import * as z from 'zod';
2
- import { DOMAIN_NAME_CONFIG } from '../constants';
3
-
4
- export const DomainNameSchema = z
5
- .string()
6
- .min(DOMAIN_NAME_CONFIG.minLength)
7
- .max(DOMAIN_NAME_CONFIG.maxLength)
8
- .refine(value => DOMAIN_NAME_CONFIG.regex.test(value), {
9
- params: {
10
- messageKey: DOMAIN_NAME_CONFIG.messageKey,
11
- },
12
- });
13
-
14
- export type TDomainName = z.infer<typeof DomainNameSchema>;
@@ -1,4 +0,0 @@
1
- import * as z from 'zod';
2
- import { ICON_KEY_VALUES } from '../constants';
3
-
4
- export const IconKeySchema = z.enum(ICON_KEY_VALUES);
@@ -1,15 +0,0 @@
1
- export * from './boolean-query-param.schema';
2
- export * from './common-query-params.schema';
3
- export * from './icon-key.schema';
4
- export * from './info.schema';
5
- export * from './navigation-item.schemas';
6
- export * from './order.schema';
7
- export * from './pagination.schema';
8
- export * from './search.schema';
9
- export * from './slug.schema';
10
- export * from './timestamp.schemas';
11
- export * from './timezone.schema';
12
- export * from './language-keys.schema';
13
- export * from './translations.schemas';
14
- export * from './uuid.schemas';
15
- export * from './domain-name.schema';
@@ -1,8 +0,0 @@
1
- import * as z from 'zod';
2
- import { IconKeySchema } from './icon-key.schema';
3
-
4
- export const InfoSchema = z.object({
5
- iconKey: IconKeySchema.optional(),
6
- title: z.string().min(1),
7
- description: z.string().min(1),
8
- });
@@ -1,4 +0,0 @@
1
- import * as z from 'zod';
2
- import { LANGUAGE_KEYS } from '../constants';
3
-
4
- export const LanguageKeysSchema = z.enum(LANGUAGE_KEYS);
@@ -1,29 +0,0 @@
1
- import * as z from 'zod';
2
- import { ROUTE_COMPONENT_KEYS } from '../constants';
3
- import { NAVIGATION_ITEM_TYPES } from '../constants';
4
- import { IconKeySchema } from './icon-key.schema';
5
- import { TimestampSchema } from './timestamp.schemas';
6
-
7
- export const NavigationItemEntityBaseSchema = z
8
- .object({
9
- id: z.number().int().positive(),
10
- parentId: z.nullable(z.number().int().positive()),
11
- label: z.string().min(1),
12
- description: z.nullable(z.string().min(1)),
13
- iconKey: z.nullable(IconKeySchema),
14
- link: z.nullable(z.string().min(1)),
15
- routeComponentKey: z.nullable(z.enum(ROUTE_COMPONENT_KEYS)),
16
- type: z.enum(NAVIGATION_ITEM_TYPES),
17
- disabled: z.boolean(),
18
- order: z.number().int().positive(),
19
- })
20
- .extend(TimestampSchema.shape);
21
-
22
- export type TNavigationItemEntityBase = z.infer<typeof NavigationItemEntityBaseSchema>;
23
- export type TNavigationItemEntity = TNavigationItemEntityBase & {
24
- children?: TNavigationItemEntity[];
25
- };
26
- export const NavigationItemEntitySchema: z.ZodType<TNavigationItemEntity> =
27
- NavigationItemEntityBaseSchema.extend({
28
- children: z.lazy(() => z.array(NavigationItemEntitySchema).optional()),
29
- });
@@ -1,7 +0,0 @@
1
- import * as z from 'zod';
2
- import { ORDER_DIRECTION_VALUES } from '../constants/order-direction.constant';
3
-
4
- export const OrderSchema = z.object({
5
- orderBy: z.string().optional(),
6
- orderDir: z.enum(ORDER_DIRECTION_VALUES).optional(),
7
- });
@@ -1,18 +0,0 @@
1
- import * as z from 'zod';
2
- import { DEFAULT_PAGINATION_CONFIG } from '../constants';
3
-
4
- export const PaginationResponseSchema = z.object({
5
- page: z.coerce.number().positive(),
6
- pageSize: z.coerce.number().positive(),
7
- total: z.coerce.number().nonnegative(),
8
- });
9
-
10
- export const PaginationRequestSchema = z.object({
11
- page: z.coerce.number().positive().optional().default(DEFAULT_PAGINATION_CONFIG.page),
12
- pageSize: z.coerce
13
- .number()
14
- .positive()
15
- .optional()
16
- .default(DEFAULT_PAGINATION_CONFIG.pageSize)
17
- .transform(val => Math.min(val, DEFAULT_PAGINATION_CONFIG.maxPageSize)),
18
- });
@@ -1,5 +0,0 @@
1
- import * as z from 'zod';
2
-
3
- export const SearchSchema = z.object({
4
- searchText: z.string().min(1).optional(),
5
- });
@@ -1,14 +0,0 @@
1
- import * as z from 'zod';
2
- import { SLUG_CONFIG } from '../constants';
3
-
4
- export const SlugSchema = z
5
- .string()
6
- .trim()
7
- .min(SLUG_CONFIG.minLength)
8
- .max(SLUG_CONFIG.maxLength)
9
- .refine(value => SLUG_CONFIG.regex.test(value), {
10
- params: {
11
- messageKey: SLUG_CONFIG.messageKey,
12
- },
13
- })
14
- .toLowerCase();