From 671f757daf687219b9a49545fb3629a9fd05d0a1 Mon Sep 17 00:00:00 2001 From: Daniel Stokowiec Date: Mon, 24 Feb 2020 13:59:07 +0100 Subject: [PATCH 1/2] WHM-314 Add `activationByUser` feature to product --- maas-schemas-ts/src/core/product.ts | 29 ++++++++++++++++++++++++++ maas-schemas-ts/translation.log | 2 ++ maas-schemas/schemas/core/product.json | 13 ++++++++++++ 3 files changed, 44 insertions(+) diff --git a/maas-schemas-ts/src/core/product.ts b/maas-schemas-ts/src/core/product.ts index aa273662f..fb48fc3a6 100644 --- a/maas-schemas-ts/src/core/product.ts +++ b/maas-schemas-ts/src/core/product.ts @@ -43,6 +43,32 @@ export interface IdBrand { readonly Id: unique symbol; } +// Features +// The purpose of this remains a mystery +export type Features = t.Branded< + { + activationByUser?: boolean; + }, + FeaturesBrand +>; +export const Features = t.brand( + t.partial({ + activationByUser: t.boolean, + }), + ( + x, + ): x is t.Branded< + { + activationByUser?: boolean; + }, + FeaturesBrand + > => true, + 'Features', +); +export interface FeaturesBrand { + readonly Features: unique symbol; +} + // PreAuthBuffer // The purpose of this remains a mystery export type PreAuthBuffer = t.Branded< @@ -84,6 +110,7 @@ export type Product = t.Branded< agencyId?: Common_.AgencyId; tspProductId?: string; allowFinishTrip?: boolean; + features?: Features; preAuthBuffer?: PreAuthBuffer; } & { id: Defined; @@ -103,6 +130,7 @@ export const Product = t.brand( agencyId: Common_.AgencyId, tspProductId: t.string, allowFinishTrip: t.boolean, + features: Features, preAuthBuffer: PreAuthBuffer, }), t.type({ @@ -123,6 +151,7 @@ export const Product = t.brand( agencyId?: Common_.AgencyId; tspProductId?: string; allowFinishTrip?: boolean; + features?: Features; preAuthBuffer?: PreAuthBuffer; } & { id: Defined; diff --git a/maas-schemas-ts/translation.log b/maas-schemas-ts/translation.log index e6604f876..3a0d0311a 100644 --- a/maas-schemas-ts/translation.log +++ b/maas-schemas-ts/translation.log @@ -860,6 +860,8 @@ INFO: missing description in ./core/product.json INFO: missing description in ./core/product.json +INFO: missing description + in ./core/product.json INFO: primitive type "integer" used outside top-level definitions in ./core/product-option.json WARNING: minimum field not supported outside top-level definitions diff --git a/maas-schemas/schemas/core/product.json b/maas-schemas/schemas/core/product.json index a6186dff9..0c3734262 100644 --- a/maas-schemas/schemas/core/product.json +++ b/maas-schemas/schemas/core/product.json @@ -36,6 +36,9 @@ "allowFinishTrip": { "type": "boolean" }, + "features": { + "$ref": "#/definitions/features" + }, "preAuthBuffer": { "$ref": "#/definitions/preAuthBuffer" } @@ -46,6 +49,16 @@ "minLength": 1, "maxLength": 255 }, + "features": { + "type": "object", + "properties": { + "activationByUser": { + "description": "Indicates booking flow, which requires user to activate it", + "type": "boolean" + } + }, + "additionalProperties": false + }, "preAuthBuffer": { "type": "object", "properties": { From 85e9b4d1c1a3b02566813defd1fdcd138fd24219 Mon Sep 17 00:00:00 2001 From: Daniel Stokowiec Date: Mon, 24 Feb 2020 13:59:28 +0100 Subject: [PATCH 2/2] WHM-313 Add `searchRadius` extra option to product provider --- .../src/maas-backend/products/provider.ts | 24 +++++++++++++++++++ maas-schemas-ts/translation.log | 4 ++++ .../maas-backend/products/provider.json | 14 +++++++++++ 3 files changed, 42 insertions(+) diff --git a/maas-schemas-ts/src/maas-backend/products/provider.ts b/maas-schemas-ts/src/maas-backend/products/provider.ts index 7eb7b06cb..ef22df93a 100644 --- a/maas-schemas-ts/src/maas-backend/products/provider.ts +++ b/maas-schemas-ts/src/maas-backend/products/provider.ts @@ -75,6 +75,13 @@ export type Provider = t.Branded< minIntervalUntilBooking: Defined; maxIntervalUntilBooking: Defined; }; + searchRadius?: { + min?: number; + max?: number; + } & { + min: Defined; + max: Defined; + }; }; personalDataOptionsAllow?: Array; personalDataCreateAllow?: Array; @@ -174,6 +181,16 @@ export const Provider = t.brand( maxIntervalUntilBooking: Defined, }), ]), + searchRadius: t.intersection([ + t.partial({ + min: t.number, + max: t.number, + }), + t.type({ + min: Defined, + max: Defined, + }), + ]), }), personalDataOptionsAllow: t.array(PersonalDataAllowItem_.PersonalDataAllowItem), personalDataCreateAllow: t.array(PersonalDataAllowItem_.PersonalDataAllowItem), @@ -279,6 +296,13 @@ export const Provider = t.brand( minIntervalUntilBooking: Defined; maxIntervalUntilBooking: Defined; }; + searchRadius?: { + min?: number; + max?: number; + } & { + min: Defined; + max: Defined; + }; }; personalDataOptionsAllow?: Array; personalDataCreateAllow?: Array; diff --git a/maas-schemas-ts/translation.log b/maas-schemas-ts/translation.log index 3a0d0311a..592ba860a 100644 --- a/maas-schemas-ts/translation.log +++ b/maas-schemas-ts/translation.log @@ -1292,6 +1292,10 @@ INFO: primitive type "number" used outside top-level definitions in ./maas-backend/products/provider.json INFO: primitive type "number" used outside top-level definitions in ./maas-backend/products/provider.json +INFO: primitive type "integer" used outside top-level definitions + in ./maas-backend/products/provider.json +INFO: primitive type "integer" used outside top-level definitions + in ./maas-backend/products/provider.json INFO: primitive type "string" used outside top-level definitions in ./maas-backend/products/provider.json INFO: primitive type "string" used outside top-level definitions diff --git a/maas-schemas/schemas/maas-backend/products/provider.json b/maas-schemas/schemas/maas-backend/products/provider.json index 7e8a979f3..37437cc29 100644 --- a/maas-schemas/schemas/maas-backend/products/provider.json +++ b/maas-schemas/schemas/maas-backend/products/provider.json @@ -117,6 +117,20 @@ } }, "required": ["isSupported", "minIntervalUntilBooking", "maxIntervalUntilBooking"] + }, + "searchRadius": { + "description": "Search radius constraints which should be met by clients", + "type": "object", + "properties": { + "min": { + "type": "integer" + }, + "max": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": ["min", "max"] } }, "additionalProperties": false