refactor: move location from the dish to its offers

This commit is contained in:
Michel Jonathan Schmitz
2019-02-22 10:02:11 +01:00
parent ac08d226e9
commit d2eeaeffd8
9 changed files with 102 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,19 +13,9 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing} from '../Thing';
import {SCBuildingWithoutReferences} from '../things/Building';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
import {SCRoomWithoutReferences} from '../things/Room';
import {SCInPlace} from '../types/Places';
/**
* A thing that is or happens in a place
*/
export interface SCThingInPlace extends SCThing {
/**
* Place the thing is or happens in
*/
inPlace?:
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
}
export interface SCThingInPlace extends SCThing, SCInPlace {}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,13 +13,11 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCBuildingWithoutReferences} from '../things/Building';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
import {SCRoomWithoutReferences} from '../things/Room';
import {SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {SCInPlace} from './../types/Places';
/**
* A map from group name to price
@@ -51,7 +49,8 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
/**
* A thing without references that has a price tag
*/
export interface SCThingThatCanBeOffered<T extends SCPriceGroup> extends SCThing {
export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
extends SCThing {
/**
* List of offers for that thing
*/
@@ -66,7 +65,8 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup> extends SCThing
/**
* Offer of a thing
*/
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> {
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
extends SCInPlace {
/**
* Availability of an offer
*/
@@ -101,7 +101,8 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> {
/**
* Translatable properties of a thing that can be offered
*/
export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
export interface SCThingThatCanBeOfferedTranslatableProperties
extends SCThingTranslatableProperties {
/**
* Availability of an offer
*/
@@ -109,20 +110,17 @@ export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTr
}
/**
* Possible things a provider can be
* Entity responsible for the offer
*/
export type SCThingThatCanBeOfferedProvider =
SCBuildingWithoutReferences
| SCOrganizationWithoutReferences
| SCPersonWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
| SCPersonWithoutReferences;
/**
* Availability of an Offer
*/
export type SCThingThatCanBeOfferedAvailability =
'in stock'
| 'in stock'
| 'out of stock'
| 'online only'
| 'limited availability';

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingInPlace} from '../base/ThingInPlace';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
@@ -30,8 +29,10 @@ import {SCTranslations} from '../types/i18n';
* A dish without references
*/
export interface SCDishWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCDishCategories,
SCThingWithCategoriesSpecificValues>,
extends SCThingWithCategoriesWithoutReferences<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/**
* Additives of the dish
@@ -69,7 +70,7 @@ export interface SCDishWithoutReferences
*
* @validatable
*/
export interface SCDish extends SCDishWithoutReferences, SCThingInPlace {
export interface SCDish extends SCDishWithoutReferences {
/**
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
*/
@@ -87,8 +88,8 @@ export interface SCDish extends SCDishWithoutReferences, SCThingInPlace {
}
export interface SCDishTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
}
extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {}
/**
* Dish meta data
@@ -121,7 +122,7 @@ export interface SCDishCharacteristic {
* A list of categories for dishes
*/
export type SCDishCategories =
'appetizer'
| 'appetizer'
| 'salad'
| 'main dish'
| 'dessert'

32
src/core/types/Places.ts Normal file
View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCBuildingWithoutReferences} from '../things/Building';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
import {SCRoomWithoutReferences} from '../things/Room';
/**
* Something that is or happens in a place
*
* !Important!
* This is not a SCThing.
*/
export interface SCInPlace {
/**
* Place the thing is or happens in
*/
inPlace?:
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
}