hh-contracts 0.0.96 → 0.0.97

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 (107) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/app-menu/get.query.ts +2 -2
  3. package/build/app-menu/get.query.js +1 -1
  4. package/build/common/constants/domain-name.constant.js +9 -0
  5. package/build/common/constants/index.js +2 -0
  6. package/build/common/constants/slug.constant.js +1 -0
  7. package/build/common/constants/time-zone.constant.js +7 -0
  8. package/build/common/models/domain-name.schema.js +8 -4
  9. package/build/common/models/index.js +1 -1
  10. package/build/common/models/slug.schema.js +5 -1
  11. package/build/common/models/timezone.schema.js +3 -4
  12. package/build/common/models/{uuid-array.schema.js → uuid.schemas.js} +3 -2
  13. package/build/companies/company.models.js +1 -1
  14. package/build/hotels/amenities/hotel-amenity.model.js +2 -1
  15. package/build/hotels/constants/hotel-integration-connection-state.constant.js +10 -0
  16. package/build/hotels/constants/hotel-integration-credential-status.constant.js +9 -0
  17. package/build/hotels/constants/hotel-integration-sync-status.constant.js +10 -0
  18. package/build/hotels/constants/index.js +3 -0
  19. package/build/hotels/contacts/hotel-contact.model.js +1 -1
  20. package/build/hotels/contracts/create-hotel.contract.js +2 -7
  21. package/build/hotels/contracts/find-hotel.contract.js +4 -4
  22. package/build/hotels/contracts/update-hotel.contract.js +1 -1
  23. package/build/hotels/domains/contracts/find-hotel-domain-settings.contract.js +13 -0
  24. package/build/hotels/domains/contracts/update-hotel-domain-settings.contract.js +14 -0
  25. package/build/hotels/domains/hotel-domains.api.js +12 -0
  26. package/build/hotels/{settings/hotel-domain-settings.schema.js → domains/hotel-domains.schema.js} +6 -6
  27. package/build/hotels/{settings → domains}/index.js +2 -2
  28. package/build/hotels/hotel.models.js +15 -11
  29. package/build/hotels/hotels.api.js +8 -2
  30. package/build/hotels/index.js +1 -1
  31. package/build/hotels/integrations/configs/index.js +17 -0
  32. package/build/hotels/integrations/configs/opera-integration-config.model.js +41 -0
  33. package/build/hotels/integrations/contracts/create-hotel-integration.contract.js +14 -0
  34. package/build/hotels/integrations/contracts/delete-hotel-integration.contract.js +46 -0
  35. package/build/hotels/integrations/contracts/find-all-hotel-integrations.contract.js +47 -0
  36. package/build/hotels/integrations/contracts/find-hotel-integration.contract.js +13 -0
  37. package/build/hotels/integrations/contracts/index.js +21 -0
  38. package/build/hotels/integrations/contracts/update-hotel-integration.contract.js +14 -0
  39. package/build/hotels/integrations/hotel-integration.model.js +43 -5
  40. package/build/hotels/integrations/hotel-integrations.api.js +1 -1
  41. package/build/hotels/integrations/index.js +1 -0
  42. package/build/permissions/contracts/create-permission.contract.js +2 -6
  43. package/build/permissions/contracts/find-permission.contract.js +1 -1
  44. package/build/permissions/contracts/update-permission.contract.js +1 -1
  45. package/build/permissions/permission.models.js +12 -9
  46. package/build/roles/contracts/create-role.contract.js +2 -6
  47. package/build/roles/contracts/find-role.contract.js +1 -1
  48. package/build/roles/contracts/update-role.contract.js +1 -1
  49. package/build/roles/role.models.js +14 -11
  50. package/common/constants/domain-name.constant.ts +8 -0
  51. package/common/constants/index.ts +2 -0
  52. package/common/constants/slug.constant.ts +2 -1
  53. package/common/constants/time-zone.constant.ts +4 -0
  54. package/common/models/domain-name.schema.ts +8 -9
  55. package/common/models/index.ts +1 -1
  56. package/common/models/slug.schema.ts +5 -1
  57. package/common/models/timezone.schema.ts +6 -7
  58. package/common/models/uuid.schemas.ts +4 -0
  59. package/companies/company.models.ts +2 -2
  60. package/hotels/amenities/hotel-amenity.model.ts +2 -1
  61. package/hotels/constants/hotel-integration-connection-state.constant.ts +13 -0
  62. package/hotels/constants/hotel-integration-credential-status.constant.ts +12 -0
  63. package/hotels/constants/hotel-integration-sync-status.constant.ts +13 -0
  64. package/hotels/constants/index.ts +3 -0
  65. package/hotels/contacts/hotel-contact.model.ts +2 -2
  66. package/hotels/contracts/create-hotel.contract.ts +3 -8
  67. package/hotels/contracts/find-hotel.contract.ts +12 -7
  68. package/hotels/contracts/update-hotel.contract.ts +2 -2
  69. package/hotels/domains/contracts/find-hotel-domain-settings.contract.ts +13 -0
  70. package/hotels/domains/contracts/update-hotel-domain-settings.contract.ts +16 -0
  71. package/hotels/domains/hotel-domains.api.ts +11 -0
  72. package/hotels/domains/hotel-domains.schema.ts +25 -0
  73. package/hotels/domains/index.ts +3 -0
  74. package/hotels/hotel.models.ts +31 -21
  75. package/hotels/hotels.api.ts +8 -1
  76. package/hotels/index.ts +1 -1
  77. package/hotels/integrations/configs/index.ts +1 -0
  78. package/hotels/integrations/configs/opera-integration-config.model.ts +6 -0
  79. package/hotels/integrations/contracts/create-hotel-integration.contract.ts +21 -0
  80. package/hotels/integrations/contracts/delete-hotel-integration.contract.ts +14 -0
  81. package/hotels/integrations/contracts/find-all-hotel-integrations.contract.ts +15 -0
  82. package/hotels/integrations/contracts/find-hotel-integration.contract.ts +15 -0
  83. package/hotels/integrations/contracts/index.ts +5 -0
  84. package/hotels/integrations/contracts/update-hotel-integration.contract.ts +21 -0
  85. package/hotels/integrations/hotel-integration.model.ts +60 -9
  86. package/hotels/integrations/hotel-integrations.api.ts +1 -1
  87. package/hotels/integrations/index.ts +1 -0
  88. package/package.json +1 -1
  89. package/permissions/contracts/create-permission.contract.ts +3 -7
  90. package/permissions/contracts/find-permission.contract.ts +2 -2
  91. package/permissions/contracts/update-permission.contract.ts +2 -2
  92. package/permissions/permission.models.ts +18 -13
  93. package/roles/contracts/create-role.contract.ts +3 -7
  94. package/roles/contracts/find-role.contract.ts +2 -2
  95. package/roles/contracts/update-role.contract.ts +2 -2
  96. package/roles/role.models.ts +26 -15
  97. package/build/hotels/settings/contracts/find-hotel-domain-settings.contract.js +0 -13
  98. package/build/hotels/settings/contracts/update-hotel-domain-settings.contract.js +0 -14
  99. package/build/hotels/settings/hotel-domain-settings.api.js +0 -12
  100. package/common/models/uuid-array.schema.ts +0 -3
  101. package/hotels/settings/contracts/find-hotel-domain-settings.contract.ts +0 -13
  102. package/hotels/settings/contracts/update-hotel-domain-settings.contract.ts +0 -19
  103. package/hotels/settings/hotel-domain-settings.api.ts +0 -11
  104. package/hotels/settings/hotel-domain-settings.schema.ts +0 -24
  105. package/hotels/settings/index.ts +0 -3
  106. /package/build/hotels/{settings → domains}/contracts/index.js +0 -0
  107. /package/hotels/{settings → domains}/contracts/index.ts +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+ - Расширены модели интеграций отелей: добавлены схемы маршрутизации, состояния подключений и статусы учётных данных для поддержки брокерного обмена.
