Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product activationByUser & Provider searchRadius #493

Open
wants to merge 2 commits into
base: develop_debrecated
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions maas-schemas-ts/src/core/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down Expand Up @@ -84,6 +110,7 @@ export type Product = t.Branded<
agencyId?: Common_.AgencyId;
tspProductId?: string;
allowFinishTrip?: boolean;
features?: Features;
preAuthBuffer?: PreAuthBuffer;
} & {
id: Defined;
Expand All @@ -103,6 +130,7 @@ export const Product = t.brand(
agencyId: Common_.AgencyId,
tspProductId: t.string,
allowFinishTrip: t.boolean,
features: Features,
preAuthBuffer: PreAuthBuffer,
}),
t.type({
Expand All @@ -123,6 +151,7 @@ export const Product = t.brand(
agencyId?: Common_.AgencyId;
tspProductId?: string;
allowFinishTrip?: boolean;
features?: Features;
preAuthBuffer?: PreAuthBuffer;
} & {
id: Defined;
Expand Down
24 changes: 24 additions & 0 deletions maas-schemas-ts/src/maas-backend/products/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ export type Provider = t.Branded<
minIntervalUntilBooking: Defined;
maxIntervalUntilBooking: Defined;
};
searchRadius?: {
min?: number;
max?: number;
} & {
min: Defined;
max: Defined;
};
};
personalDataOptionsAllow?: Array<PersonalDataAllowItem_.PersonalDataAllowItem>;
personalDataCreateAllow?: Array<PersonalDataAllowItem_.PersonalDataAllowItem>;
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -279,6 +296,13 @@ export const Provider = t.brand(
minIntervalUntilBooking: Defined;
maxIntervalUntilBooking: Defined;
};
searchRadius?: {
min?: number;
max?: number;
} & {
min: Defined;
max: Defined;
};
};
personalDataOptionsAllow?: Array<PersonalDataAllowItem_.PersonalDataAllowItem>;
personalDataCreateAllow?: Array<PersonalDataAllowItem_.PersonalDataAllowItem>;
Expand Down
6 changes: 6 additions & 0 deletions maas-schemas-ts/translation.log
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1290,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
Expand Down
13 changes: 13 additions & 0 deletions maas-schemas/schemas/core/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"allowFinishTrip": {
"type": "boolean"
},
"features": {
"$ref": "#/definitions/features"
},
"preAuthBuffer": {
"$ref": "#/definitions/preAuthBuffer"
}
Expand All @@ -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": {
Expand Down
14 changes: 14 additions & 0 deletions maas-schemas/schemas/maas-backend/products/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down