hh-contracts 0.0.95 → 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.
- package/CHANGELOG.md +5 -0
- package/app-menu/get.query.ts +2 -2
- package/build/app-menu/get.query.js +1 -1
- package/build/common/constants/domain-name.constant.js +9 -0
- package/build/common/constants/index.js +2 -0
- package/build/common/constants/slug.constant.js +1 -0
- package/build/common/constants/time-zone.constant.js +7 -0
- package/build/common/models/domain-name.schema.js +47 -0
- package/build/common/models/index.js +3 -1
- package/build/common/models/slug.schema.js +5 -1
- package/build/common/models/timestamp.schemas.js +4 -1
- package/build/common/models/timezone.schema.js +43 -0
- package/build/common/models/{uuid-array.schema.js → uuid.schemas.js} +3 -2
- package/build/companies/company.models.js +1 -1
- package/build/hotels/amenities/hotel-amenity.model.js +44 -0
- package/build/hotels/amenities/index.js +17 -0
- package/build/hotels/constants/hotel-amenity.constant.js +15 -0
- package/build/hotels/constants/hotel-contact-type.constant.js +9 -0
- package/build/hotels/constants/hotel-feature.constant.js +11 -0
- package/build/hotels/constants/hotel-integration-connection-state.constant.js +10 -0
- package/build/hotels/constants/hotel-integration-credential-status.constant.js +9 -0
- package/build/hotels/constants/hotel-integration-provider.constant.js +7 -0
- package/build/hotels/constants/hotel-integration-sync-status.constant.js +10 -0
- package/build/hotels/constants/hotel-policy-type.constant.js +11 -0
- package/build/hotels/constants/hotel-rating-source.constant.js +9 -0
- package/build/hotels/constants/index.js +25 -0
- package/build/hotels/contacts/hotel-contact.model.js +48 -0
- package/build/hotels/contacts/index.js +17 -0
- package/build/hotels/contracts/create-hotel.contract.js +14 -0
- package/build/hotels/contracts/delete-hotel.contract.js +46 -0
- package/build/hotels/contracts/find-hotel.contract.js +18 -0
- package/build/hotels/contracts/find-many-hotels.contract.js +67 -0
- package/build/hotels/contracts/index.js +4 -0
- package/build/hotels/contracts/update-hotel.contract.js +15 -0
- package/build/hotels/domains/contracts/find-hotel-domain-settings.contract.js +13 -0
- package/build/hotels/domains/contracts/index.js +18 -0
- package/build/hotels/domains/contracts/update-hotel-domain-settings.contract.js +14 -0
- package/build/hotels/domains/hotel-domains.api.js +12 -0
- package/build/hotels/domains/hotel-domains.schema.js +49 -0
- package/build/hotels/domains/index.js +19 -0
- package/build/hotels/{hotel.model.js → features/hotel-feature.model.js} +8 -9
- package/build/hotels/features/index.js +17 -0
- package/build/hotels/hotel.models.js +83 -0
- package/build/hotels/hotels.api.js +14 -5
- package/build/hotels/index.js +10 -1
- package/build/hotels/integrations/configs/index.js +17 -0
- package/build/hotels/integrations/configs/opera-integration-config.model.js +41 -0
- package/build/hotels/integrations/contracts/create-hotel-integration.contract.js +14 -0
- package/build/hotels/integrations/contracts/delete-hotel-integration.contract.js +46 -0
- package/build/hotels/integrations/contracts/find-all-hotel-integrations.contract.js +47 -0
- package/build/hotels/integrations/contracts/find-hotel-integration.contract.js +13 -0
- package/build/hotels/integrations/contracts/index.js +21 -0
- package/build/hotels/integrations/contracts/update-hotel-integration.contract.js +14 -0
- package/build/hotels/integrations/hotel-integration.model.js +97 -0
- package/build/hotels/integrations/hotel-integrations.api.js +17 -0
- package/build/hotels/integrations/index.js +19 -0
- package/build/hotels/location/hotel-location.model.js +51 -0
- package/build/hotels/location/index.js +17 -0
- package/build/hotels/policies/hotel-policy.model.js +49 -0
- package/build/hotels/policies/index.js +17 -0
- package/build/hotels/ratings/hotel-rating.model.js +48 -0
- package/build/hotels/ratings/index.js +17 -0
- package/build/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.js +3 -3
- package/build/hotels/sites/hotel-pages.api.js +24 -0
- package/build/hotels/sites/index.js +1 -0
- package/build/hotels/themes/contracts/find-hotel-theme.contract.js +3 -3
- package/build/hotels/themes/hotel-themes.api.js +20 -0
- package/build/hotels/themes/index.js +1 -0
- package/build/permissions/contracts/create-permission.contract.js +2 -6
- package/build/permissions/contracts/delete-permission.contract.js +35 -2
- package/build/permissions/contracts/find-permission.contract.js +1 -8
- package/build/permissions/contracts/update-permission.contract.js +1 -1
- package/build/permissions/permission.models.js +12 -25
- package/build/roles/contracts/create-role.contract.js +2 -6
- package/build/roles/contracts/delete-role.contract.js +35 -2
- package/build/roles/contracts/find-role.contract.js +1 -1
- package/build/roles/contracts/update-role.contract.js +1 -1
- package/build/roles/role.models.js +14 -11
- package/build/translate/contracts/translate-object.contract.js +3 -0
- package/common/constants/domain-name.constant.ts +8 -0
- package/common/constants/index.ts +2 -0
- package/common/constants/slug.constant.ts +2 -1
- package/common/constants/time-zone.constant.ts +4 -0
- package/common/models/domain-name.schema.ts +14 -0
- package/common/models/index.ts +3 -1
- package/common/models/slug.schema.ts +5 -1
- package/common/models/timestamp.schemas.ts +4 -0
- package/common/models/timezone.schema.ts +10 -0
- package/common/models/uuid.schemas.ts +4 -0
- package/companies/company.models.ts +2 -2
- package/hotels/amenities/hotel-amenity.model.ts +10 -0
- package/hotels/amenities/index.ts +1 -0
- package/hotels/constants/hotel-amenity.constant.ts +18 -0
- package/hotels/constants/hotel-contact-type.constant.ts +12 -0
- package/hotels/constants/hotel-feature.constant.ts +14 -0
- package/hotels/constants/hotel-integration-connection-state.constant.ts +13 -0
- package/hotels/constants/hotel-integration-credential-status.constant.ts +12 -0
- package/hotels/constants/hotel-integration-provider.constant.ts +11 -0
- package/hotels/constants/hotel-integration-sync-status.constant.ts +13 -0
- package/hotels/constants/hotel-policy-type.constant.ts +15 -0
- package/hotels/constants/hotel-rating-source.constant.ts +12 -0
- package/hotels/constants/index.ts +9 -0
- package/hotels/contacts/hotel-contact.model.ts +15 -0
- package/hotels/contacts/index.ts +1 -0
- package/hotels/contracts/create-hotel.contract.ts +16 -0
- package/hotels/contracts/delete-hotel.contract.ts +12 -0
- package/hotels/contracts/find-hotel.contract.ts +27 -1
- package/hotels/contracts/find-many-hotels.contract.ts +43 -0
- package/hotels/contracts/index.ts +4 -0
- package/hotels/contracts/update-hotel.contract.ts +17 -0
- package/hotels/domains/contracts/find-hotel-domain-settings.contract.ts +13 -0
- package/hotels/domains/contracts/index.ts +2 -0
- package/hotels/domains/contracts/update-hotel-domain-settings.contract.ts +16 -0
- package/hotels/domains/hotel-domains.api.ts +11 -0
- package/hotels/domains/hotel-domains.schema.ts +25 -0
- package/hotels/domains/index.ts +3 -0
- package/hotels/features/hotel-feature.model.ts +14 -0
- package/hotels/features/index.ts +1 -0
- package/hotels/hotel.models.ts +70 -0
- package/hotels/hotels.api.ts +14 -4
- package/hotels/index.ts +10 -1
- package/hotels/integrations/configs/index.ts +1 -0
- package/hotels/integrations/configs/opera-integration-config.model.ts +6 -0
- package/hotels/integrations/contracts/create-hotel-integration.contract.ts +21 -0
- package/hotels/integrations/contracts/delete-hotel-integration.contract.ts +14 -0
- package/hotels/integrations/contracts/find-all-hotel-integrations.contract.ts +15 -0
- package/hotels/integrations/contracts/find-hotel-integration.contract.ts +15 -0
- package/hotels/integrations/contracts/index.ts +5 -0
- package/hotels/integrations/contracts/update-hotel-integration.contract.ts +21 -0
- package/hotels/integrations/hotel-integration.model.ts +80 -0
- package/hotels/integrations/hotel-integrations.api.ts +16 -0
- package/hotels/integrations/index.ts +3 -0
- package/hotels/location/hotel-location.model.ts +17 -0
- package/hotels/location/index.ts +1 -0
- package/hotels/policies/hotel-policy.model.ts +16 -0
- package/hotels/policies/index.ts +1 -0
- package/hotels/ratings/hotel-rating.model.ts +15 -0
- package/hotels/ratings/index.ts +1 -0
- package/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.ts +3 -3
- package/hotels/sites/hotel-pages.api.ts +24 -0
- package/hotels/sites/index.ts +1 -0
- package/hotels/themes/contracts/find-hotel-theme.contract.ts +3 -3
- package/hotels/themes/hotel-themes.api.ts +20 -0
- package/hotels/themes/index.ts +1 -0
- package/package.json +1 -1
- package/permissions/contracts/create-permission.contract.ts +3 -7
- package/permissions/contracts/delete-permission.contract.ts +1 -2
- package/permissions/contracts/find-permission.contract.ts +2 -10
- package/permissions/contracts/update-permission.contract.ts +2 -2
- package/permissions/permission.models.ts +18 -31
- package/roles/contracts/create-role.contract.ts +3 -7
- package/roles/contracts/delete-role.contract.ts +1 -2
- package/roles/contracts/find-role.contract.ts +2 -2
- package/roles/contracts/update-role.contract.ts +2 -2
- package/roles/role.models.ts +26 -15
- package/translate/contracts/translate-object.contract.ts +3 -0
- package/build/permissions/permission.response.schema.js +0 -8
- package/common/models/uuid-array.schema.ts +0 -3
- package/hotels/hotel.model.ts +0 -14
- package/permissions/permission.response.schema.ts +0 -8
|
@@ -12,4 +12,6 @@ export * from './order-direction.constant';
|
|
|
12
12
|
export * from './role-types.constant';
|
|
13
13
|
export * from './route-component-key.constants';
|
|
14
14
|
export * from './slug.constant';
|
|
15
|
+
export * from './time-zone.constant';
|
|
16
|
+
export * from './domain-name.constant';
|
|
15
17
|
export * from './translatable-field.constant';
|
|
@@ -0,0 +1,14 @@
|
|
|
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>;
|
package/common/models/index.ts
CHANGED
|
@@ -7,6 +7,8 @@ export * from './pagination.schema';
|
|
|
7
7
|
export * from './search.schema';
|
|
8
8
|
export * from './slug.schema';
|
|
9
9
|
export * from './timestamp.schemas';
|
|
10
|
+
export * from './timezone.schema';
|
|
10
11
|
export * from './language-keys.schema';
|
|
11
12
|
export * from './translations.schemas';
|
|
12
|
-
export * from './uuid
|
|
13
|
+
export * from './uuid.schemas';
|
|
14
|
+
export * from './domain-name.schema';
|
|
@@ -8,3 +8,7 @@ export const TimestampSchema = z.object({
|
|
|
8
8
|
export const TimestampWithDeletedSchema = TimestampSchema.extend({
|
|
9
9
|
deletedAt: z.date().nullable(),
|
|
10
10
|
});
|
|
11
|
+
|
|
12
|
+
export const IsoDatetimeSchema = z.iso.datetime();
|
|
13
|
+
export const IsoDateSchema = z.iso.date();
|
|
14
|
+
export const IsoTimeSchema = z.iso.time();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { TIME_ZONE_CONFIG } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const TimezoneSchema = z.string().refine(value => TIME_ZONE_CONFIG.regex.test(value), {
|
|
5
|
+
params: {
|
|
6
|
+
messageKey: TIME_ZONE_CONFIG.messageKey,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type TTimezone = z.infer<typeof TimezoneSchema>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import { TimestampSchema } from '../common';
|
|
2
|
+
import { TimestampSchema, UuidSchema } from '../common';
|
|
3
3
|
|
|
4
4
|
export const CompanyPersistedSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
id:
|
|
6
|
+
id: UuidSchema,
|
|
7
7
|
inn: z.string(),
|
|
8
8
|
isActive: z.boolean().default(true),
|
|
9
9
|
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HOTEL_AMENITY_VALUES } from '../constants';
|
|
3
|
+
import { UuidSchema } from '../../common';
|
|
4
|
+
|
|
5
|
+
export const HotelAmenitySchema = z.object({
|
|
6
|
+
hotelId: UuidSchema,
|
|
7
|
+
amenityCode: z.enum(HOTEL_AMENITY_VALUES),
|
|
8
|
+
isPrimary: z.boolean().default(false),
|
|
9
|
+
});
|
|
10
|
+
export type THotelAmenity = z.infer<typeof HotelAmenitySchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hotel-amenity.model';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const HOTEL_AMENITIES = {
|
|
2
|
+
wifi: 'wifi',
|
|
3
|
+
parking: 'parking',
|
|
4
|
+
pool: 'pool',
|
|
5
|
+
spa: 'spa',
|
|
6
|
+
gym: 'gym',
|
|
7
|
+
restaurant: 'restaurant',
|
|
8
|
+
bar: 'bar',
|
|
9
|
+
conferenceRoom: 'conferenceRoom',
|
|
10
|
+
businessCenter: 'businessCenter',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export type THotelAmenityCode = (typeof HOTEL_AMENITIES)[keyof typeof HOTEL_AMENITIES];
|
|
14
|
+
|
|
15
|
+
export const HOTEL_AMENITY_VALUES = Object.values(HOTEL_AMENITIES) as [
|
|
16
|
+
THotelAmenityCode,
|
|
17
|
+
...THotelAmenityCode[],
|
|
18
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const HOTEL_CONTACT_TYPES = {
|
|
2
|
+
mainPhone: 'mainPhone',
|
|
3
|
+
reservations: 'reservations',
|
|
4
|
+
sales: 'sales',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type THotelContactType = (typeof HOTEL_CONTACT_TYPES)[keyof typeof HOTEL_CONTACT_TYPES];
|
|
8
|
+
|
|
9
|
+
export const HOTEL_CONTACT_TYPE_VALUES = Object.values(HOTEL_CONTACT_TYPES) as [
|
|
10
|
+
THotelContactType,
|
|
11
|
+
...THotelContactType[],
|
|
12
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const HOTEL_FEATURES = {
|
|
2
|
+
site: 'site',
|
|
3
|
+
services: 'services',
|
|
4
|
+
digitalSignage: 'digitalSignage',
|
|
5
|
+
hskRoomStatus: 'hskRoomStatus',
|
|
6
|
+
fbBreakfastCheckin: 'fbBreakfastCheckin',
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export type THotelFeatureKey = (typeof HOTEL_FEATURES)[keyof typeof HOTEL_FEATURES];
|
|
10
|
+
|
|
11
|
+
export const HOTEL_FEATURE_VALUES = Object.values(HOTEL_FEATURES) as [
|
|
12
|
+
THotelFeatureKey,
|
|
13
|
+
...THotelFeatureKey[],
|
|
14
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const HOTEL_INTEGRATION_CONNECTION_STATES = {
|
|
2
|
+
offline: 'offline',
|
|
3
|
+
connecting: 'connecting',
|
|
4
|
+
online: 'online',
|
|
5
|
+
degraded: 'degraded',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type THotelIntegrationConnectionState =
|
|
9
|
+
(typeof HOTEL_INTEGRATION_CONNECTION_STATES)[keyof typeof HOTEL_INTEGRATION_CONNECTION_STATES];
|
|
10
|
+
|
|
11
|
+
export const HOTEL_INTEGRATION_CONNECTION_STATE_VALUES = Object.values(
|
|
12
|
+
HOTEL_INTEGRATION_CONNECTION_STATES,
|
|
13
|
+
) as [THotelIntegrationConnectionState, ...THotelIntegrationConnectionState[]];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const HOTEL_INTEGRATION_CREDENTIAL_STATUSES = {
|
|
2
|
+
active: 'active',
|
|
3
|
+
rotating: 'rotating',
|
|
4
|
+
revoked: 'revoked',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type THotelIntegrationCredentialStatus =
|
|
8
|
+
(typeof HOTEL_INTEGRATION_CREDENTIAL_STATUSES)[keyof typeof HOTEL_INTEGRATION_CREDENTIAL_STATUSES];
|
|
9
|
+
|
|
10
|
+
export const HOTEL_INTEGRATION_CREDENTIAL_STATUS_VALUES = Object.values(
|
|
11
|
+
HOTEL_INTEGRATION_CREDENTIAL_STATUSES,
|
|
12
|
+
) as [THotelIntegrationCredentialStatus, ...THotelIntegrationCredentialStatus[]];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const HOTEL_INTEGRATION_PROVIDERS = {
|
|
2
|
+
opera: 'opera',
|
|
3
|
+
} as const;
|
|
4
|
+
|
|
5
|
+
export type THotelIntegrationProvider =
|
|
6
|
+
(typeof HOTEL_INTEGRATION_PROVIDERS)[keyof typeof HOTEL_INTEGRATION_PROVIDERS];
|
|
7
|
+
|
|
8
|
+
export const HOTEL_INTEGRATION_PROVIDER_VALUES = Object.values(HOTEL_INTEGRATION_PROVIDERS) as [
|
|
9
|
+
THotelIntegrationProvider,
|
|
10
|
+
...THotelIntegrationProvider[],
|
|
11
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const HOTEL_INTEGRATION_SYNC_STATUSES = {
|
|
2
|
+
idle: 'idle',
|
|
3
|
+
running: 'running',
|
|
4
|
+
success: 'success',
|
|
5
|
+
failed: 'failed',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type THotelIntegrationSyncStatus =
|
|
9
|
+
(typeof HOTEL_INTEGRATION_SYNC_STATUSES)[keyof typeof HOTEL_INTEGRATION_SYNC_STATUSES];
|
|
10
|
+
|
|
11
|
+
export const HOTEL_INTEGRATION_SYNC_STATUS_VALUES = Object.values(
|
|
12
|
+
HOTEL_INTEGRATION_SYNC_STATUSES,
|
|
13
|
+
) as [THotelIntegrationSyncStatus, ...THotelIntegrationSyncStatus[]];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const HOTEL_POLICY_TYPES = {
|
|
2
|
+
cancellation: 'cancellation',
|
|
3
|
+
deposit: 'deposit',
|
|
4
|
+
meal: 'meal',
|
|
5
|
+
pet: 'pet',
|
|
6
|
+
smoking: 'smoking',
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export type THotelPolicyType =
|
|
10
|
+
(typeof HOTEL_POLICY_TYPES)[keyof typeof HOTEL_POLICY_TYPES];
|
|
11
|
+
|
|
12
|
+
export const HOTEL_POLICY_TYPE_VALUES = Object.values(HOTEL_POLICY_TYPES) as [
|
|
13
|
+
THotelPolicyType,
|
|
14
|
+
...THotelPolicyType[],
|
|
15
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const HOTEL_RATING_SOURCES = {
|
|
2
|
+
google: 'google',
|
|
3
|
+
yandexMaps: 'yandexMaps',
|
|
4
|
+
ostrovok: 'ostrovok',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type THotelRatingSource = (typeof HOTEL_RATING_SOURCES)[keyof typeof HOTEL_RATING_SOURCES];
|
|
8
|
+
|
|
9
|
+
export const HOTEL_RATING_SOURCE_VALUES = Object.values(HOTEL_RATING_SOURCES) as [
|
|
10
|
+
THotelRatingSource,
|
|
11
|
+
...THotelRatingSource[],
|
|
12
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './hotel-amenity.constant';
|
|
2
|
+
export * from './hotel-contact-type.constant';
|
|
3
|
+
export * from './hotel-feature.constant';
|
|
4
|
+
export * from './hotel-integration-connection-state.constant';
|
|
5
|
+
export * from './hotel-integration-credential-status.constant';
|
|
6
|
+
export * from './hotel-integration-provider.constant';
|
|
7
|
+
export * from './hotel-integration-sync-status.constant';
|
|
8
|
+
export * from './hotel-policy-type.constant';
|
|
9
|
+
export * from './hotel-rating-source.constant';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HOTEL_CONTACT_TYPE_VALUES } from '../constants';
|
|
3
|
+
import { TimestampSchema, UuidSchema } from '../../common';
|
|
4
|
+
|
|
5
|
+
export const HotelContactSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
hotelId: UuidSchema,
|
|
8
|
+
contactType: z.enum(HOTEL_CONTACT_TYPE_VALUES),
|
|
9
|
+
value: z.string().min(1),
|
|
10
|
+
isPublic: z.boolean().default(true),
|
|
11
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
12
|
+
})
|
|
13
|
+
.extend(TimestampSchema.shape);
|
|
14
|
+
|
|
15
|
+
export type THotelContact = z.infer<typeof HotelContactSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hotel-contact.model';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../common';
|
|
3
|
+
import { HOTELS_API, HOTELS_CONTROLLER } from '../hotels.api';
|
|
4
|
+
import { HotelWriteSchema, HotelDetailSchema } from '../hotel.models';
|
|
5
|
+
|
|
6
|
+
export namespace CreateHotelContract {
|
|
7
|
+
export const getUrl = HOTELS_API.create;
|
|
8
|
+
export const endpoint = HOTELS_CONTROLLER.endpoints.create;
|
|
9
|
+
export const httpMethod = HTTP_METHODS.post;
|
|
10
|
+
|
|
11
|
+
export const RequestSchema = HotelWriteSchema;
|
|
12
|
+
export type TRequest = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = HotelDetailSchema;
|
|
15
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../common';
|
|
3
|
+
import { HOTELS_API, HOTELS_CONTROLLER } from '../hotels.api';
|
|
4
|
+
|
|
5
|
+
export namespace DeleteHotelContract {
|
|
6
|
+
export const getUrl = HOTELS_API.deleteById;
|
|
7
|
+
export const endpoint = HOTELS_CONTROLLER.endpoints.deleteById;
|
|
8
|
+
export const httpMethod = HTTP_METHODS.delete;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.void();
|
|
11
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
12
|
+
}
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../common';
|
|
3
|
+
import { HotelDetailSchema } from '../hotel.models';
|
|
4
|
+
import {
|
|
5
|
+
HOTELS_API,
|
|
6
|
+
HOTELS_BY_SLUG_API,
|
|
7
|
+
HOTELS_BY_SLUG_CONTROLLER,
|
|
8
|
+
HOTELS_CONTROLLER,
|
|
9
|
+
} from '../hotels.api';
|
|
10
|
+
|
|
11
|
+
export namespace FindHotelByIdContract {
|
|
12
|
+
export const getUrl = HOTELS_API.findById;
|
|
13
|
+
export const endpoint = HOTELS_CONTROLLER.endpoints.findById;
|
|
14
|
+
export const httpMethod = HTTP_METHODS.get;
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = HotelDetailSchema;
|
|
17
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export namespace FindHotelBySlugContract {
|
|
21
|
+
export const getUrl = HOTELS_BY_SLUG_API.find;
|
|
22
|
+
export const endpoint = HOTELS_BY_SLUG_CONTROLLER.endpoints.find;
|
|
23
|
+
export const httpMethod = HTTP_METHODS.get;
|
|
24
|
+
|
|
25
|
+
export const ResponseSchema = HotelDetailSchema;
|
|
26
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS, CommonQueryParamsSchema, PaginationResponseSchema } from '../../common';
|
|
3
|
+
import { HotelListItemSchema } from '../hotel.models';
|
|
4
|
+
import { HOTELS_API, HOTELS_CONTROLLER } from '../hotels.api';
|
|
5
|
+
|
|
6
|
+
const BaseQuerySchema = HotelListItemSchema.pick({
|
|
7
|
+
status: true,
|
|
8
|
+
category: true,
|
|
9
|
+
stars: true,
|
|
10
|
+
}).partial();
|
|
11
|
+
|
|
12
|
+
const OrderBySchema = HotelListItemSchema.omit({
|
|
13
|
+
id: true,
|
|
14
|
+
}).keyof();
|
|
15
|
+
|
|
16
|
+
const FindManyHotelsContractRequestSchema = BaseQuerySchema.extend({
|
|
17
|
+
...CommonQueryParamsSchema.shape,
|
|
18
|
+
orderBy: OrderBySchema.optional(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const FindManyHotelsContractResponseSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
hotels: z.array(HotelListItemSchema),
|
|
24
|
+
})
|
|
25
|
+
.extend(PaginationResponseSchema.shape);
|
|
26
|
+
|
|
27
|
+
export namespace FindManyHotelsContract {
|
|
28
|
+
export const getUrl = HOTELS_API.findMany;
|
|
29
|
+
export const endpoint = HOTELS_CONTROLLER.endpoints.findMany;
|
|
30
|
+
export const httpMethod = HTTP_METHODS.get;
|
|
31
|
+
|
|
32
|
+
export const BaseFilterSchema = BaseQuerySchema;
|
|
33
|
+
export type TBaseFilter = z.infer<typeof BaseFilterSchema>;
|
|
34
|
+
|
|
35
|
+
export const SORTING_KEYS = OrderBySchema.options;
|
|
36
|
+
export type TSortingKey = z.infer<typeof OrderBySchema>;
|
|
37
|
+
|
|
38
|
+
export const RequestSchema = FindManyHotelsContractRequestSchema;
|
|
39
|
+
export type TRequest = z.infer<typeof RequestSchema>;
|
|
40
|
+
|
|
41
|
+
export const ResponseSchema = FindManyHotelsContractResponseSchema;
|
|
42
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../common';
|
|
3
|
+
import { HOTELS_API, HOTELS_CONTROLLER } from '../hotels.api';
|
|
4
|
+
import { HotelDetailSchema } from '../hotel.models';
|
|
5
|
+
import { CreateHotelContract } from './create-hotel.contract';
|
|
6
|
+
|
|
7
|
+
export namespace UpdateHotelContract {
|
|
8
|
+
export const getUrl = HOTELS_API.updateById;
|
|
9
|
+
export const endpoint = HOTELS_CONTROLLER.endpoints.updateById;
|
|
10
|
+
export const httpMethod = HTTP_METHODS.put;
|
|
11
|
+
|
|
12
|
+
export const RequestSchema = CreateHotelContract.RequestSchema;
|
|
13
|
+
export type TRequest = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = HotelDetailSchema;
|
|
16
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../../common';
|
|
3
|
+
import { HOTEL_DOMAINS_API, HOTEL_DOMAINS_CONTROLLER } from '../hotel-domains.api';
|
|
4
|
+
import { HotelDomainListSchema } from '../hotel-domains.schema';
|
|
5
|
+
|
|
6
|
+
export namespace FindHotelDomainsContract {
|
|
7
|
+
export const getUrl = HOTEL_DOMAINS_API.find;
|
|
8
|
+
export const endpoint = HOTEL_DOMAINS_CONTROLLER.endpoints.find;
|
|
9
|
+
export const httpMethod = HTTP_METHODS.get;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = HotelDomainListSchema;
|
|
12
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../../common';
|
|
3
|
+
import { HOTEL_DOMAINS_API, HOTEL_DOMAINS_CONTROLLER } from '../hotel-domains.api';
|
|
4
|
+
import { HotelDomainPersistedSchema, HotelDomainSchema } from '../hotel-domains.schema';
|
|
5
|
+
|
|
6
|
+
export namespace UpdateHotelDomainContract {
|
|
7
|
+
export const getUrl = HOTEL_DOMAINS_API.update;
|
|
8
|
+
export const endpoint = HOTEL_DOMAINS_CONTROLLER.endpoints.update;
|
|
9
|
+
export const httpMethod = HTTP_METHODS.put;
|
|
10
|
+
|
|
11
|
+
export const RequestSchema = HotelDomainSchema;
|
|
12
|
+
export type TRequest = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = HotelDomainPersistedSchema;
|
|
15
|
+
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createApi, TController } from '../../common/utils';
|
|
2
|
+
|
|
3
|
+
export const HOTEL_DOMAINS_CONTROLLER = {
|
|
4
|
+
prefix: 'hotels/by-id/:hotelId/domains',
|
|
5
|
+
endpoints: {
|
|
6
|
+
find: '',
|
|
7
|
+
update: '',
|
|
8
|
+
},
|
|
9
|
+
} as const satisfies TController;
|
|
10
|
+
|
|
11
|
+
export const HOTEL_DOMAINS_API = createApi(HOTEL_DOMAINS_CONTROLLER);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
DomainNameSchema,
|
|
4
|
+
IsoDatetimeSchema,
|
|
5
|
+
KIND_OF_APP_VALUES,
|
|
6
|
+
TimestampSchema,
|
|
7
|
+
UuidSchema,
|
|
8
|
+
} from '../../common';
|
|
9
|
+
|
|
10
|
+
export const HotelDomainSchema = z.object({
|
|
11
|
+
kindOfApp: z.enum(KIND_OF_APP_VALUES),
|
|
12
|
+
customDomain: DomainNameSchema.optional(),
|
|
13
|
+
isCustomDomainVerified: z.boolean().default(false),
|
|
14
|
+
customDomainVerifiedAt: IsoDatetimeSchema.optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const HotelDomainPersistedSchema = HotelDomainSchema.extend({
|
|
18
|
+
id: UuidSchema,
|
|
19
|
+
hotelId: UuidSchema,
|
|
20
|
+
}).extend(TimestampSchema.shape);
|
|
21
|
+
|
|
22
|
+
export const HotelDomainListSchema = z.array(HotelDomainPersistedSchema);
|
|
23
|
+
|
|
24
|
+
export type THotelDomain = z.infer<typeof HotelDomainSchema>;
|
|
25
|
+
export type THotelDomainPersisted = z.infer<typeof HotelDomainPersistedSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { TimestampSchema } from '../../common';
|
|
3
|
+
import { HOTEL_FEATURE_VALUES } from '../constants';
|
|
4
|
+
|
|
5
|
+
export const HotelFeatureSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
hotelId: z.uuid(),
|
|
8
|
+
feature: z.enum(HOTEL_FEATURE_VALUES),
|
|
9
|
+
enabled: z.boolean(),
|
|
10
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
11
|
+
})
|
|
12
|
+
.extend(TimestampSchema.shape);
|
|
13
|
+
|
|
14
|
+
export type THotelFeature = z.infer<typeof HotelFeatureSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hotel-feature.model';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
LANGUAGE_KEYS,
|
|
4
|
+
TimestampSchema,
|
|
5
|
+
AppStatuses,
|
|
6
|
+
SlugSchema,
|
|
7
|
+
makeTranslations,
|
|
8
|
+
IsoTimeSchema,
|
|
9
|
+
TimezoneSchema,
|
|
10
|
+
UuidSchema,
|
|
11
|
+
} from '../common';
|
|
12
|
+
|
|
13
|
+
export const HotelSchema = z.object({
|
|
14
|
+
slug: SlugSchema,
|
|
15
|
+
chainId: UuidSchema.optional(),
|
|
16
|
+
status: z.enum(AppStatuses.HOTEL_VALUES).optional(), // сервер может проставить дефолт
|
|
17
|
+
category: z.string().min(1).max(64).optional(),
|
|
18
|
+
timezone: TimezoneSchema,
|
|
19
|
+
currency: z.string().length(3),
|
|
20
|
+
defaultLang: z.enum(LANGUAGE_KEYS),
|
|
21
|
+
availableLangs: z.array(z.enum(LANGUAGE_KEYS)),
|
|
22
|
+
stars: z.number().int().min(1).max(5).optional(),
|
|
23
|
+
checkInFrom: IsoTimeSchema,
|
|
24
|
+
checkOutUntil: IsoTimeSchema,
|
|
25
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
26
|
+
});
|
|
27
|
+
export type THotel = z.infer<typeof HotelSchema>;
|
|
28
|
+
|
|
29
|
+
export const HotelPersistedSchema = HotelSchema.required({ status: true }).extend({
|
|
30
|
+
id: UuidSchema,
|
|
31
|
+
version: z.number().int().nonnegative(),
|
|
32
|
+
...TimestampSchema.shape,
|
|
33
|
+
});
|
|
34
|
+
export type THotelPersisted = z.infer<typeof HotelPersistedSchema>;
|
|
35
|
+
|
|
36
|
+
export const HotelTranslationsSchema = z.object({
|
|
37
|
+
name: z.string().min(3),
|
|
38
|
+
description: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
export type THotelTranslations = z.infer<typeof HotelTranslationsSchema>;
|
|
41
|
+
|
|
42
|
+
export const HotelWriteSchema = HotelSchema.extend({
|
|
43
|
+
translations: makeTranslations(HotelTranslationsSchema),
|
|
44
|
+
});
|
|
45
|
+
export type THotelWrite = z.infer<typeof HotelWriteSchema>;
|
|
46
|
+
|
|
47
|
+
export const HotelWithTranslationsSchema = HotelPersistedSchema.extend({
|
|
48
|
+
translations: makeTranslations(HotelTranslationsSchema),
|
|
49
|
+
});
|
|
50
|
+
export type THotelWithTranslations = z.infer<typeof HotelWithTranslationsSchema>;
|
|
51
|
+
|
|
52
|
+
export const HotelDetailSchema = HotelPersistedSchema.extend({
|
|
53
|
+
translations: makeTranslations(HotelTranslationsSchema),
|
|
54
|
+
});
|
|
55
|
+
export type THotelDetail = z.infer<typeof HotelDetailSchema>;
|
|
56
|
+
|
|
57
|
+
export const HotelListItemSchema = HotelPersistedSchema.omit({
|
|
58
|
+
chainId: true,
|
|
59
|
+
metadata: true,
|
|
60
|
+
timezone: true,
|
|
61
|
+
currency: true,
|
|
62
|
+
defaultLang: true,
|
|
63
|
+
availableLangs: true,
|
|
64
|
+
checkInFrom: true,
|
|
65
|
+
checkOutUntil: true,
|
|
66
|
+
version: true,
|
|
67
|
+
}).extend({
|
|
68
|
+
name: z.string().nullable(),
|
|
69
|
+
});
|
|
70
|
+
export type THotelListItem = z.infer<typeof HotelListItemSchema>;
|
package/hotels/hotels.api.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { createApi, TController } from '../common/utils';
|
|
2
2
|
|
|
3
|
+
export const HOTELS_CONTROLLER = {
|
|
4
|
+
prefix: 'hotels',
|
|
5
|
+
endpoints: {
|
|
6
|
+
create: '',
|
|
7
|
+
findMany: '',
|
|
8
|
+
findById: 'by-id/:hotelId',
|
|
9
|
+
updateById: 'by-id/:hotelId',
|
|
10
|
+
deleteById: 'by-id/:hotelId',
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies TController;
|
|
13
|
+
|
|
3
14
|
export const HOTELS_BY_SLUG_CONTROLLER = {
|
|
4
|
-
prefix: 'hotels/by-slug',
|
|
15
|
+
prefix: 'hotels/by-slug/:hotelSlug',
|
|
5
16
|
endpoints: {
|
|
6
|
-
|
|
7
|
-
findSitePageByLang: ':hotelSlug/sites/pages/:slug',
|
|
8
|
-
findSitePage: ':hotelSlug/sites/pages/:slug',
|
|
17
|
+
find: '',
|
|
9
18
|
},
|
|
10
19
|
} as const satisfies TController;
|
|
11
20
|
|
|
21
|
+
export const HOTELS_API = createApi(HOTELS_CONTROLLER);
|
|
12
22
|
export const HOTELS_BY_SLUG_API = createApi(HOTELS_BY_SLUG_CONTROLLER);
|
package/hotels/index.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export * from './contracts';
|
|
2
|
+
export * from './constants';
|
|
3
|
+
export * from './amenities';
|
|
4
|
+
export * from './contacts';
|
|
5
|
+
export * from './features';
|
|
6
|
+
export * from './integrations';
|
|
7
|
+
export * from './location';
|
|
8
|
+
export * from './policies';
|
|
9
|
+
export * from './ratings';
|
|
2
10
|
export * from './sites';
|
|
11
|
+
export * from './domains';
|
|
3
12
|
export * from './themes';
|
|
4
|
-
export * from './hotel.
|
|
13
|
+
export * from './hotel.models';
|
|
5
14
|
export * from './hotels.api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './opera-integration-config.model';
|