5
+ - Контракт поиска интеграций переименован в `findAll`, запрос теперь поддерживает только фильтр по `alias` без пагинации.
@@ -1,8 +1,8 @@
1
1
  import * as z from 'zod';
2
- import { NavigationItemEntitySchema } from '../common';
2
+ import { NavigationItemEntitySchema, UuidSchema } from '../common';
3
3
 
4
4
  const GetAppMenuQueryRequestSchema = z.object({
5
- userUuid: z.uuid(),
5
+ userUuid: UuidSchema,
6
6
  });
7
7
  const GetAppMenuQueryResponseSchema = z.object({
8
8
  appMenu: z.array(NavigationItemEntitySchema),
@@ -37,7 +37,7 @@ exports.GetAppMenuQuery = void 0;
37
37
  const z = __importStar(require("zod"));
38
38
  const common_1 = require("../common");
39
39
  const GetAppMenuQueryRequestSchema = z.object({
40
- userUuid: z.uuid(),
40
+ userUuid: common_1.UuidSchema,
41
41
  });
42
42
  const GetAppMenuQueryResponseSchema = z.object({
43
43
  appMenu: z.array(common_1.NavigationItemEntitySchema),
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DOMAIN_NAME_CONFIG = void 0;
4
+ exports.DOMAIN_NAME_CONFIG = {
5
+ minLength: 1,
6
+ maxLength: 253,
7
+ regex: /^(?!-)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i,
8
+ messageKey: 'zod.domainName.invalidFormat',
9
+ };
@@ -28,4 +28,6 @@ __exportStar(require("./order-direction.constant"), exports);
28
28
  __exportStar(require("./role-types.constant"), exports);
29
29
  __exportStar(require("./route-component-key.constants"), exports);
30
30
  __exportStar(require("./slug.constant"), exports);
31
+ __exportStar(require("./time-zone.constant"), exports);
32
+ __exportStar(require("./domain-name.constant"), exports);
31
33
  __exportStar(require("./translatable-field.constant"), exports);
@@ -5,4 +5,5 @@ exports.SLUG_CONFIG = {
5
5
  maxLength: 63,
6
6
  minLength: 3,
7
7
  regex: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
8
+ messageKey: 'zod.slug.invalidFormat',
8
9
  };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TIME_ZONE_CONFIG = void 0;
4
+ exports.TIME_ZONE_CONFIG = {
5
+ regex: /^[A-Za-z]+(?:[_-][A-Za-z]+)?\/[A-Za-z]+(?:[_-][A-Za-z]+)?$/,
6
+ messageKey: 'zod.timezone.invalidFormat',
7
+ };
@@ -35,9 +35,13 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.DomainNameSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
- const DOMAIN_NAME_REGEXP = /^(?!-)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i;
38
+ const constants_1 = require("../constants");
39
39
  exports.DomainNameSchema = z
40
40
  .string()
41
- .min(1)
42
- .max(253)
43
- .regex(DOMAIN_NAME_REGEXP, 'Domain must be a valid hostname like example.com or app.example.com');
41
+ .min(constants_1.DOMAIN_NAME_CONFIG.minLength)
42
+ .max(constants_1.DOMAIN_NAME_CONFIG.maxLength)
43
+ .refine(value => constants_1.DOMAIN_NAME_CONFIG.regex.test(value), {
44
+ params: {
45
+ messageKey: constants_1.DOMAIN_NAME_CONFIG.messageKey,
46
+ },
47
+ });
@@ -26,5 +26,5 @@ __exportStar(require("./timestamp.schemas"), exports);
26
26
  __exportStar(require("./timezone.schema"), exports);
27
27
  __exportStar(require("./language-keys.schema"), exports);
28
28
  __exportStar(require("./translations.schemas"), exports);
29
- __exportStar(require("./uuid-array.schema"), exports);
29
+ __exportStar(require("./uuid.schemas"), exports);
30
30
  __exportStar(require("./domain-name.schema"), exports);
@@ -41,5 +41,9 @@ exports.SlugSchema = z
41
41
  .trim()
42
42
  .min(constants_1.SLUG_CONFIG.minLength)
43
43
  .max(constants_1.SLUG_CONFIG.maxLength)
44
- .regex(constants_1.SLUG_CONFIG.regex)
44
+ .refine(value => constants_1.SLUG_CONFIG.regex.test(value), {
45
+ params: {
46
+ messageKey: constants_1.SLUG_CONFIG.messageKey,
47
+ },
48
+ })
45
49
  .toLowerCase();
@@ -35,10 +35,9 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.TimezoneSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
- exports.TimezoneSchema = z
39
- .string()
40
- .refine(value => /^[A-Za-z]+(?:[_-][A-Za-z]+)?\/[A-Za-z]+(?:[_-][A-Za-z]+)?$/.test(value), {
38
+ const constants_1 = require("../constants");
39
+ exports.TimezoneSchema = z.string().refine(value => constants_1.TIME_ZONE_CONFIG.regex.test(value), {
41
40
  params: {
42
- messageKey: 'z.timezone.invalidFormat',
41
+ messageKey: constants_1.TIME_ZONE_CONFIG.messageKey,
43
42
  },
44
43
  });
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.UuidArraySchema = void 0;
36
+ exports.UuidArraySchema = exports.UuidSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
- exports.UuidArraySchema = z.array(z.uuid());
38
+ exports.UuidSchema = z.uuid();
39
+ exports.UuidArraySchema = z.array(exports.UuidSchema);
@@ -38,7 +38,7 @@ const z = __importStar(require("zod"));
38
38
  const common_1 = require("../common");
39
39
  exports.CompanyPersistedSchema = z
40
40
  .object({
41
- id: z.uuid(),
41
+ id: common_1.UuidSchema,
42
42
  inn: z.string(),
43
43
  isActive: z.boolean().default(true),
44
44
  })
@@ -36,8 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.HotelAmenitySchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
38
  const constants_1 = require("../constants");
39
+ const common_1 = require("../../common");
39
40
  exports.HotelAmenitySchema = z.object({
40
- hotelId: z.uuid(),
41
+ hotelId: common_1.UuidSchema,
41
42
  amenityCode: z.enum(constants_1.HOTEL_AMENITY_VALUES),
42
43
  isPrimary: z.boolean().default(false),
43
44
  });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HOTEL_INTEGRATION_CONNECTION_STATE_VALUES = exports.HOTEL_INTEGRATION_CONNECTION_STATES = void 0;
4
+ exports.HOTEL_INTEGRATION_CONNECTION_STATES = {
5
+ offline: 'offline',
6
+ connecting: 'connecting',
7
+ online: 'online',
8
+ degraded: 'degraded',
9
+ };
10
+ exports.HOTEL_INTEGRATION_CONNECTION_STATE_VALUES = Object.values(exports.HOTEL_INTEGRATION_CONNECTION_STATES);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HOTEL_INTEGRATION_CREDENTIAL_STATUS_VALUES = exports.HOTEL_INTEGRATION_CREDENTIAL_STATUSES = void 0;
4
+ exports.HOTEL_INTEGRATION_CREDENTIAL_STATUSES = {
5
+ active: 'active',
6
+ rotating: 'rotating',
7
+ revoked: 'revoked',
8
+ };
9
+ exports.HOTEL_INTEGRATION_CREDENTIAL_STATUS_VALUES = Object.values(exports.HOTEL_INTEGRATION_CREDENTIAL_STATUSES);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HOTEL_INTEGRATION_SYNC_STATUS_VALUES = exports.HOTEL_INTEGRATION_SYNC_STATUSES = void 0;
4
+ exports.HOTEL_INTEGRATION_SYNC_STATUSES = {
5
+ idle: 'idle',
6
+ running: 'running',
7
+ success: 'success',
8
+ failed: 'failed',
9
+ };
10
+ exports.HOTEL_INTEGRATION_SYNC_STATUS_VALUES = Object.values(exports.HOTEL_INTEGRATION_SYNC_STATUSES);
@@ -17,6 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./hotel-amenity.constant"), exports);
18
18
  __exportStar(require("./hotel-contact-type.constant"), exports);
19
19
  __exportStar(require("./hotel-feature.constant"), exports);
20
+ __exportStar(require("./hotel-integration-connection-state.constant"), exports);
21
+ __exportStar(require("./hotel-integration-credential-status.constant"), exports);
20
22
  __exportStar(require("./hotel-integration-provider.constant"), exports);
23
+ __exportStar(require("./hotel-integration-sync-status.constant"), exports);
21
24
  __exportStar(require("./hotel-policy-type.constant"), exports);
22
25
  __exportStar(require("./hotel-rating-source.constant"), exports);
@@ -39,7 +39,7 @@ const constants_1 = require("../constants");
39
39
  const common_1 = require("../../common");
40
40
  exports.HotelContactSchema = z
41
41
  .object({
42
- hotelId: z.uuid(),
42
+ hotelId: common_1.UuidSchema,
43
43
  contactType: z.enum(constants_1.HOTEL_CONTACT_TYPE_VALUES),
44
44
  value: z.string().min(1),
45
45
  isPublic: z.boolean().default(true),
@@ -9,11 +9,6 @@ var CreateHotelContract;
9
9
  CreateHotelContract.getUrl = hotels_api_1.HOTELS_API.create;
10
10
  CreateHotelContract.endpoint = hotels_api_1.HOTELS_CONTROLLER.endpoints.create;
11
11
  CreateHotelContract.httpMethod = common_1.HTTP_METHODS.post;
12
- CreateHotelContract.RequestSchema = hotel_models_1.HotelWithTranslationsSchema.omit({
13
- id: true,
14
- version: true,
15
- createdAt: true,
16
- updatedAt: true,
17
- });
18
- CreateHotelContract.ResponseSchema = hotel_models_1.HotelWithTranslationsSchema;
12
+ CreateHotelContract.RequestSchema = hotel_models_1.HotelWriteSchema;
13
+ CreateHotelContract.ResponseSchema = hotel_models_1.HotelDetailSchema;
19
14
  })(CreateHotelContract || (exports.CreateHotelContract = CreateHotelContract = {}));
@@ -9,12 +9,12 @@ var FindHotelByIdContract;
9
9
  FindHotelByIdContract.getUrl = hotels_api_1.HOTELS_API.findById;
10
10
  FindHotelByIdContract.endpoint = hotels_api_1.HOTELS_CONTROLLER.endpoints.findById;
11
11
  FindHotelByIdContract.httpMethod = common_1.HTTP_METHODS.get;
12
- FindHotelByIdContract.ResponseSchema = hotel_models_1.HotelWithTranslationsSchema;
12
+ FindHotelByIdContract.ResponseSchema = hotel_models_1.HotelDetailSchema;
13
13
  })(FindHotelByIdContract || (exports.FindHotelByIdContract = FindHotelByIdContract = {}));
14
14
  var FindHotelBySlugContract;
15
15
  (function (FindHotelBySlugContract) {
16
- FindHotelBySlugContract.getUrl = hotels_api_1.HOTELS_API.findBySlug;
17
- FindHotelBySlugContract.endpoint = hotels_api_1.HOTELS_CONTROLLER.endpoints.findBySlug;
16
+ FindHotelBySlugContract.getUrl = hotels_api_1.HOTELS_BY_SLUG_API.find;
17
+ FindHotelBySlugContract.endpoint = hotels_api_1.HOTELS_BY_SLUG_CONTROLLER.endpoints.find;
18
18
  FindHotelBySlugContract.httpMethod = common_1.HTTP_METHODS.get;
19
- FindHotelBySlugContract.ResponseSchema = hotel_models_1.HotelWithTranslationsSchema;
19
+ FindHotelBySlugContract.ResponseSchema = hotel_models_1.HotelDetailSchema;
20
20
  })(FindHotelBySlugContract || (exports.FindHotelBySlugContract = FindHotelBySlugContract = {}));
@@ -11,5 +11,5 @@ var UpdateHotelContract;
11
11
  UpdateHotelContract.endpoint = hotels_api_1.HOTELS_CONTROLLER.endpoints.updateById;
12
12
  UpdateHotelContract.httpMethod = common_1.HTTP_METHODS.put;
13
13
  UpdateHotelContract.RequestSchema = create_hotel_contract_1.CreateHotelContract.RequestSchema;
14
- UpdateHotelContract.ResponseSchema = hotel_models_1.HotelWithTranslationsSchema;
14
+ UpdateHotelContract.ResponseSchema = hotel_models_1.HotelDetailSchema;
15
15
  })(UpdateHotelContract || (exports.UpdateHotelContract = UpdateHotelContract = {}));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindHotelDomainsContract = void 0;
4
+ const common_1 = require("../../../common");
5
+ const hotel_domains_api_1 = require("../hotel-domains.api");
6
+ const hotel_domains_schema_1 = require("../hotel-domains.schema");
7
+ var FindHotelDomainsContract;
8
+ (function (FindHotelDomainsContract) {
9
+ FindHotelDomainsContract.getUrl = hotel_domains_api_1.HOTEL_DOMAINS_API.find;
10
+ FindHotelDomainsContract.endpoint = hotel_domains_api_1.HOTEL_DOMAINS_CONTROLLER.endpoints.find;
11
+ FindHotelDomainsContract.httpMethod = common_1.HTTP_METHODS.get;
12
+ FindHotelDomainsContract.ResponseSchema = hotel_domains_schema_1.HotelDomainListSchema;
13
+ })(FindHotelDomainsContract || (exports.FindHotelDomainsContract = FindHotelDomainsContract = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateHotelDomainContract = void 0;
4
+ const common_1 = require("../../../common");
5
+ const hotel_domains_api_1 = require("../hotel-domains.api");
6
+ const hotel_domains_schema_1 = require("../hotel-domains.schema");
7
+ var UpdateHotelDomainContract;
8
+ (function (UpdateHotelDomainContract) {
9
+ UpdateHotelDomainContract.getUrl = hotel_domains_api_1.HOTEL_DOMAINS_API.update;
10
+ UpdateHotelDomainContract.endpoint = hotel_domains_api_1.HOTEL_DOMAINS_CONTROLLER.endpoints.update;
11
+ UpdateHotelDomainContract.httpMethod = common_1.HTTP_METHODS.put;
12
+ UpdateHotelDomainContract.RequestSchema = hotel_domains_schema_1.HotelDomainSchema;
13
+ UpdateHotelDomainContract.ResponseSchema = hotel_domains_schema_1.HotelDomainPersistedSchema;
14
+ })(UpdateHotelDomainContract || (exports.UpdateHotelDomainContract = UpdateHotelDomainContract = {}));
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HOTEL_DOMAINS_API = exports.HOTEL_DOMAINS_CONTROLLER = void 0;
4
+ const utils_1 = require("../../common/utils");
5
+ exports.HOTEL_DOMAINS_CONTROLLER = {
6
+ prefix: 'hotels/by-id/:hotelId/domains',
7
+ endpoints: {
8
+ find: '',
9
+ update: '',
10
+ },
11
+ };
12
+ exports.HOTEL_DOMAINS_API = (0, utils_1.createApi)(exports.HOTEL_DOMAINS_CONTROLLER);
@@ -33,17 +33,17 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.HotelDomainSettingsListSchema = exports.HotelDomainSettingsPersistedSchema = exports.HotelDomainSettingsSchema = void 0;
36
+ exports.HotelDomainListSchema = exports.HotelDomainPersistedSchema = exports.HotelDomainSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
38
  const common_1 = require("../../common");
39
- exports.HotelDomainSettingsSchema = z.object({
39
+ exports.HotelDomainSchema = z.object({
40
40
  kindOfApp: z.enum(common_1.KIND_OF_APP_VALUES),
41
41
  customDomain: common_1.DomainNameSchema.optional(),
42
42
  isCustomDomainVerified: z.boolean().default(false),
43
43
  customDomainVerifiedAt: common_1.IsoDatetimeSchema.optional(),
44
44
  });
45
- exports.HotelDomainSettingsPersistedSchema = exports.HotelDomainSettingsSchema.extend({
46
- id: z.uuid(),
47
- hotelId: z.uuid(),
45
+ exports.HotelDomainPersistedSchema = exports.HotelDomainSchema.extend({
46
+ id: common_1.UuidSchema,
47
+ hotelId: common_1.UuidSchema,
48
48
  }).extend(common_1.TimestampSchema.shape);
49
- exports.HotelDomainSettingsListSchema = z.array(exports.HotelDomainSettingsPersistedSchema);
49
+ exports.HotelDomainListSchema = z.array(exports.HotelDomainPersistedSchema);
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./hotel-domain-settings.schema"), exports);
18
- __exportStar(require("./hotel-domain-settings.api"), exports);
17
+ __exportStar(require("./hotel-domains.schema"), exports);
18
+ __exportStar(require("./hotel-domains.api"), exports);
19
19
  __exportStar(require("./contracts"), exports);
@@ -33,17 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.HotelListItemSchema = exports.HotelWithTranslationsSchema = exports.HotelTranslationsSchema = exports.HotelPersistedSchema = void 0;
36
+ exports.HotelListItemSchema = exports.HotelDetailSchema = exports.HotelWithTranslationsSchema = exports.HotelWriteSchema = exports.HotelTranslationsSchema = exports.HotelPersistedSchema = exports.HotelSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
38
  const common_1 = require("../common");
39
- exports.HotelPersistedSchema = z
40
- .object({
41
- id: z.uuid(),
39
+ exports.HotelSchema = z.object({
42
40
  slug: common_1.SlugSchema,
43
- //принадлежность к сети
44
- chainId: z.uuid().optional(),
45
- status: z.enum(common_1.AppStatuses.HOTEL_VALUES).default(common_1.AppStatuses.HOTEL.pending),
46
- //категория отеля
41
+ chainId: common_1.UuidSchema.optional(),
42
+ status: z.enum(common_1.AppStatuses.HOTEL_VALUES).optional(), // сервер может проставить дефолт
47
43
  category: z.string().min(1).max(64).optional(),
48
44
  timezone: common_1.TimezoneSchema,
49
45
  currency: z.string().length(3),
@@ -52,18 +48,26 @@ exports.HotelPersistedSchema = z
52
48
  stars: z.number().int().min(1).max(5).optional(),
53
49
  checkInFrom: common_1.IsoTimeSchema,
54
50
  checkOutUntil: common_1.IsoTimeSchema,
55
- // добавить тип настроек
56
51
  metadata: z.record(z.string(), z.unknown()).optional(),
52
+ });
53
+ exports.HotelPersistedSchema = exports.HotelSchema.required({ status: true }).extend({
54
+ id: common_1.UuidSchema,
57
55
  version: z.number().int().nonnegative(),
58
- })
59
- .extend(common_1.TimestampSchema.shape);
56
+ ...common_1.TimestampSchema.shape,
57
+ });
60
58
  exports.HotelTranslationsSchema = z.object({
61
59
  name: z.string().min(3),
62
60
  description: z.string().optional(),
63
61
  });
62
+ exports.HotelWriteSchema = exports.HotelSchema.extend({
63
+ translations: (0, common_1.makeTranslations)(exports.HotelTranslationsSchema),
64
+ });
64
65
  exports.HotelWithTranslationsSchema = exports.HotelPersistedSchema.extend({
65
66
  translations: (0, common_1.makeTranslations)(exports.HotelTranslationsSchema),
66
67
  });
68
+ exports.HotelDetailSchema = exports.HotelPersistedSchema.extend({
69
+ translations: (0, common_1.makeTranslations)(exports.HotelTranslationsSchema),
70
+ });
67
71
  exports.HotelListItemSchema = exports.HotelPersistedSchema.omit({
68
72
  chainId: true,
69
73
  metadata: true,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HOTELS_API = exports.HOTELS_CONTROLLER = void 0;
3
+ exports.HOTELS_BY_SLUG_API = exports.HOTELS_API = exports.HOTELS_BY_SLUG_CONTROLLER = exports.HOTELS_CONTROLLER = void 0;
4
4
  const utils_1 = require("../common/utils");
5
5
  exports.HOTELS_CONTROLLER = {
6
6
  prefix: 'hotels',
@@ -10,7 +10,13 @@ exports.HOTELS_CONTROLLER = {
10
10
  findById: 'by-id/:hotelId',
11
11
  updateById: 'by-id/:hotelId',
12
12
  deleteById: 'by-id/:hotelId',
13
- findBySlug: 'by-slug/:hotelSlug',
13
+ },
14
+ };
15
+ exports.HOTELS_BY_SLUG_CONTROLLER = {
16
+ prefix: 'hotels/by-slug/:hotelSlug',
17
+ endpoints: {
18
+ find: '',
14
19
  },
15
20
  };
16
21
  exports.HOTELS_API = (0, utils_1.createApi)(exports.HOTELS_CONTROLLER);
22
+ exports.HOTELS_BY_SLUG_API = (0, utils_1.createApi)(exports.HOTELS_BY_SLUG_CONTROLLER);
@@ -24,7 +24,7 @@ __exportStar(require("./location"), exports);
24
24
  __exportStar(require("./policies"), exports);
25
25
  __exportStar(require("./ratings"), exports);
26
26
  __exportStar(require("./sites"), exports);
27
- __exportStar(require("./settings"), exports);
27
+ __exportStar(require("./domains"), exports);
28
28
  __exportStar(require("./themes"), exports);
29
29
  __exportStar(require("./hotel.models"), exports);
30
30
  __exportStar(require("./hotels.api"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./opera-integration-config.model"), exports);
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.OperaIntegrationConfigSchema = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const constants_1 = require("../../constants");
39
+ exports.OperaIntegrationConfigSchema = z.object({
40
+ provider: z.literal(constants_1.HOTEL_INTEGRATION_PROVIDERS.opera),
41
+ });
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateHotelIntegrationContract = void 0;
4
+ const common_1 = require("../../../common");
5
+ const hotel_integrations_api_1 = require("../hotel-integrations.api");
6
+ const hotel_integration_model_1 = require("../hotel-integration.model");
7
+ var CreateHotelIntegrationContract;
8
+ (function (CreateHotelIntegrationContract) {
9
+ CreateHotelIntegrationContract.getUrl = hotel_integrations_api_1.HOTEL_INTEGRATIONS_API.create;
10
+ CreateHotelIntegrationContract.endpoint = hotel_integrations_api_1.HOTEL_INTEGRATIONS_CONTROLLER.endpoints.create;
11
+ CreateHotelIntegrationContract.httpMethod = common_1.HTTP_METHODS.post;
12
+ CreateHotelIntegrationContract.RequestSchema = hotel_integration_model_1.HotelIntegrationWriteSchema;
13
+ CreateHotelIntegrationContract.ResponseSchema = hotel_integration_model_1.HotelIntegrationDetailSchema;
14
+ })(CreateHotelIntegrationContract || (exports.CreateHotelIntegrationContract = CreateHotelIntegrationContract = {}));
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.DeleteHotelIntegrationContract = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const common_1 = require("../../../common");
39
+ const hotel_integrations_api_1 = require("../hotel-integrations.api");
40
+ var DeleteHotelIntegrationContract;
41
+ (function (DeleteHotelIntegrationContract) {
42
+ DeleteHotelIntegrationContract.getUrl = hotel_integrations_api_1.HOTEL_INTEGRATIONS_API.delete;
43
+ DeleteHotelIntegrationContract.endpoint = hotel_integrations_api_1.HOTEL_INTEGRATIONS_CONTROLLER.endpoints.delete;
44
+ DeleteHotelIntegrationContract.httpMethod = common_1.HTTP_METHODS.delete;
45
+ DeleteHotelIntegrationContract.ResponseSchema = z.void();
46
+ })(DeleteHotelIntegrationContract || (exports.DeleteHotelIntegrationContract = DeleteHotelIntegrationContract = {}));
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FindAllHotelIntegrationsContract = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const common_1 = require("../../../common");
39
+ const hotel_integrations_api_1 = require("../hotel-integrations.api");
40
+ const hotel_integration_model_1 = require("../hotel-integration.model");
41
+ var FindAllHotelIntegrationsContract;
42
+ (function (FindAllHotelIntegrationsContract) {
43
+ FindAllHotelIntegrationsContract.getUrl = hotel_integrations_api_1.HOTEL_INTEGRATIONS_API.findAll;
44
+ FindAllHotelIntegrationsContract.endpoint = hotel_integrations_api_1.HOTEL_INTEGRATIONS_CONTROLLER.endpoints.findAll;
45
+ FindAllHotelIntegrationsContract.httpMethod = common_1.HTTP_METHODS.get;
46
+ FindAllHotelIntegrationsContract.ResponseSchema = z.array(hotel_integration_model_1.HotelIntegrationSchema);
47
+ })(FindAllHotelIntegrationsContract || (exports.FindAllHotelIntegrationsContract = FindAllHotelIntegrationsContract = {}));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindHotelIntegrationContract = void 0;
4
+ const common_1 = require("../../../common");
5
+ const hotel_integrations_api_1 = require("../hotel-integrations.api");
6
+ const hotel_integration_model_1 = require("../hotel-integration.model");
7
+ var FindHotelIntegrationContract;
8
+ (function (FindHotelIntegrationContract) {
9
+ FindHotelIntegrationContract.getUrl = hotel_integrations_api_1.HOTEL_INTEGRATIONS_API.findOne;
10
+ FindHotelIntegrationContract.endpoint = hotel_integrations_api_1.HOTEL_INTEGRATIONS_CONTROLLER.endpoints.findOne;
11
+ FindHotelIntegrationContract.httpMethod = common_1.HTTP_METHODS.get;
12
+ FindHotelIntegrationContract.ResponseSchema = hotel_integration_model_1.HotelIntegrationDetailSchema;
13
+ })(FindHotelIntegrationContract || (exports.FindHotelIntegrationContract = FindHotelIntegrationContract = {}));
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./find-all-hotel-integrations.contract"), exports);
18
+ __exportStar(require("./find-hotel-integration.contract"), exports);
19
+ __exportStar(require("./create-hotel-integration.contract"), exports);
20
+ __exportStar(require("./update-hotel-integration.contract"), exports);
21
+ __exportStar(require("./delete-hotel-integration.contract"), exports);