fix: resolve issues with things that can be offered

Fixes #41
This commit is contained in:
Karl-Philipp Wulfert
2019-04-03 11:19:24 +02:00
parent fd994e2c08
commit 623ed613a9
4 changed files with 68 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2019 StApps * Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,8 +16,8 @@ import {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization'; import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person'; import {SCPersonWithoutReferences} from '../things/Person';
import {SCTranslations} from '../types/i18n'; import {SCTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
import {SCISO8601Date} from '../types/Time'; import {SCISO8601Date} from '../types/Time';
import {SCInPlace} from './../types/Places';
/** /**
* Default price without distinction * Default price without distinction
@@ -50,7 +50,17 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
} }
/** /**
* A thing without references that has a price tag * A thing without references that can be offered
*/
export interface SCThingThatCanBeOfferedWithoutReferences extends SCThing {
/**
* Translations of a thing that can be offered
*/
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
}
/**
* A thing that can be offered
*/ */
export interface SCThingThatCanBeOffered<T extends SCPriceGroup> export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
extends SCThing { extends SCThing {
@@ -58,11 +68,6 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
* List of offers for that thing * List of offers for that thing
*/ */
offers?: Array<SCThingThatCanBeOfferedOffer<T>>; offers?: Array<SCThingThatCanBeOfferedOffer<T>>;
/**
* Translations of a thing that can be offered
*/
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
} }
/** /**

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 * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,9 +13,12 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree'; import {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree';
import {SCAcademicPriceGroup, import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered'; SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCDateSeriesWithoutReferences} from './DateSeries'; import {SCDateSeriesWithoutReferences} from './DateSeries';
@@ -24,9 +27,8 @@ import {SCOrganization} from './Organization';
/** /**
* A course of studies without references * A course of studies without references
*/ */
export interface SCCourseOfStudiesWithoutReferences extends export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree,
SCAcademicDegree, SCThingThatCanBeOfferedWithoutReferences {
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* The main language in which the course of studies * The main language in which the course of studies
* is beeing offered * is beeing offered
@@ -64,7 +66,8 @@ export interface SCCourseOfStudiesWithoutReferences extends
* *
* @validatable * @validatable
*/ */
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences { export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* The department that manages the course of studies * The department that manages the course of studies
*/ */
@@ -81,6 +84,11 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
*/ */
startDates?: SCDateSeriesWithoutReferences[]; startDates?: SCDateSeriesWithoutReferences[];
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
/** /**
* Type of the course of studies * Type of the course of studies
*/ */
@@ -136,13 +144,13 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
/** /**
* Types of (german) course of studies modes * Types of (german) course of studies modes
*/ */
export type SCCourseOfStudiesMode = 'combination' | export type SCCourseOfStudiesMode = 'combination'
'dual' | | 'dual'
'double-degree' | | 'double-degree'
'standard' ; | 'standard' ;
/** /**
* Types of (german) course of studies time modes * Types of (german) course of studies time modes
*/ */
export type SCCourseOfStudiesTimeMode = 'fulltime' | export type SCCourseOfStudiesTimeMode = 'fulltime'
'parttime' ; | 'parttime' ;

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 * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -17,6 +17,7 @@ import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCMetaTranslations, SCTranslations} from '../types/i18n';
@@ -38,8 +39,7 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/** /**
* A date without references * A date without references
*/ */
export interface SCDateSeriesWithoutReferences export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
/** /**
* Dates of the date series that are initially planned to be held * Dates of the date series that are initially planned to be held
*/ */
@@ -76,7 +76,9 @@ export interface SCDateSeriesWithoutReferences
* *
* @validatable * @validatable
*/ */
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace { export interface SCDateSeries extends SCDateSeriesWithoutReferences,
SCThingInPlace,
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
/** /**
* Event to which the date series belongs * Event to which the date series belongs
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2019 StApps * Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,6 +16,7 @@ import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from '../base/ThingThatCanBeOffered';
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
@@ -29,12 +30,8 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* A dish without references * A dish without references
*/ */
export interface SCDishWithoutReferences export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences,
extends SCThingWithCategoriesWithoutReferences< SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
SCDishCategories,
SCThingWithCategoriesSpecificValues
>,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* Additives of the dish * Additives of the dish
*/ */
@@ -71,7 +68,8 @@ export interface SCDishWithoutReferences
* *
* @validatable * @validatable
*/ */
export interface SCDish extends SCDishWithoutReferences { export interface SCDish extends SCDishWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish) * Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
*/ */