From ca72c20bd098032745ed0eb6978902b6ff6feac5 Mon Sep 17 00:00:00 2001 From: Karl-Philipp Wulfert Date: Tue, 14 May 2019 17:57:10 +0200 Subject: [PATCH] fix: adjust model to remove references from things without references Fixes #69 --- src/core/base/AcademicDegree.ts | 38 +++++++++------ src/core/base/AcademicTerm.ts | 26 +++++++---- src/core/base/CreativeWork.ts | 22 +++++---- src/core/base/Event.ts | 21 +++++---- src/core/base/Place.ts | 36 ++++++++++---- src/core/base/SaveableThing.ts | 27 ++++++----- src/core/base/ThingInPlace.ts | 18 ++++--- src/core/base/ThingThatAcceptsPayments.ts | 29 ++++++++---- src/core/base/ThingThatCanBeOffered.ts | 15 ++++-- src/core/base/ThingWithCategories.ts | 35 +++++++++----- src/core/base/ThingWithTranslations.ts | 23 --------- src/core/things/AcademicEvent.ts | 38 ++++++++------- src/core/things/Article.ts | 37 ++++++++------- src/core/things/Book.ts | 16 ++++--- src/core/things/Building.ts | 47 ++++++++++--------- src/core/things/Catalog.ts | 45 +++++++++++------- src/core/things/CourseOfStudies.ts | 26 +++++++---- src/core/things/DateSeries.ts | 17 ++++--- src/core/things/Diff.ts | 22 +++++---- src/core/things/Dish.ts | 15 ++++-- src/core/things/Favorite.ts | 11 +++-- src/core/things/Floor.ts | 25 ++++++---- src/core/things/Message.ts | 20 ++++---- src/core/things/Organization.ts | 8 ++-- src/core/things/Person.ts | 22 +++++---- src/core/things/PointOfInterest.ts | 40 +++++++++------- src/core/things/Room.ts | 57 +++++++++++++---------- src/core/things/Semester.ts | 26 +++++++---- src/core/things/Setting.ts | 31 +++++++----- src/core/things/SportCourse.ts | 28 ++++++----- src/core/things/StudyModule.ts | 56 ++++++++++++++-------- src/core/things/Ticket.ts | 22 +++++---- src/core/things/ToDo.ts | 39 ++++++++++------ src/core/things/Tour.ts | 12 +++-- src/core/things/Video.ts | 20 ++++---- src/core/types/Guards.ts | 15 +++--- 36 files changed, 585 insertions(+), 400 deletions(-) delete mode 100644 src/core/base/ThingWithTranslations.ts diff --git a/src/core/base/AcademicDegree.ts b/src/core/base/AcademicDegree.ts index 3465011b..9cb5128e 100644 --- a/src/core/base/AcademicDegree.ts +++ b/src/core/base/AcademicDegree.ts @@ -12,39 +12,46 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing} from '../Thing'; -import {SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; /** * An academic degree without references */ -export interface SCAcademicDegreeWithoutReferences extends SCThing { +export interface SCAcademicDegreeWithoutReferences + extends SCThingWithoutReferences { /** * The achievable academic degree */ academicDegree: SCGermanAcademicDegree; /** - * The achievable academic degree with academic field specification + * The achievable academic degree with academic field specification * (eg. Master of Science) */ academicDegreewithField: string; /** - * The achievable academic degree with academic field specification + * The achievable academic degree with academic field specification * shorted (eg. M.Sc.). */ academicDegreewithFieldShort: string; } -export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences { +/** + * An academic degree + */ +export interface SCAcademicDegree + extends SCAcademicDegreeWithoutReferences, SCThing { + // noop } /** * Meta information about academic degrees */ -export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations { +export class SCAcademicDegreeMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ @@ -86,11 +93,12 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati /** * Types of (german) academic degrees */ -export type SCGermanAcademicDegree = 'bachelor' | - 'diploma' | - 'doctor' | - 'licentiate' | - 'magister' | - 'master' | - 'master pupil' | - 'state examination' ; +export type SCGermanAcademicDegree = + 'bachelor' + | 'diploma' + | 'doctor' + | 'licentiate' + | 'magister' + | 'master' + | 'master pupil' + | 'state examination' ; diff --git a/src/core/base/AcademicTerm.ts b/src/core/base/AcademicTerm.ts index 988472a0..dad5f1df 100644 --- a/src/core/base/AcademicTerm.ts +++ b/src/core/base/AcademicTerm.ts @@ -12,14 +12,15 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; import {SCISO8601Date} from '../types/Time'; /** * An academic term without references */ -export interface SCAcademicTermWithoutReferences extends SCThing { +export interface SCAcademicTermWithoutReferences + extends SCThingWithoutReferences { /** * Short name of the academic term, using the given pattern */ @@ -46,31 +47,40 @@ export interface SCAcademicTermWithoutReferences extends SCThing { startDate: SCISO8601Date; } +/** + * An academic term + */ +export interface SCAcademicTerm + extends SCAcademicTermWithoutReferences, SCThing { + // noop +} + /** * Meta information about academic terms */ -export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations { +export class SCAcademicTermWithoutReferencesMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } diff --git a/src/core/base/CreativeWork.ts b/src/core/base/CreativeWork.ts index b1df1cec..089b5bf0 100644 --- a/src/core/base/CreativeWork.ts +++ b/src/core/base/CreativeWork.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing'; +import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCOrganizationWithoutReferences} from '../things/Organization'; import {SCPersonWithoutReferences} from '../things/Person'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; @@ -21,12 +21,14 @@ import { SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingThatCanBeOfferedTranslatableProperties, + SCThingThatCanBeOfferedWithoutReferences, } from './ThingThatCanBeOffered'; /** * A creative work without references */ -export interface SCCreativeWorkWithoutReferences extends SCThing { +export interface SCCreativeWorkWithoutReferences + extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences { /** * Date the creative work was published */ @@ -51,7 +53,8 @@ export interface SCCreativeWorkWithoutReferences extends SCThing { /** * A creative work */ -export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered { +export interface SCCreativeWork + extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered { /** * Authors of the creative work */ @@ -82,28 +85,29 @@ export interface SCCreativeWorkTranslatableProperties /** * Meta information about creative works */ -export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations { +export class SCCreativeWorkMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } diff --git a/src/core/base/Event.ts b/src/core/base/Event.ts index 80e12410..b11ac4be 100644 --- a/src/core/base/Event.ts +++ b/src/core/base/Event.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCCatalogWithoutReferences} from '../things/Catalog'; import {SCPersonWithoutReferences} from '../things/Person'; import {SCSemesterWithoutReferences} from '../things/Semester'; @@ -22,7 +22,8 @@ import {SCCreativeWorkWithoutReferences} from './CreativeWork'; /** * An event without references */ -export interface SCEventWithoutReferences extends SCThing { +export interface SCEventWithoutReferences + extends SCThingWithoutReferences { /** * Maximum number of participants of the event * @@ -41,7 +42,8 @@ export interface SCEventWithoutReferences extends SCThing { /** * An event */ -export interface SCEvent extends SCEventWithoutReferences { +export interface SCEvent + extends SCEventWithoutReferences, SCThing { /** * Academic terms that an event belongs to, e.g. semester(s). */ @@ -73,28 +75,29 @@ export interface SCEvent extends SCEventWithoutReferences { /** * Meta information about events */ -export class SCEventMeta extends SCThingMeta implements SCMetaTranslations { +export class SCEventMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } diff --git a/src/core/base/Place.ts b/src/core/base/Place.ts index bc02d564..9034817e 100644 --- a/src/core/base/Place.ts +++ b/src/core/base/Place.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing'; +import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCGeoInformation} from '../types/GeoInformation'; import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCPostalAddress} from '../types/PostalAddress'; @@ -20,7 +20,8 @@ import {SCPostalAddress} from '../types/PostalAddress'; /** * A place without references */ -export interface SCPlaceWithoutReferences extends SCThing { +export interface SCPlaceWithoutReferences + extends SCThingWithoutReferences { /** * Address of the place */ @@ -44,38 +45,53 @@ export interface SCPlaceWithoutReferences extends SCThing { * Translated fields of a place */ translations?: SCTranslations; - } -export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties { +/** + * A place + */ +export interface SCPlace + extends SCPlaceWithoutReferences, SCThing { + /** + * Translated fields of a place + */ + translations?: SCTranslations; +} + +/** + * Translatable properties of a place without references + */ +export interface SCPlaceWithoutReferencesTranslatableProperties + extends SCThingTranslatableProperties { address?: SCPostalAddress; } /** * Meta information about creative works */ -export class SCPlaceWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations { +export class SCPlaceWithoutReferencesMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } diff --git a/src/core/base/SaveableThing.ts b/src/core/base/SaveableThing.ts index cfea8ab8..ea598382 100644 --- a/src/core/base/SaveableThing.ts +++ b/src/core/base/SaveableThing.ts @@ -12,24 +12,27 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingUserOrigin} from '../Thing'; +import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from '../Thing'; /** * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. */ -export interface SCSaveableThingWithoutReferences extends SCThing { +export interface SCSaveableThingWithoutReferences + extends SCThingWithoutReferences { + // noop +} + +/** + * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. + */ +export interface SCSaveableThing + extends SCSaveableThingWithoutReferences, SCThing { + /** + * The contained data + */ + data: T; /** * Type of the origin */ origin: SCThingUserOrigin; } - -/** - * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. - */ -export interface SCSaveableThing extends SCSaveableThingWithoutReferences { - /** - * The contained data - */ - data: T; -} diff --git a/src/core/base/ThingInPlace.ts b/src/core/base/ThingInPlace.ts index ee891e8e..f5cb2b52 100644 --- a/src/core/base/ThingInPlace.ts +++ b/src/core/base/ThingInPlace.ts @@ -19,22 +19,26 @@ import {SCInPlace} from '../types/Places'; /** * A thing that is or happens in a place */ -export interface SCThingInPlace extends SCThing, SCInPlace {} +export interface SCThingInPlace + extends SCThing, SCInPlace { + // noop +} /** * Meta information about thing in a place */ -export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations { +export class SCThingInPlaceMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, inPlace: 'Ort', }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, inPlace: 'location', }, }; @@ -42,12 +46,12 @@ export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslation /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } diff --git a/src/core/base/ThingThatAcceptsPayments.ts b/src/core/base/ThingThatAcceptsPayments.ts index 67216a30..c2f29d21 100644 --- a/src/core/base/ThingThatAcceptsPayments.ts +++ b/src/core/base/ThingThatAcceptsPayments.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; /** @@ -24,41 +24,50 @@ export type SCThingThatAcceptsPaymentsAcceptedPayments = | 'Cafeteria Card'; /** - * A place without references that accepts payments + * A thing without references that accepts payments */ -export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThing { +export interface SCThingThatAcceptsPaymentsWithoutReferences + extends SCThingWithoutReferences { /** * Accepted payments of the place */ paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[]; } +/** + * A thing that accepts payments + */ +export interface SCThingThatAcceptsPayments + extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing { + // noop +} + /** * Meta information about a thing without references that accepts payments */ -export class SCThingThatAcceptsPaymentsWithoutReferencesMeta extends SCThingMeta implements - SCMetaTranslations { +export class SCThingThatAcceptsPaymentsWithoutReferencesMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } diff --git a/src/core/base/ThingThatCanBeOffered.ts b/src/core/base/ThingThatCanBeOffered.ts index cec374ca..a1949d08 100644 --- a/src/core/base/ThingThatCanBeOffered.ts +++ b/src/core/base/ThingThatCanBeOffered.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingTranslatableProperties} from '../Thing'; +import {SCThing, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCOrganizationWithoutReferences} from '../things/Organization'; import {SCPersonWithoutReferences} from '../things/Person'; import {SCTranslations} from '../types/i18n'; @@ -32,7 +32,8 @@ export interface SCPriceGroup { /** * Price distinctions for academic context */ -export interface SCAcademicPriceGroup extends SCPriceGroup { +export interface SCAcademicPriceGroup + extends SCPriceGroup { /** * Price for employees */ @@ -52,7 +53,8 @@ export interface SCAcademicPriceGroup extends SCPriceGroup { /** * A thing without references that can be offered */ -export interface SCThingThatCanBeOfferedWithoutReferences extends SCThing { +export interface SCThingThatCanBeOfferedWithoutReferences + extends SCThingWithoutReferences { /** * Translations of a thing that can be offered */ @@ -63,11 +65,16 @@ export interface SCThingThatCanBeOfferedWithoutReferences extends SCThing { * A thing that can be offered */ export interface SCThingThatCanBeOffered - extends SCThing { + extends SCThing, SCThingThatCanBeOfferedWithoutReferences { /** * List of offers for that thing */ offers?: Array>; + + /** + * Translations of a thing that can be offered + */ + translations?: SCTranslations; } /** diff --git a/src/core/base/ThingWithCategories.ts b/src/core/base/ThingWithCategories.ts index 3d5b8039..fd0a3179 100644 --- a/src/core/base/ThingWithCategories.ts +++ b/src/core/base/ThingWithCategories.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing'; +import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCMap} from '../types/Map'; @@ -22,9 +22,8 @@ import {SCMap} from '../types/Map'; * !!! BEWARE !!! * `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';` */ -export interface SCThingWithCategoriesWithoutReferences - extends SCThing { +export interface SCThingWithCategoriesWithoutReferences + extends SCThingWithoutReferences { /** * Categories of a thing with categories */ @@ -43,10 +42,22 @@ export interface SCThingWithCategoriesWithoutReferences; } +/** + * A thing with categories + */ +export interface SCThingWithCategories + extends SCThing, SCThingWithCategoriesWithoutReferences { + /** + * Translated fields of a thing with categories + */ + translations?: SCTranslations; +} + /** * Translatable properties of a thing with categories */ -export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties { +export interface SCThingWithCategoriesTranslatableProperties + extends SCThingTranslatableProperties { /** * translations of the categories of a thing with categories */ @@ -88,8 +99,8 @@ export interface SCThingWithCategoriesSpecificValues { /** * Meta information about a thing without references that accepts payments */ -export class SCThingWithCategoriesWithoutReferencesMeta implements - SCMetaTranslations> { +export class SCThingWithCategoriesWithoutReferencesMeta + implements SCMetaTranslations> { protected static _instance: SCThingMeta; @@ -98,22 +109,22 @@ export class SCThingWithCategoriesWithoutReferencesMeta implements */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; diff --git a/src/core/base/ThingWithTranslations.ts b/src/core/base/ThingWithTranslations.ts deleted file mode 100644 index 875c5857..00000000 --- a/src/core/base/ThingWithTranslations.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 . - */ -import {SCThing, SCThingTranslatableProperties} from '../Thing'; -import {SCTranslations} from '../types/i18n'; - -/** - * A thing that has translations - */ -export interface SCThingWithTranslations extends SCThing { - translations: SCTranslations; -} diff --git a/src/core/things/AcademicEvent.ts b/src/core/things/AcademicEvent.ts index 09641e55..eeff25db 100644 --- a/src/core/things/AcademicEvent.ts +++ b/src/core/things/AcademicEvent.ts @@ -14,6 +14,7 @@ */ import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, @@ -27,8 +28,7 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n'; */ export interface SCAcademicEventWithoutReferences extends SCEventWithoutReferences, - SCThingWithCategoriesWithoutReferences { + SCThingWithCategoriesWithoutReferences { /** * Majors of the academic event that this event belongs to */ @@ -55,7 +55,9 @@ export interface SCAcademicEventWithoutReferences * * @validatable */ -export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences { +export interface SCAcademicEvent + extends SCEvent, SCAcademicEventWithoutReferences, + SCThingWithCategories { /** * Translated fields of an academic event */ @@ -104,37 +106,39 @@ export interface SCAcademicEventTranslatableProperties /** * Meta information about academic events */ -export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations { +export class SCAcademicEventMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCEventMeta.getInstance().fieldTranslations.de, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCEventMeta.getInstance().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, }, en: { - ... SCEventMeta.getInstance().fieldTranslations.en, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCEventMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCEventMeta.getInstance().fieldValueTranslations.de, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCEventMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, type: 'akademische Veranstaltung', }, en: { - ... SCEventMeta.getInstance().fieldValueTranslations.en, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCEventMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.AcademicEvent, }, }; diff --git a/src/core/things/Article.ts b/src/core/things/Article.ts index 35f95f32..f0d2d758 100644 --- a/src/core/things/Article.ts +++ b/src/core/things/Article.ts @@ -19,6 +19,7 @@ import { SCCreativeWorkWithoutReferences, } from '../base/CreativeWork'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, @@ -32,8 +33,7 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n'; */ export interface SCArticleWithoutReferences extends SCCreativeWorkWithoutReferences, - SCThingWithCategoriesWithoutReferences { + SCThingWithCategoriesWithoutReferences { /** * Article itself as markdown */ @@ -55,7 +55,9 @@ export interface SCArticleWithoutReferences * * @validatable */ -export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences { +export interface SCArticle + extends SCCreativeWork, SCArticleWithoutReferences, + SCThingWithCategories { /** * Translated fields of an article */ @@ -86,37 +88,38 @@ export interface SCArticleTranslatableProperties /** * Meta information about an article */ -export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations { +export class SCArticleMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCCreativeWorkMeta.getInstance().fieldTranslations.de, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCCreativeWorkMeta.getInstance().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, }, en: { - ... SCCreativeWorkMeta.getInstance().fieldTranslations.en, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCCreativeWorkMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, type: 'Artikel', }, en: { - ... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Article, }, }; diff --git a/src/core/things/Book.ts b/src/core/things/Book.ts index d407fbb6..db28b11c 100644 --- a/src/core/things/Book.ts +++ b/src/core/things/Book.ts @@ -26,7 +26,8 @@ import {SCPersonWithoutReferences} from './Person'; /** * A book without references */ -export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences { +export interface SCBookWithoutReferences + extends SCCreativeWorkWithoutReferences { /** * Edition of a book */ @@ -58,7 +59,8 @@ export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences * * @validatable */ -export interface SCBook extends SCCreativeWork, SCBookWithoutReferences { +export interface SCBook + extends SCCreativeWork, SCBookWithoutReferences { /** * Authors of the creative work */ @@ -95,23 +97,23 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations. */ import { + SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta, SCPlaceWithoutReferencesTranslatableProperties, } from '../base/Place'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, @@ -37,8 +39,7 @@ export type SCBuildingCategories = | 'restroom'; export interface SCBuildingWithoutReferences - extends SCThingWithCategoriesWithoutReferences, + extends SCThingWithCategoriesWithoutReferences, SCPlaceWithoutReferences { /** * Categories of a building @@ -66,7 +67,9 @@ export interface SCBuildingWithoutReferences * * @validatable */ -export interface SCBuilding extends SCBuildingWithoutReferences { +export interface SCBuilding + extends SCBuildingWithoutReferences, SCPlace, + SCThingWithCategories { /** * Translated fields of a building */ @@ -79,39 +82,41 @@ export interface SCBuilding extends SCBuildingWithoutReferences { } export interface SCBuildingTranslatableProperties - extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties { + extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties { floors?: string[]; } - /** - * Meta information about a place - */ -export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations { +/** + * Meta information about a place + */ +export class SCBuildingMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de, floors: 'Etagen', }, en: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de, categories: { 'cafe': 'Café', 'canteen': 'Kantine', @@ -125,9 +130,9 @@ export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.en, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Building, }, }; diff --git a/src/core/things/Catalog.ts b/src/core/things/Catalog.ts index 1e4b0291..f1cfc8ff 100644 --- a/src/core/things/Catalog.ts +++ b/src/core/things/Catalog.ts @@ -14,19 +14,20 @@ */ import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, + SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta, } from '../base/ThingWithCategories'; -import {SCThingMeta, SCThingType} from '../Thing'; -import {SCMetaTranslations} from '../types/i18n'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCMetaTranslations, SCTranslations} from '../types/i18n'; /** * A catalog without references */ export interface SCCatalogWithoutReferences - extends SCThingWithCategoriesWithoutReferences { + extends SCThingWithCategoriesWithoutReferences { /** * Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.) * @@ -45,7 +46,9 @@ export interface SCCatalogWithoutReferences * * @validatable */ -export interface SCCatalog extends SCCatalogWithoutReferences { +export interface SCCatalog + extends SCCatalogWithoutReferences, SCThing, + SCThingWithCategories { /** * Academic term that a catalog belongs to (e.g. semester) */ @@ -61,42 +64,48 @@ export interface SCCatalog extends SCCatalogWithoutReferences { */ superCatalogs?: SCCatalogWithoutReferences[]; + /** + * Translated fields of a catalog + */ + translations?: SCTranslations; + /** * Type of a catalog */ type: SCThingType.Catalog; } - /** - * Catalog meta data - */ -export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations { +/** + * Catalog meta data + */ +export class SCCatalogMeta + extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, type: 'Verzeichnis', }, en: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Catalog, }, }; diff --git a/src/core/things/CourseOfStudies.ts b/src/core/things/CourseOfStudies.ts index d84c5ad4..f3f0a506 100644 --- a/src/core/things/CourseOfStudies.ts +++ b/src/core/things/CourseOfStudies.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree'; +import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from '../base/AcademicDegree'; import { SCAcademicPriceGroup, SCThingThatCanBeOffered, @@ -22,13 +22,13 @@ import { import {SCThingMeta, SCThingType} from '../Thing'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCDateSeriesWithoutReferences} from './DateSeries'; -import {SCOrganization} from './Organization'; +import {SCOrganizationWithoutReferences} from './Organization'; /** * A course of studies without references */ -export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree, - SCThingThatCanBeOfferedWithoutReferences { +export interface SCCourseOfStudiesWithoutReferences + extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences { /** * The main language in which the course of studies * is beeing offered @@ -66,18 +66,18 @@ export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree, * * @validatable */ -export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences, - SCThingThatCanBeOffered { +export interface SCCourseOfStudies + extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered, SCAcademicDegree { /** * The department that manages the course of studies */ - department: SCOrganization; + department: SCOrganizationWithoutReferences; /** * The secretary that administers requests and * questions concerning the course of studies */ - secretary: SCOrganization; + secretary: SCOrganizationWithoutReferences; /** * Dates at which the course of studies is planned to start @@ -85,7 +85,7 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences, startDates?: SCDateSeriesWithoutReferences[]; /** - * Translated fields of a dish + * Translated fields of a course of studies */ translations?: SCTranslations; @@ -95,14 +95,20 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences, type: SCThingType.CourseOfStudies; } +/** + * Translatable properties of a course of studies + */ export interface SCCourseOfStudiesTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties { + // noop } /** * Meta information about a course of studies */ -export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslations { +export class SCCourseOfStudiesMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/core/things/DateSeries.ts b/src/core/things/DateSeries.ts index 5dba61ed..7f0a813a 100644 --- a/src/core/things/DateSeries.ts +++ b/src/core/things/DateSeries.ts @@ -29,7 +29,8 @@ import {SCSportCourseWithoutReferences} from './SportCourse'; /** * Price groups for sport courses */ -export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup { +export interface SCSportCoursePriceGroup + extends SCAcademicPriceGroup { /** * Price for alumnis */ @@ -39,7 +40,8 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup { /** * A date without references */ -export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences { +export interface SCDateSeriesWithoutReferences + extends SCThingThatCanBeOfferedWithoutReferences { /** * Dates of the date series that are initially planned to be held */ @@ -76,9 +78,10 @@ export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWi * * @validatable */ -export interface SCDateSeries extends SCDateSeriesWithoutReferences, - SCThingInPlace, - SCThingThatCanBeOffered { +export interface SCDateSeries + extends SCDateSeriesWithoutReferences, + SCThingInPlace, + SCThingThatCanBeOffered { /** * Event to which the date series belongs */ @@ -104,7 +107,9 @@ export interface SCDateSeries extends SCDateSeriesWithoutReferences, /** * Meta information about a date series */ -export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations { +export class SCDateSeriesMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/core/things/Diff.ts b/src/core/things/Diff.ts index 44be0293..e7900680 100644 --- a/src/core/things/Diff.ts +++ b/src/core/things/Diff.ts @@ -14,14 +14,15 @@ */ import * as jsonpatch from 'json-patch'; import {SCThingsWithoutDiff} from '../Classes'; -import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; import {SCISO8601Date} from '../types/Time'; /** * A diff without references */ -export interface SCDiffWithoutReferences extends SCThing { +export interface SCDiffWithoutReferences + extends SCThingWithoutReferences { /** * Action of the diff */ @@ -48,7 +49,8 @@ export interface SCDiffWithoutReferences extends SCThing { * * @validatable */ -export interface SCDiff extends SCDiffWithoutReferences { +export interface SCDiff + extends SCDiffWithoutReferences, SCThing { /** * Original object the diff was generated on */ @@ -63,32 +65,34 @@ export interface SCDiff extends SCDiffWithoutReferences { /** * Meta information about a diff */ -export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations { +export class SCDiffMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, action: 'Aktion', changes: 'Änderungen', dateCreated: 'Erstellungsdatum', }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, type: 'Unterschied', }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Diff, }, }; diff --git a/src/core/things/Dish.ts b/src/core/things/Dish.ts index 8e13c022..0a072835 100644 --- a/src/core/things/Dish.ts +++ b/src/core/things/Dish.ts @@ -19,6 +19,7 @@ import { SCThingThatCanBeOfferedWithoutReferences, } from '../base/ThingThatCanBeOffered'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, @@ -30,8 +31,9 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n'; /** * A dish without references */ -export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences, - SCThingWithCategoriesWithoutReferences { +export interface SCDishWithoutReferences + extends SCThingThatCanBeOfferedWithoutReferences, + SCThingWithCategoriesWithoutReferences { /** * Additives of the dish */ @@ -68,8 +70,9 @@ export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutR * * @validatable */ -export interface SCDish extends SCDishWithoutReferences, - SCThingThatCanBeOffered { +export interface SCDish + extends SCDishWithoutReferences, SCThingThatCanBeOffered, + SCThingWithCategories { /** * Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish) */ @@ -165,7 +168,9 @@ export interface SCNutritionInformation { /** * Meta information about a dish */ -export class SCDishMeta extends SCThingMeta implements SCMetaTranslations { +export class SCDishMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/core/things/Favorite.ts b/src/core/things/Favorite.ts index 59793cf1..83594a27 100644 --- a/src/core/things/Favorite.ts +++ b/src/core/things/Favorite.ts @@ -40,8 +40,9 @@ export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences /** * A favorite without references */ -export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences { - +export interface SCFavoriteWithoutReferences + extends SCSaveableThingWithoutReferences { + // noop } /** @@ -49,7 +50,8 @@ export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutRefer * * @validatable */ -export interface SCFavorite extends SCSaveableThing { +export interface SCFavorite + extends SCSaveableThing, SCFavoriteWithoutReferences { /** * Type of a favorite */ @@ -59,5 +61,6 @@ export interface SCFavorite extends SCSaveableThing { /** * Meta information about a favorite */ -export class SCFavoriteMeta extends SCThingMeta { +export class SCFavoriteMeta + extends SCThingMeta { } diff --git a/src/core/things/Floor.ts b/src/core/things/Floor.ts index 3b131ce2..993ab9d6 100644 --- a/src/core/things/Floor.ts +++ b/src/core/things/Floor.ts @@ -14,7 +14,7 @@ */ import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson'; import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; -import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingType} from '../Thing'; +import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCRoomWithoutReferences} from './Room'; @@ -22,7 +22,8 @@ import {SCRoomWithoutReferences} from './Room'; /** * A floor without references */ -export interface SCFloorWithoutReferences extends SCThing { +export interface SCFloorWithoutReferences + extends SCThingWithoutReferences { /** * Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name. */ @@ -49,7 +50,8 @@ export interface SCFloorWithoutReferences extends SCThing { * * @validatable */ -export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace { +export interface SCFloor + extends SCFloorWithoutReferences, SCThingInPlace { /** * Translated fields of a floor */ @@ -86,7 +88,8 @@ export interface SCFloorFeatureWithPlace /** * Translatable properties of a floor */ -export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties { +export interface SCFloorTranslatableProperties + extends SCThingTranslatableProperties { /** * Translation of the floor name */ @@ -96,29 +99,31 @@ export interface SCFloorTranslatableProperties extends SCThingTranslatableProper /** * Meta information about floors */ -export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations { +export class SCFloorMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ 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, type: 'Etage', }, en: { - ... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, + ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Floor, }, }; diff --git a/src/core/things/Message.ts b/src/core/things/Message.ts index 5d105b0c..2613f0a8 100644 --- a/src/core/things/Message.ts +++ b/src/core/things/Message.ts @@ -26,7 +26,8 @@ import {SCISO8601Date} from '../types/Time'; /** * A message without references */ -export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferences { +export interface SCMessageWithoutReferences + extends SCCreativeWorkWithoutReferences { /** * Audience of the message */ @@ -58,7 +59,8 @@ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferen * * @validatable */ -export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences { +export interface SCMessage + extends SCCreativeWork, SCMessageWithoutReferences { /** * Translated fields of a message */ @@ -92,29 +94,31 @@ export interface SCMessageTranslatableProperties /** * Meta information about messages */ -export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations { +export class SCMessageMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCCreativeWorkMeta.getInstance().fieldTranslations.de, + ...SCCreativeWorkMeta.getInstance().fieldTranslations.de, }, en: { - ... SCCreativeWorkMeta.getInstance().fieldTranslations.en, + ...SCCreativeWorkMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de, + ...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de, type: 'Nachricht', }, en: { - ... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en, + ...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Message, }, }; diff --git a/src/core/things/Organization.ts b/src/core/things/Organization.ts index 867cbe16..20194054 100644 --- a/src/core/things/Organization.ts +++ b/src/core/things/Organization.ts @@ -13,12 +13,13 @@ * this program. If not, see . */ import {SCThingInPlace} from '../base/ThingInPlace'; -import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; /** * An organization without references */ -export interface SCOrganizationWithoutReferences extends SCThing { +export interface SCOrganizationWithoutReferences + extends SCThingWithoutReferences { /** * Type of an organization */ @@ -30,7 +31,8 @@ export interface SCOrganizationWithoutReferences extends SCThing { * * @validatable */ -export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace { +export interface SCOrganization + extends SCOrganizationWithoutReferences, SCThingInPlace { /** * Type of an organization */ diff --git a/src/core/things/Person.ts b/src/core/things/Person.ts index d4e3212c..c2c18b42 100644 --- a/src/core/things/Person.ts +++ b/src/core/things/Person.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations, SCNationality} from '../types/i18n'; import {SCISO8601Date} from '../types/Time'; import {SCBuildingWithoutReferences} from './Building'; @@ -23,7 +23,8 @@ import {SCRoomWithoutReferences} from './Room'; /** * A person without references */ -export interface SCPersonWithoutReferences extends SCThing { +export interface SCPersonWithoutReferences + extends SCThingWithoutReferences { /** * Additional first names of the person. */ @@ -102,7 +103,8 @@ export interface SCPersonWithoutReferences extends SCThing { * * @validatable */ -export interface SCPerson extends SCPersonWithoutReferences { +export interface SCPerson + extends SCPersonWithoutReferences, SCThing { /** * Organization the person works for */ @@ -129,29 +131,31 @@ export interface SCPerson extends SCPersonWithoutReferences { /** * Meta information about a person */ -export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations { +export class SCPersonMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, type: 'Person', }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Person, }, }; diff --git a/src/core/things/PointOfInterest.ts b/src/core/things/PointOfInterest.ts index 4745bbec..13a9b60a 100644 --- a/src/core/things/PointOfInterest.ts +++ b/src/core/things/PointOfInterest.ts @@ -12,9 +12,10 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place'; +import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place'; import {SCThingInPlace} from '../base/ThingInPlace'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, @@ -27,8 +28,7 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n'; * A point of interest without references */ export interface SCPointOfInterestWithoutReferences - extends SCThingWithCategoriesWithoutReferences, + extends SCThingWithCategoriesWithoutReferences, SCPlaceWithoutReferences { /** * Translated properties of a point of interest @@ -46,7 +46,9 @@ export interface SCPointOfInterestWithoutReferences * * @validatable */ -export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace { +export interface SCPointOfInterest + extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace, + SCThingWithCategories { /** * Translated properties of a point of interest */ @@ -71,39 +73,41 @@ export type SCPointOfInterestCategories = /** * Meta information about points of interest */ -export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations { +export class SCPointOfInterestMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { // tslint:disable-next-line:max-line-length - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de, }, en: { // tslint:disable-next-line:max-line-length - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de, type: 'Sonderziel', }, en: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, - ... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.PointOfInterest, }, }; diff --git a/src/core/things/Room.ts b/src/core/things/Room.ts index 4dfe50d0..cc8d8d59 100644 --- a/src/core/things/Room.ts +++ b/src/core/things/Room.ts @@ -12,13 +12,15 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place'; +import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place'; import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; import { + SCThingThatAcceptsPayments, SCThingThatAcceptsPaymentsWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferencesMeta, } from '../base/ThingThatAcceptsPayments'; import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, @@ -81,7 +83,9 @@ export interface SCRoomWithoutReferences * * @validatable */ -export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace { +export interface SCRoom + extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace, + SCThingWithCategories { /** * Translations of specific values of the object * @@ -98,7 +102,8 @@ export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace { /** * Category specific values of a room */ -export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues { +export interface SCRoomSpecificValues + extends SCThingWithCategoriesSpecificValues { /** * Category specific opening hours of the room */ @@ -108,37 +113,39 @@ export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValue /** * Meta information about a place */ -export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations { +export class SCRoomMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de, - ... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.de, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, - ... SCThingInPlaceMeta.getInstance().fieldTranslations.de, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCThingInPlaceMeta.getInstance().fieldTranslations.de, }, en: { - ... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en, - ... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.en, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, - ... SCThingInPlaceMeta.getInstance().fieldTranslations.en, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingInPlaceMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de, - ... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.de, - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, - ... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de, categories: { 'cafe': 'Café', 'canteen': 'Kantine', @@ -157,11 +164,11 @@ export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.en, - ... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, + ...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Room, }, }; diff --git a/src/core/things/Semester.ts b/src/core/things/Semester.ts index e1b89b16..4bf17c67 100644 --- a/src/core/things/Semester.ts +++ b/src/core/things/Semester.ts @@ -12,14 +12,19 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCAcademicTermWithoutReferences, SCAcademicTermWithoutReferencesMeta} from '../base/AcademicTerm'; +import { + SCAcademicTerm, + SCAcademicTermWithoutReferences, + SCAcademicTermWithoutReferencesMeta, +} from '../base/AcademicTerm'; import {SCThingMeta, SCThingType} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; /** * A semester without references */ -export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences { +export interface SCSemesterWithoutReferences + extends SCAcademicTermWithoutReferences { /** * The short name of the semester, using the given pattern. * @@ -38,7 +43,8 @@ export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutRefere * * @validatable */ -export interface SCSemester extends SCSemesterWithoutReferences { +export interface SCSemester + extends SCSemesterWithoutReferences, SCAcademicTerm { /** * Type of the semester */ @@ -48,13 +54,15 @@ export interface SCSemester extends SCSemesterWithoutReferences { /** * Meta information about a semester */ -export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations { +export class SCSemesterMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de, + ...SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de, acronym: 'Abkürzung', endDate: 'Ende', eventsEndDate: 'Vorlesungsschluss', @@ -62,20 +70,20 @@ export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations. */ import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta, } from '../base/ThingWithCategories'; -import {SCThingMeta, SCThingType} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; import {SCMetaTranslations, SCTranslations} from '../types/i18n'; export type SCSettingCategories = string; @@ -74,7 +75,13 @@ export enum SCSettingInputType { * * @validatable */ -export interface SCSetting extends SCSettingWithoutReferences { +export interface SCSetting + extends SCSettingWithoutReferences, SCThing, + SCThingWithCategories { + /** + * Translated fields of a setting + */ + translations?: SCTranslations; /** * The type of this model */ @@ -111,8 +118,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, defaultValue: 'Standard Wert', inputType: 'Eingabetyp', value: 'Wert', @@ -120,8 +127,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, defaultValue: 'default value', inputType: 'input type', }, @@ -130,24 +137,24 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, inputType: { 'multiple choice': 'mehrfach Auswahl', number: 'Zahl', password: 'Passwort', 'single choice': 'einfache Auswahl', text: 'Text', - }, + }, type: 'Einstellung', }, en: { // tslint:disable-next-line:max-line-length - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Setting, }, }; diff --git a/src/core/things/SportCourse.ts b/src/core/things/SportCourse.ts index 90069db3..62068619 100644 --- a/src/core/things/SportCourse.ts +++ b/src/core/things/SportCourse.ts @@ -19,7 +19,8 @@ import {SCMetaTranslations} from '../types/i18n'; /** * A sport course without references */ -export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences { +export interface SCSportCourseWithoutReferences + extends SCEventWithoutReferences { /** * Type of a sport course */ @@ -31,7 +32,8 @@ export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences * * @validatable */ -export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences { +export interface SCSportCourse + extends SCEvent, SCSportCourseWithoutReferences { /** * Type of a sport course */ @@ -41,33 +43,35 @@ export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences { /** * Meta information about a sport course */ -export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations { +export class SCSportCourseMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, - ... SCEventMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, + ...SCEventMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, - ... SCEventMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, + ...SCEventMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, - ... SCEventMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCEventMeta.getInstance().fieldValueTranslations.de, type: 'Sportkurs', }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, - ... SCEventMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCEventMeta.getInstance().fieldValueTranslations.en, type: SCThingType.SportCourse, }, }; diff --git a/src/core/things/StudyModule.ts b/src/core/things/StudyModule.ts index 39696544..a5a1738b 100644 --- a/src/core/things/StudyModule.ts +++ b/src/core/things/StudyModule.ts @@ -12,9 +12,12 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -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 {SCMap} from '../types/Map'; @@ -25,8 +28,8 @@ import {SCPersonWithoutReferences} from './Person'; /** * A study module without references */ -export interface SCStudyModuleWithoutReferences extends - SCThingThatCanBeOffered { +export interface SCStudyModuleWithoutReferences + extends SCThingThatCanBeOfferedWithoutReferences { /** * ECTS points (European Credit Transfer System) @@ -61,10 +64,11 @@ export interface SCStudyModuleWithoutReferences extends /** * A study module - * + * * @validatable */ -export interface SCStudyModule extends SCStudyModuleWithoutReferences { +export interface SCStudyModule + extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered { /** * Academic events that make up a study module */ @@ -86,14 +90,24 @@ export interface SCStudyModule extends SCStudyModuleWithoutReferences { requiredModules?: SCStudyModuleWithoutReferences[]; /** - * The secretary that administers requests and + * The secretary that administers requests and * questions concerning the study module by eg. students */ secretary: SCOrganizationWithoutReferences | SCPersonWithoutReferences; + + /** + * Translated fields of a study module + */ + translations?: SCTranslations; + + /** + * Type of the study module + */ + type: SCThingType.StudyModule; } export interface SCStudyModuleTranslatableProperties - extends SCThingThatCanBeOfferedTranslatableProperties { + extends SCThingThatCanBeOfferedTranslatableProperties { /** * Translations of the majors that this study module is meant for */ @@ -105,8 +119,8 @@ export interface SCStudyModuleTranslatableProperties necessity: SCMap; } -/** - * Represents a modules necessity (in a major) as it may be required, optional or +/** + * Represents a modules necessity (in a major) as it may be required, optional or * is in a pool of n optional modules were m out of them have to be taken/completed. * Hence the elective option. */ @@ -119,13 +133,15 @@ export enum SCStudyModuleNecessity { /** * Study module meta data */ -export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations { +export class SCStudyModuleMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCThingMeta.getInstance().fieldTranslations.de, + ...SCThingMeta.getInstance().fieldTranslations.de, academicEvents: 'Veranstaltungen', ects: 'ECTS-Punkte', faculty: 'Fachbereich', @@ -137,7 +153,7 @@ export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations secretary: 'Sekretariat', }, en: { - ... SCThingMeta.getInstance().fieldTranslations.en, + ...SCThingMeta.getInstance().fieldTranslations.en, academicEvents: 'academic events', ects: 'ECTS points', faculty: 'faculty', @@ -153,18 +169,18 @@ export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingMeta.getInstance().fieldValueTranslations.de, + ...SCThingMeta.getInstance().fieldValueTranslations.de, necessity: { - 'elective' : 'Wahlfach', - 'optional' : 'optional', - 'required' : 'benötigt', + 'elective': 'Wahlfach', + 'optional': 'optional', + 'required': 'benötigt', }, type: 'Studiengangmodul', }, en: { - ... SCThingMeta.getInstance().fieldValueTranslations.en, + ...SCThingMeta.getInstance().fieldValueTranslations.en, type: SCThingType.StudyModule, }, }; diff --git a/src/core/things/Ticket.ts b/src/core/things/Ticket.ts index 48b4afb5..c38c2450 100644 --- a/src/core/things/Ticket.ts +++ b/src/core/things/Ticket.ts @@ -13,14 +13,15 @@ * this program. If not, see . */ import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; -import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; import {SCISO8601Duration} from '../types/Time'; /** * A ticket without references */ -export interface SCTicketWithoutReferences extends SCThing { +export interface SCTicketWithoutReferences + extends SCThingWithoutReferences { /** * Approximate wait time */ @@ -47,7 +48,8 @@ export interface SCTicketWithoutReferences extends SCThing { * * @validatable */ -export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace { +export interface SCTicket + extends SCTicketWithoutReferences, SCThingInPlace { /** * Type of a ticket */ @@ -57,29 +59,31 @@ export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace { /** * Meta information about a ticket */ -export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations { +export class SCTicketMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ 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, type: 'Ticket', }, en: { - ... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, + ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Ticket, }, }; diff --git a/src/core/things/ToDo.ts b/src/core/things/ToDo.ts index 36dd4139..0485be17 100644 --- a/src/core/things/ToDo.ts +++ b/src/core/things/ToDo.ts @@ -13,11 +13,14 @@ * this program. If not, see . */ import { + SCThingWithCategories, SCThingWithCategoriesSpecificValues, + SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, - SCThingWithCategoriesWithoutReferencesMeta} from '../base/ThingWithCategories'; -import {SCThingMeta, SCThingType} from '../Thing'; -import {SCMetaTranslations} from '../types/i18n'; + SCThingWithCategoriesWithoutReferencesMeta, +} from '../base/ThingWithCategories'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCISO8601Date} from '../types/Time'; /** @@ -51,7 +54,17 @@ export interface SCToDoWithoutReferences * * @validatable */ -export interface SCToDo extends SCToDoWithoutReferences { +export interface SCToDo + extends SCToDoWithoutReferences, SCThing, SCThingWithCategories { + /** + * Translated fields of a thing with categories + */ + translations?: SCTranslations; + + /** + * Type of the "to do" + */ + type: SCThingType.ToDo; } /** @@ -72,27 +85,27 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, }, en: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, type: 'ToDo', }, en: { - ... SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, type: SCThingType.ToDo, }, }; diff --git a/src/core/things/Tour.ts b/src/core/things/Tour.ts index 253d0774..c843336e 100644 --- a/src/core/things/Tour.ts +++ b/src/core/things/Tour.ts @@ -12,13 +12,14 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta, SCThingType} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../types/i18n'; /** * A tour without references */ -export interface SCTourWithoutReferences extends SCThing { +export interface SCTourWithoutReferences + extends SCThingWithoutReferences { /** * Init script for the tour */ @@ -40,7 +41,8 @@ export interface SCTourWithoutReferences extends SCThing { * * @validatable */ -export interface SCTour extends SCTourWithoutReferences { +export interface SCTour + extends SCTourWithoutReferences, SCThing { /** * Type of a tour */ @@ -50,7 +52,9 @@ export interface SCTour extends SCTourWithoutReferences { /** * Meta information about a tour */ -export class SCTourMeta extends SCThingMeta implements SCMetaTranslations { +export class SCTourMeta + extends SCThingMeta + implements SCMetaTranslations { } /** diff --git a/src/core/things/Video.ts b/src/core/things/Video.ts index 2e75a561..3b1d6bbc 100644 --- a/src/core/things/Video.ts +++ b/src/core/things/Video.ts @@ -21,7 +21,8 @@ import {SCPersonWithoutReferences} from './Person'; /** * A video without references */ -export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReferences { +export interface SCVideoWithoutReferences + extends SCCreativeWorkWithoutReferences { /** * The Duration of the Video */ @@ -102,7 +103,8 @@ export interface SCVideoTrack { * * @validatable */ -export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences { +export interface SCVideo + extends SCCreativeWork, SCVideoWithoutReferences { /** * Persons acting in the Video */ @@ -117,29 +119,31 @@ export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences { /** * Meta information about a video */ -export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations { +export class SCVideoMeta + extends SCThingMeta + implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ... SCCreativeWorkMeta.getInstance().fieldTranslations.de, + ...SCCreativeWorkMeta.getInstance().fieldTranslations.de, }, en: { - ... SCCreativeWorkMeta.getInstance().fieldTranslations.en, + ...SCCreativeWorkMeta.getInstance().fieldTranslations.en, }, }; /** * Translations of values of fields */ - fieldValueTranslations = { + fieldValueTranslations = { de: { - ... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de, + ...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de, type: 'Video', }, en: { - ... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en, + ...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en, type: SCThingType.Video, }, }; diff --git a/src/core/types/Guards.ts b/src/core/types/Guards.ts index ac03e169..19d3e20b 100644 --- a/src/core/types/Guards.ts +++ b/src/core/types/Guards.ts @@ -12,16 +12,16 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThingWithTranslations} from '../base/ThingWithTranslations'; import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse'; import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse'; import {SCSearchResponse} from '../protocol/routes/search/SearchResponse'; -import {SCThing, SCThingType} from '../Thing'; +import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing'; +import {SCTranslations} from './i18n'; /** * Type guard to check if something is a SCThing * - * @param {any} something Something to check + * @param something Something to check */ export function isThing(something: any): something is SCThing { return ( @@ -34,16 +34,17 @@ export function isThing(something: any): something is SCThing { /** * Type guard to check if translations exist * - * @param {SCThing} thing Thing to check + * @param thing Thing to check */ -export function isThingWithTranslations(thing: SCThing): thing is SCThingWithTranslations { +export function isThingWithTranslations(thing: SCThingWithoutReferences) + : thing is SCThingWithoutReferences & { translations: SCTranslations } { return typeof thing.translations !== 'undefined'; } /** * Type guard to check if something is a bulk response * - * @param {any} something Something to check + * @param something Something to check */ export function isBulkResponse(something: any): something is SCBulkResponse { return typeof something.expiration === 'string' @@ -56,7 +57,7 @@ export function isBulkResponse(something: any): something is SCBulkResponse { /** * Type guard to check if something is a search response * - * @param {any} something Something to check + * @param something Something to check */ export function isSearchResponse(something: any): something is SCSearchResponse { return Array.isArray(something.data)