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 {
SCThingThatCanBeOffered, SCAcademicPriceGroup,
SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered'; SCThingThatCanBeOffered,
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,14 +66,15 @@ 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
*/ */
department: SCOrganization; department: SCOrganization;
/** /**
* The secretary that administers requests and * The secretary that administers requests and
* questions concerning the course of studies * questions concerning the course of studies
*/ */
secretary: SCOrganization; secretary: SCOrganization;
@@ -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
*/ */
@@ -88,7 +96,7 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
} }
export interface SCCourseOfStudiesTranslatableProperties export interface SCCourseOfStudiesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties { extends SCThingThatCanBeOfferedTranslatableProperties {
} }
/** /**
@@ -100,19 +108,19 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCAcademicDegreeMeta.getInstance().fieldTranslations.de, ...SCAcademicDegreeMeta.getInstance().fieldTranslations.de,
}, },
en: { en: {
... SCAcademicDegreeMeta.getInstance().fieldTranslations.en, ...SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
}, },
}; };
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de, ...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
modes: { modes: {
combination: 'Kombinationsstudiengang', combination: 'Kombinationsstudiengang',
dual: 'Dualer Studiengang', dual: 'Dualer Studiengang',
@@ -122,7 +130,7 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
type: 'Studiengang', type: 'Studiengang',
}, },
en: { en: {
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en, ...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
academicDegree: 'Hochschulabschluss', academicDegree: 'Hochschulabschluss',
department: 'Fachbereich', department: 'Fachbereich',
major: 'Studienfach', major: 'Studienfach',
@@ -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
*/ */
@@ -108,26 +110,26 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.de, ...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
}, },
en: { en: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.en, ...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
}, },
}; };
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de, ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
dates: 'Einzeltermine', dates: 'Einzeltermine',
duration: 'Dauer', duration: 'Dauer',
frequency: 'Wiederholung', frequency: 'Wiederholung',
type: 'Wiederholungreihe', type: 'Wiederholungreihe',
}, },
en: { en: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
type: SCThingType.DateSeries, 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 * 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)
*/ */
@@ -173,22 +171,22 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
}, },
en: { en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
}, },
}; };
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: { categories: {
appetizer: 'Vorspeise', appetizer: 'Vorspeise',
dessert: 'Nachtisch', dessert: 'Nachtisch',
@@ -200,8 +198,8 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
type: 'Essen', type: 'Essen',
}, },
en: { en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Dish, type: SCThingType.Dish,
}, },
}; };