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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -16,8 +16,8 @@ import {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
import {SCISO8601Date} from '../types/Time';
import {SCInPlace} from './../types/Places';
/**
* 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>
extends SCThing {
@@ -58,11 +68,6 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
* List of offers for that thing
*/
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,9 +13,12 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree';
import {SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCDateSeriesWithoutReferences} from './DateSeries';
@@ -24,9 +27,8 @@ import {SCOrganization} from './Organization';
/**
* A course of studies without references
*/
export interface SCCourseOfStudiesWithoutReferences extends
SCAcademicDegree,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree,
SCThingThatCanBeOfferedWithoutReferences {
/**
* The main language in which the course of studies
* is beeing offered
@@ -64,14 +66,15 @@ export interface SCCourseOfStudiesWithoutReferences extends
*
* @validatable
*/
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/**
* The department that manages the course of studies
*/
department: SCOrganization;
/**
* The secretary that administers requests and
* The secretary that administers requests and
* questions concerning the course of studies
*/
secretary: SCOrganization;
@@ -81,6 +84,11 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
*/
startDates?: SCDateSeriesWithoutReferences[];
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
/**
* Type of the course of studies
*/
@@ -88,7 +96,7 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
}
export interface SCCourseOfStudiesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
extends SCThingThatCanBeOfferedTranslatableProperties {
}
/**
@@ -100,19 +108,19 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
*/
fieldTranslations = {
de: {
... SCAcademicDegreeMeta.getInstance().fieldTranslations.de,
...SCAcademicDegreeMeta.getInstance().fieldTranslations.de,
},
en: {
... SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
...SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
fieldValueTranslations = {
de: {
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
modes: {
combination: 'Kombinationsstudiengang',
dual: 'Dualer Studiengang',
@@ -122,7 +130,7 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
type: 'Studiengang',
},
en: {
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
academicDegree: 'Hochschulabschluss',
department: 'Fachbereich',
major: 'Studienfach',
@@ -136,13 +144,13 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
/**
* Types of (german) course of studies modes
*/
export type SCCourseOfStudiesMode = 'combination' |
'dual' |
'double-degree' |
'standard' ;
export type SCCourseOfStudiesMode = 'combination'
| 'dual'
| 'double-degree'
| 'standard' ;
/**
* Types of (german) course of studies time modes
*/
export type SCCourseOfStudiesTimeMode = 'fulltime' |
'parttime' ;
export type SCCourseOfStudiesTimeMode = 'fulltime'
| '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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -17,6 +17,7 @@ import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
@@ -38,8 +39,7 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/**
* A date without references
*/
export interface SCDateSeriesWithoutReferences
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
/**
* Dates of the date series that are initially planned to be held
*/
@@ -76,7 +76,9 @@ export interface SCDateSeriesWithoutReferences
*
* @validatable
*/
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace {
export interface SCDateSeries extends SCDateSeriesWithoutReferences,
SCThingInPlace,
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
/**
* Event to which the date series belongs
*/
@@ -108,26 +110,26 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
*/
fieldTranslations = {
de: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
},
en: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
fieldValueTranslations = {
de: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
dates: 'Einzeltermine',
duration: 'Dauer',
frequency: 'Wiederholung',
type: 'Wiederholungreihe',
},
en: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
type: SCThingType.DateSeries,
},
};

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -16,6 +16,7 @@ import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {
SCThingWithCategoriesSpecificValues,
@@ -29,12 +30,8 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/**
* A dish without references
*/
export interface SCDishWithoutReferences
extends SCThingWithCategoriesWithoutReferences<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
/**
* Additives of the dish
*/
@@ -71,7 +68,8 @@ export interface SCDishWithoutReferences
*
* @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)
*/
@@ -173,22 +171,22 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
*/
fieldTranslations = {
de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
},
en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
fieldValueTranslations = {
de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: {
appetizer: 'Vorspeise',
dessert: 'Nachtisch',
@@ -200,8 +198,8 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
type: 'Essen',
},
en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Dish,
},
};