refactor: moved default price into SCPriceGroup

This commit is contained in:
Michel Jonathan Schmitz
2019-02-27 13:59:14 +01:00
parent 86d9696f58
commit 797e5ca9de
6 changed files with 90 additions and 14 deletions

View File

@@ -20,10 +20,13 @@ import {SCISO8601Date} from '../types/Time';
import {SCInPlace} from './../types/Places';
/**
* A map from group name to price
* Default price without distinction
*/
export interface SCPriceGroup {
[s: string]: number | undefined;
/**
* Default price of the thing
*/
default: number;
}
/**
@@ -82,15 +85,10 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
*/
availabilityStarts?: SCISO8601Date;
/**
* Default price of the thing
*/
price: number;
/**
* List of prices that are distinct for specific groups
*/
prices?: T;
prices: T;
/**
* Provider of an offer

View File

@@ -32,7 +32,7 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/**
* Price for alumnis
*/
alumni: number;
alumni?: number;
}
/**

View File

@@ -0,0 +1,77 @@
{
"errorNames": [],
"instance": {
"type": "date series",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Dance course for beginners",
"duration": "PT8H",
"inPlace": {
"geo": {
"point": {
"type": "Point",
"coordinates": [
13.3266207,
52.5144409
]
}
},
"type": "room",
"categories": [
"student union"
],
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "EMH 225",
"floor": "2",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
}
},
"frequency": "once",
"dates": [
"2016-04-12T11:00:00+00:00"
],
"event": {
"type": "academic event",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Dance course for beginners",
"categories": [
"special"
],
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
}
},
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
},
"offers": [
{
"availability": "in stock",
"availabilityStarts": "2017-01-30T00:00:00.000Z",
"availabilityEnds": "2017-01-30T23:59:59.999Z",
"prices": {
"default": 6.5,
"student": 5,
"alumni": 5
},
"provider": {
"name": "Studentenwerk",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
},
"type": "organization",
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
}
}
]
},
"schema": "SCDateSeries"
}

View File

@@ -21,10 +21,11 @@
"availability": "in stock",
"availabilityStarts": "2017-01-30T00:00:00.000Z",
"availabilityEnds": "2017-01-30T23:59:59.999Z",
"price": 2.85,
"prices": {
"default": 4.85,
"student": 2.85,
"employee": 2.85
"employee": 3.85,
"guest": 4.85
},
"provider": {
"name": "Studentenwerk",

View File

@@ -9,10 +9,10 @@
],
"offers": [
{
"price": 2.45,
"prices": {
"default": 3.45,
"student": 2.45,
"employee": 2.45
"employee": 3.45
},
"provider": {
"name": "Studentenwerk",

View File

@@ -41,10 +41,10 @@
}
},
"prices": {
"default": 6.5,
"student": 4.9,
"employee": 6.5
},
"price": 6.5,
"provider": {
"name": "Studentenwerk",
"origin": {