mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: move core to monorepo
This commit is contained in:
85
packages/core/src/things/abstract/academic-degree.ts
Normal file
85
packages/core/src/things/abstract/academic-degree.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* An academic degree without references
|
||||
*/
|
||||
export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* The achievable academic degree
|
||||
*
|
||||
* @filterable
|
||||
* @sortable ducet
|
||||
*/
|
||||
academicDegree: string;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* (eg. Master of Science)
|
||||
*
|
||||
*/
|
||||
academicDegreewithField?: string;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* shorted (eg. M.Sc.).
|
||||
*
|
||||
*/
|
||||
academicDegreewithFieldShort?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An academic degree
|
||||
*/
|
||||
export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic degrees
|
||||
*/
|
||||
export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
academicDegree: 'Abschlussgrad',
|
||||
academicDegreewithField: 'Abschlussbezeichnung',
|
||||
academicDegreewithFieldShort: 'Abschlussbezeichnung (kurz)',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
academicDegree: 'academic degree',
|
||||
academicDegreewithField: 'acedemic degree and discipline',
|
||||
academicDegreewithFieldShort: 'acedemic degree and discipline (short)',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
105
packages/core/src/things/abstract/academic-term.ts
Normal file
105
packages/core/src/things/abstract/academic-term.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../../general/i18n';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* An academic term without references
|
||||
*/
|
||||
export interface SCAcademicTermWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Short name of the academic term, using the given pattern
|
||||
*
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
/**
|
||||
* End date of the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
endDate: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* End date of lectures in the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
eventsEndDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Start date of lectures in the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
eventsStartDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Start date of the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
startDate: SCISO8601Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* An academic term
|
||||
*/
|
||||
export interface SCAcademicTerm extends SCAcademicTermWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic terms
|
||||
*/
|
||||
export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
acronym: 'Akronym',
|
||||
endDate: 'Enddatum',
|
||||
eventsEndDate: 'Enddatum der Veranstaltungen',
|
||||
eventsStartDate: 'Startdatum der Veranstaltungen',
|
||||
startDate: 'Startdatum',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
acronym: 'acronym',
|
||||
endDate: 'end date',
|
||||
eventsEndDate: 'end date of events',
|
||||
eventsStartDate: 'start date of events',
|
||||
startDate: 'start date',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
179
packages/core/src/things/abstract/creative-work.ts
Normal file
179
packages/core/src/things/abstract/creative-work.ts
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCOrganizationWithoutReferences} from '../organization';
|
||||
import {SCPersonWithoutReferences} from '../person';
|
||||
import {SCPublicationEventWithoutReferences} from '../publication-event';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* A creative work without references
|
||||
*/
|
||||
export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Languages this creative work is available in
|
||||
*/
|
||||
availableLanguages?: SCLanguageCode[];
|
||||
|
||||
/**
|
||||
* Date the creative work was published
|
||||
*/
|
||||
datePublished?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Edition of a creative work (e.g. the book edition or edition of an article)
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
edition?: string;
|
||||
|
||||
/**
|
||||
* Date (in text form) the creative work was published for the first time
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
firstPublished?: string;
|
||||
|
||||
/**
|
||||
* Languages this creative work is written/recorded/... in
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
inLanguage?: SCLanguageCode;
|
||||
|
||||
/**
|
||||
* Keywords of the creative work
|
||||
*
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
* Date (in text form) the creative work was most recently
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
lastPublished?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of the creative work
|
||||
*/
|
||||
translations?: SCTranslations<SCCreativeWorkTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A creative work
|
||||
*/
|
||||
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThing {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
authors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* A creative work to which the creative work belongs
|
||||
*/
|
||||
isPartOf?: SCCreativeWorkWithoutReferences;
|
||||
|
||||
/**
|
||||
* List of events at which the creative work was published
|
||||
*/
|
||||
publications?: SCPublicationEventWithoutReferences[];
|
||||
|
||||
/**
|
||||
* List of publishers of the creative work
|
||||
*/
|
||||
publishers?: Array<SCPersonWithoutReferences | SCOrganizationWithoutReferences>;
|
||||
|
||||
/**
|
||||
* A text representing on organization on whose behalf the creator was working
|
||||
*/
|
||||
sourceOrganization?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of the creative work
|
||||
*/
|
||||
translations?: SCTranslations<SCCreativeWorkTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of creative works
|
||||
*/
|
||||
export interface SCCreativeWorkTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the keywords of the creative work
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
keywords?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about creative works
|
||||
*/
|
||||
export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
name: 'Titel',
|
||||
authors: 'beteiligte Personen',
|
||||
availableLanguages: 'verfügbare Übersetzungen',
|
||||
datePublished: 'Veröffentlichungsdatum',
|
||||
edition: 'Ausgabe',
|
||||
firstPublished: 'erste Veröffentlichung',
|
||||
inLanguage: 'Inhaltssprache',
|
||||
isPartOf: 'erschienen in',
|
||||
keywords: 'Schlagwörter',
|
||||
lastPublished: 'aktuellste Veröffentlichung',
|
||||
publishers: 'Verleger',
|
||||
publications: 'Veröffentlichungen',
|
||||
sourceOrganization: 'Körperschaft',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
name: 'title',
|
||||
authors: 'involved persons',
|
||||
availableLanguages: 'available languages',
|
||||
datePublished: 'release date',
|
||||
edition: 'edition',
|
||||
firstPublished: 'first published',
|
||||
inLanguage: 'content language',
|
||||
isPartOf: 'published in',
|
||||
keywords: 'keywords',
|
||||
lastPublished: 'last published',
|
||||
publishers: 'publishers',
|
||||
publications: 'publications',
|
||||
sourceOrganization: 'corporation',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
118
packages/core/src/things/abstract/event.ts
Normal file
118
packages/core/src/things/abstract/event.ts
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../../general/i18n';
|
||||
import {SCCatalogWithoutReferences} from '../catalog';
|
||||
import {SCPersonWithoutReferences} from '../person';
|
||||
import {SCSemesterWithoutReferences} from '../semester';
|
||||
import {SCCreativeWorkWithoutReferences} from './creative-work';
|
||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* An event without references
|
||||
*/
|
||||
export interface SCEventWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Maximum number of participants of the event
|
||||
*
|
||||
* A maximum number of people that can participate in the event.
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
maximumParticipants?: number;
|
||||
|
||||
/**
|
||||
* Remaining attendee capacity of the event
|
||||
*
|
||||
* This number represents the remaining open spots.
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
remainingAttendeeCapacity?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event
|
||||
*/
|
||||
export interface SCEvent extends SCEventWithoutReferences, SCThing {
|
||||
/**
|
||||
* Academic terms that an event belongs to, e.g. semester(s).
|
||||
*/
|
||||
academicTerms?: SCSemesterWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Catalogs to which an event belongs
|
||||
*/
|
||||
catalogs?: SCCatalogWithoutReferences[];
|
||||
|
||||
/**
|
||||
* A list of creative works that are associated with this event
|
||||
*
|
||||
* This can be recommended books, CDs that can be bought, etc.
|
||||
*/
|
||||
creativeWorks?: SCCreativeWorkWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Organizers of the event
|
||||
*/
|
||||
organizers?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Performers of the event
|
||||
*/
|
||||
performers?: SCPersonWithoutReferences[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about events
|
||||
*/
|
||||
export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
academicTerms: 'Semester',
|
||||
catalogs: 'Verzeichnis',
|
||||
creativeWorks: 'begleitende Werke',
|
||||
maximumParticipants: 'maximale Anzahl an Teilnehmern',
|
||||
organizers: 'Origanisatoren',
|
||||
performers: 'Vortragende',
|
||||
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
academicTerms: 'academic terms',
|
||||
catalogs: 'catalogs',
|
||||
creativeWorks: 'related material',
|
||||
maximumParticipants: 'maximum participants',
|
||||
organizers: 'organizers',
|
||||
performers: 'performers',
|
||||
remainingAttendeeCapacity: 'remaining attendee capacity',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
183
packages/core/src/things/abstract/place.ts
Normal file
183
packages/core/src/things/abstract/place.ts
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Point, Polygon} from 'geojson';
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCBuildingWithoutReferences} from '../building';
|
||||
import {SCPointOfInterestWithoutReferences} from '../point-of-interest';
|
||||
import {SCRoomWithoutReferences} from '../room';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* Positional information
|
||||
*/
|
||||
export interface SCGeoInformation {
|
||||
/**
|
||||
* Center point of a place
|
||||
*/
|
||||
point: Point;
|
||||
/**
|
||||
* Shape of a place
|
||||
*/
|
||||
polygon?: Polygon;
|
||||
}
|
||||
|
||||
/**
|
||||
* A postal address
|
||||
*/
|
||||
export interface SCPostalAddress {
|
||||
/**
|
||||
* Country of the address
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
addressCountry: string;
|
||||
|
||||
/**
|
||||
* City of the address
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
addressLocality: string;
|
||||
|
||||
/**
|
||||
* State of the address
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
addressRegion?: string;
|
||||
|
||||
/**
|
||||
* Zip code of the address
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
postalCode: string;
|
||||
|
||||
/**
|
||||
* Optional post box number
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
postOfficeBoxNumber?: string;
|
||||
|
||||
/**
|
||||
* Street of the address - with house number!
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
streetAddress: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Address of the place
|
||||
*/
|
||||
address?: SCPostalAddress;
|
||||
|
||||
/**
|
||||
* Positional information of the place
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* Can not be a GeometryCollection because ElasticSearch does not allow distance filtering/sorting on other types
|
||||
*/
|
||||
geo: SCGeoInformation;
|
||||
|
||||
/**
|
||||
* Opening hours of the place
|
||||
*
|
||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||
* @keyword
|
||||
*/
|
||||
openingHours?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of a place
|
||||
*/
|
||||
translations?: SCTranslations<SCPlaceWithoutReferencesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A place
|
||||
*/
|
||||
export interface SCPlace extends SCPlaceWithoutReferences, SCThing {
|
||||
/**
|
||||
* Translated fields of a place
|
||||
*/
|
||||
translations?: SCTranslations<SCPlaceWithoutReferencesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Address of a place
|
||||
*/
|
||||
address?: SCPostalAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about creative works
|
||||
*/
|
||||
export class SCPlaceWithoutReferencesMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPlaceWithoutReferences>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
address: 'Adresse',
|
||||
geo: 'Geoinformation',
|
||||
openingHours: 'Öffnungszeiten',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
address: 'address',
|
||||
geo: 'geographic information',
|
||||
openingHours: 'opening hours',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Something that is or happens in a place
|
||||
*
|
||||
* !Important!
|
||||
* This is not a SCThing.
|
||||
*/
|
||||
export interface SCInPlace {
|
||||
/**
|
||||
* Place the thing is or happens in
|
||||
*/
|
||||
inPlace?: SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences;
|
||||
}
|
||||
66
packages/core/src/things/abstract/range.ts
Normal file
66
packages/core/src/things/abstract/range.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
|
||||
/**
|
||||
* Date Range
|
||||
*
|
||||
* CAUTION: Changing the name requires changes in the core-tools premaps
|
||||
*/
|
||||
export type SCISO8601DateRange = SCRange<SCISO8601Date>;
|
||||
|
||||
/**
|
||||
* Generic range type
|
||||
*/
|
||||
export type SCRange<T> =
|
||||
| {
|
||||
/**
|
||||
* Greater than value
|
||||
*/
|
||||
gt?: never;
|
||||
|
||||
/**
|
||||
* Greater or equal to value
|
||||
*/
|
||||
gte?: T;
|
||||
|
||||
/**
|
||||
* Greater than value
|
||||
*/
|
||||
lt?: never;
|
||||
|
||||
/**
|
||||
* Greater or equal to value
|
||||
*/
|
||||
lte?: T;
|
||||
}
|
||||
| {
|
||||
gt?: T;
|
||||
gte?: never;
|
||||
lt?: T;
|
||||
lte?: never;
|
||||
}
|
||||
| {
|
||||
gt?: T;
|
||||
gte?: never;
|
||||
lt?: never;
|
||||
lte?: T;
|
||||
}
|
||||
| {
|
||||
gt?: never;
|
||||
gte?: T;
|
||||
lt?: T;
|
||||
lte?: never;
|
||||
};
|
||||
35
packages/core/src/things/abstract/saveable-thing.ts
Normal file
35
packages/core/src/things/abstract/saveable-thing.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCIndexableThings} from '../../meta';
|
||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||
*/
|
||||
export type SCSaveableThingWithoutReferences = SCThingWithoutReferences;
|
||||
|
||||
/**
|
||||
* 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: SCIndexableThings;
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
origin: SCThingUserOrigin;
|
||||
}
|
||||
55
packages/core/src/things/abstract/thing-in-place.ts
Normal file
55
packages/core/src/things/abstract/thing-in-place.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../../general/i18n';
|
||||
import {SCInPlace} from './place';
|
||||
import {SCThing, SCThingMeta} from './thing';
|
||||
|
||||
/**
|
||||
* A thing that is or happens in a place
|
||||
*/
|
||||
export interface SCThingInPlace extends SCThing, SCInPlace {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about thing in a place
|
||||
*/
|
||||
export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
inPlace: 'Ort',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
inPlace: 'location',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* Types of payment that are accepted at a place.
|
||||
*/
|
||||
export type SCThingThatAcceptsPaymentsAcceptedPayments = 'cash' | 'credit' | 'cafeteria card';
|
||||
|
||||
/**
|
||||
* A thing without references that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Accepted payments of the place
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
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<SCThingThatAcceptsPaymentsWithoutReferences>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
paymentsAccepted: 'Bezahlmethoden',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
paymentsAccepted: 'accepted payment methods',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
paymentsAccepted: {
|
||||
'cafeteria card': 'Mensakarte',
|
||||
'cash': 'Bar',
|
||||
'credit': 'Kreditkarte',
|
||||
},
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
173
packages/core/src/things/abstract/thing-that-can-be-offered.ts
Normal file
173
packages/core/src/things/abstract/thing-that-can-be-offered.ts
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCOrganizationWithoutReferences} from '../organization';
|
||||
import {SCPersonWithoutReferences} from '../person';
|
||||
import {SCInPlace} from './place';
|
||||
import {SCISO8601DateRange} from './range';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* Default price without distinction
|
||||
*/
|
||||
export interface SCPriceGroup {
|
||||
/**
|
||||
* Default price of the thing
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
default: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Price distinctions for academic context
|
||||
*/
|
||||
export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
/**
|
||||
* Price for employees
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
employee?: number;
|
||||
|
||||
/**
|
||||
* Price for guests
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
guest?: number;
|
||||
|
||||
/**
|
||||
* Price for students
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
student?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing without references that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Translations of a thing that can be offered
|
||||
*/
|
||||
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
|
||||
extends SCThing,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* List of offers for that thing
|
||||
*/
|
||||
offers?: Array<SCThingThatCanBeOfferedOffer<T>>;
|
||||
|
||||
/**
|
||||
* Translations of a thing that can be offered
|
||||
*/
|
||||
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Offer of a thing
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> extends SCInPlace {
|
||||
/**
|
||||
* Availability of an offer
|
||||
*/
|
||||
availability: SCThingThatCanBeOfferedAvailability;
|
||||
|
||||
/**
|
||||
* The time when the thing is available.
|
||||
*/
|
||||
availabilityRange?: SCISO8601DateRange;
|
||||
|
||||
/**
|
||||
* List of prices that are distinct for specific groups
|
||||
*/
|
||||
prices?: T;
|
||||
|
||||
/**
|
||||
* Provider of an offer
|
||||
*/
|
||||
provider: SCThingThatCanBeOfferedProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a thing that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Availability of an offer
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
'offers[].availability'?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity responsible for the offer
|
||||
*/
|
||||
export type SCThingThatCanBeOfferedProvider = SCOrganizationWithoutReferences | SCPersonWithoutReferences;
|
||||
|
||||
/**
|
||||
* Availability of an Offer
|
||||
*/
|
||||
export type SCThingThatCanBeOfferedAvailability =
|
||||
| 'in stock'
|
||||
| 'out of stock'
|
||||
| 'online only'
|
||||
| 'limited availability';
|
||||
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
|
||||
implements SCMetaTranslations<SCThingThatCanBeOffered<T>>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
offers: 'Angebote',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
offers: 'offers',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
150
packages/core/src/things/abstract/thing-with-categories.ts
Normal file
150
packages/core/src/things/abstract/thing-with-categories.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCMap} from '../../general/map';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* A thing without references with categories
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* `T` should be a string literal union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
||||
*/
|
||||
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Categories of a thing with categories
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
*/
|
||||
categories: T[];
|
||||
|
||||
/**
|
||||
* Use this to explicitly override general opening hours brought in scope by openingHoursSpecification or openingHours
|
||||
*
|
||||
* A map from categories to their specific values.
|
||||
*/
|
||||
categorySpecificValues?: SCMap<U>;
|
||||
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing with categories
|
||||
*/
|
||||
export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThing,
|
||||
SCThingWithCategoriesWithoutReferences<T, U> {
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a thing with categories
|
||||
*/
|
||||
export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* translations of the categories of a thing with categories
|
||||
*
|
||||
* @sortable ducet
|
||||
*/
|
||||
categories?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Category specific values of a thing with categories
|
||||
*
|
||||
* This interface contains properties that can be specific to a certain category.
|
||||
*/
|
||||
export interface SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific alternate names of a thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
|
||||
/**
|
||||
* Category specific description of a thing
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* URL of a category specific image of a thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Category specific name of a thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Category specific URL of a thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
* It intentionally does not extend the SCThingMeta implementation to be able to include generics.
|
||||
*/
|
||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
categories: 'Kategorien',
|
||||
categorySpecificValues: 'besondere Kategorien',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
categories: 'categories',
|
||||
categorySpecificValues: 'category with specific values',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
314
packages/core/src/things/abstract/thing.ts
Normal file
314
packages/core/src/things/abstract/thing.ts
Normal file
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCMap} from '../../general/map';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCUuid} from '../../general/uuid';
|
||||
import {SCOrganizationWithoutReferences} from '../organization';
|
||||
import {SCPersonWithoutReferences} from '../person';
|
||||
|
||||
/**
|
||||
* Types a thing can be
|
||||
*/
|
||||
export enum SCThingType {
|
||||
Assessment = 'assessment',
|
||||
AcademicEvent = 'academic event',
|
||||
Article = 'article',
|
||||
Book = 'book',
|
||||
Periodical = 'periodical',
|
||||
Building = 'building',
|
||||
Catalog = 'catalog',
|
||||
Certification = 'certification',
|
||||
ContactPoint = 'contact point',
|
||||
CourseOfStudy = 'course of study',
|
||||
DateSeries = 'date series',
|
||||
Diff = 'diff',
|
||||
Dish = 'dish',
|
||||
Favorite = 'favorite',
|
||||
Floor = 'floor',
|
||||
Message = 'message',
|
||||
Organization = 'organization',
|
||||
Person = 'person',
|
||||
PointOfInterest = 'point of interest',
|
||||
PublicationEvent = 'publication event',
|
||||
Room = 'room',
|
||||
Semester = 'semester',
|
||||
Setting = 'setting',
|
||||
SportCourse = 'sport course',
|
||||
StudyModule = 'study module',
|
||||
Ticket = 'ticket',
|
||||
ToDo = 'todo',
|
||||
Tour = 'tour',
|
||||
Video = 'video',
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing without references
|
||||
*/
|
||||
export interface SCThingWithoutReferences {
|
||||
/**
|
||||
* Alternate names of the thing
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
|
||||
/**
|
||||
* Description of the thing
|
||||
*
|
||||
* @minLength 1
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* The identifier property represents any kind of additional identifier for any kind of SCThing
|
||||
*
|
||||
* E.g. GTIN codes, UUIDs, Database IDs etc.
|
||||
*/
|
||||
identifiers?: SCMap<string>;
|
||||
|
||||
/**
|
||||
* URL of an image of the thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Name of the thing
|
||||
*
|
||||
* @filterable
|
||||
* @minLength 1
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* URL of a reference Web page that unambiguously indicates the item's identity
|
||||
*
|
||||
* E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.
|
||||
*/
|
||||
sameAs?: string;
|
||||
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @filterable
|
||||
* @aggregatable global
|
||||
*/
|
||||
type: SCThingType;
|
||||
|
||||
/**
|
||||
* Universally unique identifier of the thing
|
||||
*/
|
||||
uid: SCUuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing
|
||||
*/
|
||||
export interface SCThing extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin: SCThingRemoteOrigin | SCThingUserOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible types of an origin
|
||||
*/
|
||||
export enum SCThingOriginType {
|
||||
Remote = 'remote',
|
||||
User = 'user',
|
||||
}
|
||||
|
||||
/**
|
||||
* Origin of a thing
|
||||
*/
|
||||
export interface SCThingOrigin {
|
||||
/**
|
||||
* Maintainer of the origin
|
||||
*
|
||||
* e.g. restaurant of a dish
|
||||
*/
|
||||
maintainer?: SCPersonWithoutReferences | SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* When the thing was modified last in the origin
|
||||
*/
|
||||
modified?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
type: SCThingOriginType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remote origin of a thing
|
||||
*/
|
||||
export interface SCThingRemoteOrigin extends SCThingOrigin {
|
||||
/**
|
||||
* When the thing was indexed last from the origin
|
||||
*/
|
||||
indexed: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Name of the origin
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Original ID of the thing in the origin
|
||||
*/
|
||||
originalId?: string;
|
||||
|
||||
/**
|
||||
* Entity that is responsible for the entity
|
||||
*
|
||||
* e.g. an organizer for an event
|
||||
*/
|
||||
responsibleEntity?: SCPersonWithoutReferences | SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
type: SCThingOriginType.Remote;
|
||||
|
||||
/**
|
||||
* Main URL of the origin
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* User origin of a thing (data created through user interaction)
|
||||
*/
|
||||
export interface SCThingUserOrigin extends SCThingOrigin {
|
||||
/**
|
||||
* When the thing was created
|
||||
*/
|
||||
created: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* If it is deleted or not, defaults to false
|
||||
*/
|
||||
deleted?: boolean;
|
||||
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
type: SCThingOriginType.User;
|
||||
|
||||
/**
|
||||
* When the saved thing was last updated with the latest state (e.g. from the backend)
|
||||
*/
|
||||
updated?: SCISO8601Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of things
|
||||
*/
|
||||
export interface SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the description of the thing
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Translation of the name of the thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin?: SCThingTranslatablePropertyOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable property of an origin
|
||||
*/
|
||||
export interface SCThingTranslatablePropertyOrigin {
|
||||
/**
|
||||
* Translation of the name of the origin
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about things
|
||||
*/
|
||||
export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
alternateNames: 'alternative Namen',
|
||||
description: 'Beschreibung',
|
||||
identifiers: 'Alternative Identifikation',
|
||||
image: 'Bild',
|
||||
name: 'Name',
|
||||
origin: 'Ursprung',
|
||||
sameAs: 'ursprünglicher Link',
|
||||
translations: 'Übersetzungen',
|
||||
type: 'Typ',
|
||||
uid: 'Identifikation',
|
||||
},
|
||||
en: {
|
||||
alternateNames: 'alternate names',
|
||||
description: 'description',
|
||||
identifiers: 'alternative identification',
|
||||
image: 'image',
|
||||
name: 'name',
|
||||
origin: 'origin',
|
||||
sameAs: 'original link',
|
||||
translations: 'translations',
|
||||
type: 'type',
|
||||
uid: 'identification',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
type: 'Ding',
|
||||
},
|
||||
en: {
|
||||
type: 'Thing',
|
||||
},
|
||||
};
|
||||
}
|
||||
18
packages/core/src/things/abstract/user-groups.ts
Normal file
18
packages/core/src/things/abstract/user-groups.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Types of data consumers
|
||||
*/
|
||||
export type SCUserGroup = 'students' | 'employees' | 'guests';
|
||||
186
packages/core/src/things/academic-event.ts
Normal file
186
packages/core/src/things/academic-event.ts
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* An academic event without references
|
||||
*/
|
||||
export interface SCAcademicEventWithoutReferences
|
||||
extends SCEventWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Majors of the academic event that this event belongs to
|
||||
*
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Original unmapped category from the source of the academic event
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
originalCategory?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
*/
|
||||
translations?: SCTranslations<SCAcademicEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an academic event
|
||||
*/
|
||||
type: SCThingType.AcademicEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* An academic event
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCAcademicEvent
|
||||
extends SCEvent,
|
||||
SCAcademicEventWithoutReferences,
|
||||
SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
*/
|
||||
translations?: SCTranslations<SCAcademicEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an academic event
|
||||
*/
|
||||
type: SCThingType.AcademicEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of academic events
|
||||
*/
|
||||
export type SCAcademicEventCategories =
|
||||
| 'lecture'
|
||||
| 'seminar'
|
||||
| 'integrated course'
|
||||
| 'written exam'
|
||||
| 'oral exam'
|
||||
| 'tutorial'
|
||||
| 'project'
|
||||
| 'colloquium'
|
||||
| 'practicum'
|
||||
| 'introductory class'
|
||||
| 'course'
|
||||
| 'practicum introduction'
|
||||
| 'excursion'
|
||||
| 'exercise'
|
||||
| 'special';
|
||||
|
||||
/**
|
||||
* Translatable properties of an academic event
|
||||
*/
|
||||
export interface SCAcademicEventTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* Translations of the majors of the academic event that this event belongs to
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Translation of the original unmapped category from the source of the academic event
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
originalCategory?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic events
|
||||
*/
|
||||
export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
majors: 'Hauptfächer',
|
||||
originalCategory: 'ursprüngliche Kategorie',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
majors: 'majors',
|
||||
originalCategory: 'original category',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'colloquium': 'Kolloquium',
|
||||
'course': 'Kurs',
|
||||
'excursion': 'Exkursion',
|
||||
'exercise': 'Übung',
|
||||
'integrated course': 'Integrierter Kurs',
|
||||
'introductory class': 'Einführungsveranstaltung',
|
||||
'lecture': 'Vorlesung',
|
||||
'oral exam': 'mündliche Prüfung',
|
||||
'practicum': 'Praktikum',
|
||||
'practicum introduction': 'Einführungspraktikum',
|
||||
'project': 'Projekt',
|
||||
'seminar': 'Seminar',
|
||||
'special': 'Sonderveranstalltung',
|
||||
'tutorial': 'Tutorium',
|
||||
'written exam': 'Schriftilche Prüfung',
|
||||
},
|
||||
type: 'akademische Veranstaltung',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.AcademicEvent,
|
||||
},
|
||||
};
|
||||
}
|
||||
183
packages/core/src/things/article.ts
Normal file
183
packages/core/src/things/article.ts
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCPeriodicalWithoutReferences} from './periodical';
|
||||
|
||||
/**
|
||||
* Categories of an article
|
||||
*/
|
||||
export type SCArticleCategories = 'unipedia' | 'article' | 'eArticle';
|
||||
|
||||
/**
|
||||
* An article without references
|
||||
*/
|
||||
export interface SCArticleWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Article itself as markdown
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
articleBody?: string;
|
||||
|
||||
/**
|
||||
* Categories of an article
|
||||
*/
|
||||
categories: SCArticleCategories[];
|
||||
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
translations?: SCTranslations<SCArticleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an article
|
||||
*/
|
||||
type: SCThingType.Article;
|
||||
}
|
||||
|
||||
/**
|
||||
* An article
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCArticle
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCArticleWithoutReferences {
|
||||
/**
|
||||
* A periodical to which this article belongs
|
||||
*/
|
||||
isPartOf?: SCPeriodicalWithoutReferences;
|
||||
/**
|
||||
* Additional information about how to find the article inside of its "parent" (which is provided in 'isPartOf')
|
||||
* e.g. "40, 2011, S. 2-3"
|
||||
*/
|
||||
reference?: string;
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
translations?: SCTranslations<SCArticleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an article
|
||||
*/
|
||||
type: SCThingType.Article;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of an article
|
||||
*/
|
||||
export interface SCArticleTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of the article itself as markdown
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
articleBody?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about an article
|
||||
*/
|
||||
export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCArticle> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
categories: 'Format',
|
||||
reference: 'Referenz',
|
||||
articleBody: 'Artikelinhalt',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
categories: 'format',
|
||||
reference: 'reference',
|
||||
articleBody: 'article body',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
article: 'Artikel',
|
||||
eArticle: 'E-Aufsatz',
|
||||
unipedia: 'Unipedia',
|
||||
},
|
||||
type: 'Artikel',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Article,
|
||||
categories: {
|
||||
article: 'article',
|
||||
eArticle: 'E-Article',
|
||||
unipedia: 'unipedia',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
174
packages/core/src/things/assessment.ts
Normal file
174
packages/core/src/things/assessment.ts
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCCourseOfStudyWithoutReferences} from './course-of-study';
|
||||
|
||||
/**
|
||||
* Categories of assessments
|
||||
*/
|
||||
export type SCAssessmentCategories = 'university assessment';
|
||||
|
||||
/**
|
||||
* An assessment without references
|
||||
*
|
||||
*/
|
||||
export interface SCAssessmentWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
> {
|
||||
/**
|
||||
* Number of attempts
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
attempt?: number;
|
||||
|
||||
/**
|
||||
* Date assessment was taken or graded
|
||||
*/
|
||||
date?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* ECTS (credit-points)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
ects?: number;
|
||||
|
||||
/**
|
||||
* Grade
|
||||
*/
|
||||
grade: string;
|
||||
|
||||
/**
|
||||
* Current status
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an assessment
|
||||
*/
|
||||
translations?: SCTranslations<SCAssessmentTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an assessment
|
||||
*/
|
||||
type: SCThingType.Assessment;
|
||||
}
|
||||
|
||||
/**
|
||||
* An assessment
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCAssessment
|
||||
extends SCAssessmentWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Course of study the assessment was taken for
|
||||
*/
|
||||
courseOfStudy?: SCCourseOfStudyWithoutReferences;
|
||||
|
||||
/**
|
||||
* An array of assessments from the 'level 0' (root) assessment to the direct parent
|
||||
*/
|
||||
superAssessments?: SCAssessmentWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of an assessment
|
||||
*/
|
||||
translations?: SCTranslations<SCAssessmentTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an assessment
|
||||
*/
|
||||
type: SCThingType.Assessment;
|
||||
}
|
||||
|
||||
export interface SCAssessmentTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* @see SCAssessmentWithoutReferences.status
|
||||
*/
|
||||
status?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Study module meta data
|
||||
*/
|
||||
export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations<SCAssessment> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
attempt: 'Versuch',
|
||||
courseOfStudy: 'Studiengang',
|
||||
date: 'Datum',
|
||||
ects: 'ECTS-Punkte',
|
||||
grade: 'Note',
|
||||
status: 'Status',
|
||||
superAssessments: 'übergeordnete Prüfungen',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
attempt: 'attempt',
|
||||
courseOfStudy: 'course of study',
|
||||
date: 'date',
|
||||
ects: 'ECTS points',
|
||||
grade: 'grade',
|
||||
status: 'status',
|
||||
superAssessments: 'parent assessments',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
type: 'Prüfung',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Assessment,
|
||||
},
|
||||
};
|
||||
}
|
||||
228
packages/core/src/things/book.ts
Normal file
228
packages/core/src/things/book.ts
Normal file
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* Categories of a book
|
||||
*/
|
||||
export type SCBookCategories =
|
||||
| 'audio'
|
||||
| 'audiobook'
|
||||
| 'book'
|
||||
| 'cd'
|
||||
| 'dvd'
|
||||
| 'eAudiobook'
|
||||
| 'ebook'
|
||||
| 'ePhoto'
|
||||
| 'hierarchy'
|
||||
| 'kit'
|
||||
| 'manuscript'
|
||||
| 'map'
|
||||
| 'microfilm'
|
||||
| 'musicalscore'
|
||||
| 'photo'
|
||||
| 'physicalobject'
|
||||
| 'retro'
|
||||
| 'sensorimage'
|
||||
| 'unknown'
|
||||
| 'video';
|
||||
|
||||
/**
|
||||
* A book without references
|
||||
*/
|
||||
export interface SCBookWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Categories of a book
|
||||
*/
|
||||
categories: SCBookCategories[];
|
||||
|
||||
/**
|
||||
* ISBNs of a book
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
ISBNs?: string[];
|
||||
|
||||
/**
|
||||
* Number of pages of a book
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
numberOfPages?: number;
|
||||
|
||||
/**
|
||||
* Translated properties of a book
|
||||
*/
|
||||
translations?: SCTranslations<SCBookTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a book
|
||||
*/
|
||||
type: SCThingType.Book;
|
||||
}
|
||||
|
||||
/**
|
||||
* A book
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCBook
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCBookWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a book
|
||||
*/
|
||||
translations?: SCTranslations<SCBookTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a book
|
||||
*/
|
||||
type: SCThingType.Book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a book
|
||||
*/
|
||||
export interface SCBookTranslatableFields
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCCreativeWorkTranslatableProperties {}
|
||||
|
||||
/**
|
||||
* Meta information about a book
|
||||
*/
|
||||
export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
categories: 'Format',
|
||||
ISBNs: 'ISBN',
|
||||
numberOfPages: 'Seitenanzahl',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
categories: 'format',
|
||||
ISBNs: 'ISBN',
|
||||
numberOfPages: 'number of pages',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
audio: 'Tonträger',
|
||||
audiobook: 'Hörbuch',
|
||||
book: 'Buch',
|
||||
cd: 'CD',
|
||||
dvd: 'DVD',
|
||||
eAudiobook: 'E-Hörbuch',
|
||||
ebook: 'E-Book',
|
||||
ePhoto: 'E-Photo',
|
||||
hierarchy: 'mehrteiliges Werk',
|
||||
kit: 'Medienkombination',
|
||||
manuscript: 'Handschrift',
|
||||
map: 'Karte',
|
||||
microfilm: 'Mikrofilm, Mikrofiche',
|
||||
musicalscore: 'Noten',
|
||||
photo: 'Abbildung',
|
||||
physicalobject: 'Objekt',
|
||||
retro: 'Retro (Buch)',
|
||||
sensorimage: 'Blindenschrift',
|
||||
unknown: 'Unbekannt',
|
||||
video: 'Film',
|
||||
},
|
||||
type: 'Buch',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.Book,
|
||||
categories: {
|
||||
audio: 'audio material',
|
||||
audiobook: 'audiobook',
|
||||
book: 'book',
|
||||
cd: 'CD',
|
||||
dvd: 'DVD',
|
||||
eAudiobook: 'E-Audiobook',
|
||||
ebook: 'E-Book',
|
||||
ePhoto: 'E-Photo',
|
||||
hierarchy: 'multipart item',
|
||||
kit: 'media combination',
|
||||
manuscript: 'manuscript',
|
||||
map: 'map',
|
||||
microfilm: 'microfilm, microfiche',
|
||||
musicalscore: 'sheet music',
|
||||
photo: 'illustration',
|
||||
physicalobject: 'object',
|
||||
retro: 'retro (book)',
|
||||
sensorimage: 'braille',
|
||||
unknown: 'unknown',
|
||||
video: 'film',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
150
packages/core/src/things/building.ts
Normal file
150
packages/core/src/things/building.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCPlace,
|
||||
SCPlaceWithoutReferences,
|
||||
SCPlaceWithoutReferencesMeta,
|
||||
SCPlaceWithoutReferencesTranslatableProperties,
|
||||
} from './abstract/place';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
export type SCBuildingCategories =
|
||||
| 'cafe'
|
||||
| 'education'
|
||||
| 'library'
|
||||
| 'office'
|
||||
| 'canteen'
|
||||
| 'student canteen'
|
||||
| 'restaurant'
|
||||
| 'restroom';
|
||||
|
||||
export interface SCBuildingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* List of floor names of the place
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
floors?: string[];
|
||||
|
||||
/**
|
||||
* Translated fields of a building
|
||||
*/
|
||||
translations?: SCTranslations<SCBuildingTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the building
|
||||
*/
|
||||
type: SCThingType.Building;
|
||||
}
|
||||
|
||||
/**
|
||||
* A building
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCBuilding
|
||||
extends SCBuildingWithoutReferences,
|
||||
SCPlace,
|
||||
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a building
|
||||
*/
|
||||
translations?: SCTranslations<SCBuildingTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the building
|
||||
*/
|
||||
type: SCThingType.Building;
|
||||
}
|
||||
|
||||
export interface SCBuildingTranslatableProperties
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties,
|
||||
SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* @see SCBuilding.floors
|
||||
*/
|
||||
floors?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SCBuilding> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
floors: 'Etagen',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
|
||||
floors: 'floors',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
'education': 'Bildung',
|
||||
'library': 'Bibliothek',
|
||||
'office': 'Büro',
|
||||
'restaurant': 'Restaurant',
|
||||
'restroom': 'Toilette',
|
||||
'student canteen': 'Mensa',
|
||||
},
|
||||
type: 'Gebäude',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Building,
|
||||
},
|
||||
};
|
||||
}
|
||||
140
packages/core/src/things/catalog.ts
Normal file
140
packages/core/src/things/catalog.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCAcademicTermWithoutReferences} from './abstract/academic-term';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* A catalog without references
|
||||
*/
|
||||
export interface SCCatalogWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
|
||||
*
|
||||
* Needed for keeping order in catalog inheritance array.
|
||||
*
|
||||
* @filterable
|
||||
* @integer
|
||||
*/
|
||||
level: number;
|
||||
|
||||
/**
|
||||
* Type of a catalog
|
||||
*/
|
||||
type: SCThingType.Catalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* A catalog
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCatalog
|
||||
extends SCCatalogWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Academic term that a catalog belongs to (e.g. semester)
|
||||
*/
|
||||
academicTerm?: SCAcademicTermWithoutReferences;
|
||||
|
||||
/**
|
||||
* The direct parent of a catalog
|
||||
*/
|
||||
superCatalog?: SCCatalogWithoutReferences;
|
||||
|
||||
/**
|
||||
* An array of catalogs from the 'level 0' (root) catalog to the direct parent
|
||||
*/
|
||||
superCatalogs?: SCCatalogWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a catalog
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a catalog
|
||||
*/
|
||||
type: SCThingType.Catalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Catalog meta data
|
||||
*/
|
||||
export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
academicTerm: 'Semester',
|
||||
level: 'Ebene',
|
||||
superCatalog: 'übergeordnetes Verzeichniss',
|
||||
superCatalogs: 'übergeordnete Verzeichnisse',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
academicTerm: 'academic term',
|
||||
level: 'level',
|
||||
superCatalog: 'parent catalog',
|
||||
superCatalogs: 'parent catalogs',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'university events': 'Universitätsveranstaltung',
|
||||
},
|
||||
type: 'Verzeichnis',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Catalog,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of catalogs
|
||||
*/
|
||||
export type SCCatalogCategories = 'university events';
|
||||
122
packages/core/src/things/certification.ts
Normal file
122
packages/core/src/things/certification.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
|
||||
export interface SCCertificationWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<
|
||||
SCCertificationCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
> {
|
||||
/**
|
||||
* A compact version of the image, for example for showing in list views
|
||||
*/
|
||||
compactImage?: string;
|
||||
|
||||
/**
|
||||
* Translations of a certification
|
||||
*/
|
||||
translations?: SCTranslations<SCCertificationTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of certification
|
||||
*/
|
||||
type: SCThingType.Certification;
|
||||
}
|
||||
|
||||
/**
|
||||
* @indexable
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCCertification
|
||||
extends SCCertificationWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCCertificationCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* The authority responsible for issuing this certification
|
||||
*/
|
||||
certificationAuthority?: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Translations of a certification
|
||||
*/
|
||||
translations?: SCTranslations<SCCertificationTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of certification
|
||||
*/
|
||||
type: SCThingType.Certification;
|
||||
}
|
||||
|
||||
export interface SCCertificationTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
image?: string;
|
||||
compactImage?: string;
|
||||
}
|
||||
|
||||
export type SCCertificationCategories =
|
||||
| 'water consumption'
|
||||
| 'animal welfare'
|
||||
| 'climate impact'
|
||||
| 'rainforest protection';
|
||||
|
||||
export class SCCertificationMeta extends SCThingMeta implements SCMetaTranslations<SCCertification> {
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCertificationCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
compactImage: 'Kompaktes Bild',
|
||||
certificationAuthority: 'Zertifizierungsstelle',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCertificationCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
compactImage: 'compact image',
|
||||
certificationAuthority: 'certification authority',
|
||||
},
|
||||
};
|
||||
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCertificationCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
type: 'Zertifizierung',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCertificationCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Certification,
|
||||
},
|
||||
};
|
||||
}
|
||||
126
packages/core/src/things/contact-point.ts
Normal file
126
packages/core/src/things/contact-point.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
|
||||
/**
|
||||
* A contact point without references
|
||||
*/
|
||||
export interface SCContactPointWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* E-mail at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* Fax number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* Office hours for contacting someone at the work location
|
||||
*
|
||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||
* @keyword
|
||||
*/
|
||||
officeHours?: string;
|
||||
|
||||
/**
|
||||
* Contact number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* Type of a contact point
|
||||
*/
|
||||
type: SCThingType.ContactPoint;
|
||||
|
||||
/**
|
||||
* URL at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A contact point
|
||||
*
|
||||
* @see http://schema.org/ContactPoint
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCContactPoint extends SCContactPointWithoutReferences, SCThing {
|
||||
/**
|
||||
* Exact place where work is performed
|
||||
*/
|
||||
areaServed?: SCRoomWithoutReferences;
|
||||
|
||||
/**
|
||||
* Type of a contact point
|
||||
*/
|
||||
type: SCThingType.ContactPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a contact point
|
||||
*/
|
||||
export class SCContactPointMeta extends SCThingMeta implements SCMetaTranslations<SCContactPoint> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
areaServed: 'Arbeitsraum',
|
||||
email: 'E-Mail-Addresse',
|
||||
faxNumber: 'Faxnummer',
|
||||
officeHours: 'Sprechzeiten',
|
||||
telephone: 'Telefonnummer',
|
||||
url: 'Link',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
areaServed: 'location',
|
||||
email: 'email address',
|
||||
faxNumber: 'fax number',
|
||||
officeHours: 'office hours',
|
||||
telephone: 'telephone number',
|
||||
url: 'link',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Kontaktinformation',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.ContactPoint,
|
||||
},
|
||||
};
|
||||
}
|
||||
184
packages/core/src/things/course-of-study.ts
Normal file
184
packages/core/src/things/course-of-study.ts
Normal file
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCAcademicDegree,
|
||||
SCAcademicDegreeMeta,
|
||||
SCAcademicDegreeWithoutReferences,
|
||||
} from './abstract/academic-degree';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCDateSeriesWithoutReferences} from './date-series';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
|
||||
/**
|
||||
* A course of study without references
|
||||
*/
|
||||
export interface SCCourseOfStudyWithoutReferences
|
||||
extends SCAcademicDegreeWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The main language in which the course of study
|
||||
* is beeing offered
|
||||
*/
|
||||
mainLanguage?: SCLanguage;
|
||||
|
||||
/**
|
||||
* The modes the course of study is offered in
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
mode?: SCCourseOfStudyMode;
|
||||
|
||||
/**
|
||||
* The time modes the course of study is offered in
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
timeMode?: SCCourseOfStudyTimeMode;
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudyTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of study
|
||||
*/
|
||||
type: SCThingType.CourseOfStudy;
|
||||
}
|
||||
|
||||
/**
|
||||
* A course of study
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCourseOfStudy
|
||||
extends SCCourseOfStudyWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCAcademicDegree {
|
||||
/**
|
||||
* The department that manages the course of study
|
||||
*/
|
||||
department?: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* The secretary that administers requests and
|
||||
* questions concerning the course of study
|
||||
*/
|
||||
secretary?: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Dates at which the course of study is planned to start
|
||||
*/
|
||||
startDates?: SCDateSeriesWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a course of study
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudyTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of study
|
||||
*/
|
||||
type: SCThingType.CourseOfStudy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a course of study
|
||||
*/
|
||||
export type SCCourseOfStudyTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
|
||||
|
||||
/**
|
||||
* Meta information about a course of study
|
||||
*/
|
||||
export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslations<SCCourseOfStudy> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCAcademicDegreeMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
department: 'Fachbereich',
|
||||
mainLanguage: 'Unterrichtssprache',
|
||||
mode: 'Studiengangsart',
|
||||
secretary: 'Sekretariat',
|
||||
startDates: 'Startdatum',
|
||||
timeMode: 'Zeitmodell',
|
||||
},
|
||||
en: {
|
||||
...new SCAcademicDegreeMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
department: 'department',
|
||||
mainLanguage: 'main language',
|
||||
mode: 'mode',
|
||||
secretary: 'secretary',
|
||||
startDates: 'start dates',
|
||||
timeMode: 'time mode',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCAcademicDegreeMeta().fieldValueTranslations.de,
|
||||
modes: {
|
||||
'combination': 'Kombinationsstudiengang',
|
||||
'double-degree': 'Doppelstudium',
|
||||
'dual': 'duales Studium',
|
||||
'standard': 'Studium',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'Vollzeitstudiengang',
|
||||
parttime: 'Teilzeitstudiengang',
|
||||
},
|
||||
type: 'Studiengang',
|
||||
},
|
||||
en: {
|
||||
...new SCAcademicDegreeMeta().fieldValueTranslations.en,
|
||||
modes: {
|
||||
'combination': 'combination course of study',
|
||||
'double-degree': 'double degree course of study',
|
||||
'dual': 'dual course of study',
|
||||
'standard': 'course of study',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'full-time',
|
||||
parttime: 'part-time',
|
||||
},
|
||||
type: SCThingType.CourseOfStudy,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Types of (german) course of study modes
|
||||
*/
|
||||
export type SCCourseOfStudyMode = 'combination' | 'dual' | 'double-degree' | 'standard';
|
||||
|
||||
/**
|
||||
* Types of (german) course of study time modes
|
||||
*/
|
||||
export type SCCourseOfStudyTimeMode = 'fulltime' | 'parttime';
|
||||
162
packages/core/src/things/date-series.ts
Normal file
162
packages/core/src/things/date-series.ts
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date, SCISO8601Duration} from '../general/time';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCAcademicEventWithoutReferences} from './academic-event';
|
||||
import {SCPersonWithoutReferences} from './person';
|
||||
import {SCSportCourseWithoutReferences} from './sport-course';
|
||||
|
||||
/**
|
||||
* Price groups for sport courses
|
||||
*/
|
||||
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* Price for alumnis
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
alumni?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date without references
|
||||
*/
|
||||
export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* Dates of the date series that are initially planned to be held
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
dates: SCISO8601Date[];
|
||||
|
||||
/**
|
||||
* Duration of the date series
|
||||
*/
|
||||
duration: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Dates that where initially planned to be held but are cancelled
|
||||
*/
|
||||
exceptions?: SCISO8601Date[];
|
||||
|
||||
/**
|
||||
* Frequency of the date series
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
repeatFrequency?: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Translated properties
|
||||
*/
|
||||
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a date series
|
||||
*/
|
||||
type: SCThingType.DateSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date series
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDateSeries
|
||||
extends SCDateSeriesWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
/**
|
||||
* Event to which the date series belongs
|
||||
*/
|
||||
event: SCAcademicEventWithoutReferences | SCSportCourseWithoutReferences;
|
||||
|
||||
/**
|
||||
* Performers of the date series
|
||||
*/
|
||||
performers?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated properties
|
||||
*/
|
||||
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a date series
|
||||
*/
|
||||
type: SCThingType.DateSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a date series
|
||||
*/
|
||||
export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<SCDateSeries> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.de,
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
event: 'Event',
|
||||
exceptions: 'Ausnahmen',
|
||||
repeatFrequency: 'Frequenz',
|
||||
performers: 'Vortragende',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.en,
|
||||
dates: 'dates',
|
||||
duration: 'duration',
|
||||
event: 'event',
|
||||
exceptions: 'exceptions',
|
||||
repeatFrequency: 'frequency',
|
||||
performers: 'performers',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.de,
|
||||
type: 'Terminserie',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.DateSeries,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of date series'
|
||||
*/
|
||||
export type SCDateSeriesTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
|
||||
104
packages/core/src/things/diff.ts
Normal file
104
packages/core/src/things/diff.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import * as jsonpatch from 'json-patch';
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCIndexableThings} from '../meta';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* A diff without references
|
||||
*/
|
||||
export interface SCDiffWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Action of the diff
|
||||
*/
|
||||
action: 'changed' | 'removed';
|
||||
|
||||
/**
|
||||
* Diff patch. Only when action === 'changed'
|
||||
*/
|
||||
changes?: jsonpatch.OpPatch[];
|
||||
|
||||
/**
|
||||
* Creation date of the diff.
|
||||
*/
|
||||
dateCreated: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Type of a diff
|
||||
*/
|
||||
type: SCThingType.Diff;
|
||||
}
|
||||
|
||||
/**
|
||||
* A diff
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCDiff extends SCDiffWithoutReferences, SCThing {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
object: SCIndexableThings;
|
||||
|
||||
/**
|
||||
* Type of a diff
|
||||
*/
|
||||
type: SCThingType.Diff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a diff
|
||||
*/
|
||||
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
action: 'Aktion',
|
||||
changes: 'Änderungen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
object: 'Objekt',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
action: 'action',
|
||||
changes: 'changes',
|
||||
dateCreated: 'date created',
|
||||
object: 'object',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
action: {
|
||||
changed: 'geändert',
|
||||
removed: 'gelöscht',
|
||||
},
|
||||
type: 'Unterschied',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Diff,
|
||||
},
|
||||
};
|
||||
}
|
||||
280
packages/core/src/things/dish.ts
Normal file
280
packages/core/src/things/dish.ts
Normal file
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCCertificationWithoutReferences} from './certification';
|
||||
|
||||
/**
|
||||
* A dish without references
|
||||
*/
|
||||
export interface SCDishWithoutReferences
|
||||
extends SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
additives?: string[];
|
||||
|
||||
/**
|
||||
* Characteristics of the dish
|
||||
*/
|
||||
characteristics?: SCDishCharacteristic[];
|
||||
|
||||
/**
|
||||
* Nutrition information (calories and nutrients with amounts)
|
||||
*/
|
||||
nutrition?: SCNutritionInformation;
|
||||
|
||||
/**
|
||||
* Section of the restaurant menu to which the dish belongs
|
||||
*/
|
||||
menuSection?: SCMenuSection;
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCDishTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
type: SCThingType.Dish;
|
||||
}
|
||||
|
||||
/**
|
||||
* A dish
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDish
|
||||
extends SCDishWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCThingWithCategories<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
|
||||
*/
|
||||
dishAddOns?: SCDishWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Certifications this dish received
|
||||
*/
|
||||
certifications?: SCCertificationWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCDishTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
type: SCThingType.Dish;
|
||||
}
|
||||
|
||||
export interface SCDishTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
additives?: string[];
|
||||
/**
|
||||
* Characteristics of the dish
|
||||
*/
|
||||
characteristics?: SCDishCharacteristic[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Composition of properties of a food characteristic
|
||||
*/
|
||||
export interface SCDishCharacteristic {
|
||||
/**
|
||||
* URL of an image of the characteristic
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Name of the characteristic
|
||||
*
|
||||
* @filterable
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of categories for dishes
|
||||
*/
|
||||
export type SCDishCategories = 'appetizer' | 'salad' | 'main dish' | 'dessert' | 'soup' | 'side dish';
|
||||
|
||||
/**
|
||||
* Type definition for SCNutritionInformation
|
||||
*
|
||||
* @see https://schema.org/NutritionInformation
|
||||
*/
|
||||
export interface SCNutritionInformation {
|
||||
/**
|
||||
* Number of calories contained (in kcal)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
calories?: number;
|
||||
|
||||
/**
|
||||
* Content of carbohydrates (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
carbohydrateContent?: number;
|
||||
|
||||
/**
|
||||
* Content of fat (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
fatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of proteins (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
proteinContent?: number;
|
||||
|
||||
/**
|
||||
* Content of salt (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
saltContent?: number;
|
||||
|
||||
/**
|
||||
* Content of saturated fat (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
saturatedFatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of sugar (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
sugarContent?: number;
|
||||
}
|
||||
|
||||
export interface SCMenuSection {
|
||||
/**
|
||||
* Name of the menu section (mostly to be used as a section title)
|
||||
*/
|
||||
name: 'breakfast' | 'lunch' | 'dinner';
|
||||
|
||||
/**
|
||||
* The time span when the dishes from the sections are available.
|
||||
*
|
||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||
*/
|
||||
servingHours?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a dish
|
||||
*/
|
||||
export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
additives: 'Allergene und Zusatzstoffe',
|
||||
characteristics: 'Merkmale',
|
||||
certifications: 'Zertifizierungen',
|
||||
dishAddOns: 'Beilagen',
|
||||
nutrition: 'Nährwertangaben',
|
||||
menuSection: 'Menüabschnitt',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
additives: 'additives and allergens',
|
||||
characteristics: 'characteristics',
|
||||
certifications: 'certifications',
|
||||
dishAddOns: 'side dishes',
|
||||
nutrition: 'nutrition information',
|
||||
menuSection: 'menu section',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'appetizer': 'Vorspeise',
|
||||
'dessert': 'Nachtisch',
|
||||
'main dish': 'Hauptgericht',
|
||||
'salad': 'Salat',
|
||||
'side dish': 'Beilage',
|
||||
'soup': 'Suppe',
|
||||
},
|
||||
type: 'Essen',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.Dish,
|
||||
},
|
||||
};
|
||||
}
|
||||
43
packages/core/src/things/favorite.ts
Normal file
43
packages/core/src/things/favorite.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* A favorite without references
|
||||
*/
|
||||
export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
type: SCThingType.Favorite;
|
||||
}
|
||||
|
||||
/**
|
||||
* A favorite
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCFavorite extends SCSaveableThing {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
type: SCThingType.Favorite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a favorite
|
||||
*/
|
||||
export class SCFavoriteMeta extends SCThingMeta {}
|
||||
139
packages/core/src/things/floor.ts
Normal file
139
packages/core/src/things/floor.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCThingMeta,
|
||||
SCThingTranslatableProperties,
|
||||
SCThingType,
|
||||
SCThingWithoutReferences,
|
||||
} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
|
||||
/**
|
||||
* A floor without references
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
floorName: string;
|
||||
|
||||
/**
|
||||
* Floor plan
|
||||
*/
|
||||
plan: SCFloorFeatureCollectionWithPlaces<LineString>;
|
||||
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
translations?: SCTranslations<SCFloorTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a floor
|
||||
*/
|
||||
type: SCThingType.Floor;
|
||||
}
|
||||
|
||||
/**
|
||||
* A floor
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
translations?: SCTranslations<SCFloorTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a floor
|
||||
*/
|
||||
type: SCThingType.Floor;
|
||||
}
|
||||
|
||||
/**
|
||||
* A feature collection
|
||||
*/
|
||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject> extends FeatureCollection<T> {
|
||||
/**
|
||||
* Features of the collection
|
||||
*/
|
||||
features: Array<SCFloorFeatureWithPlace<T>>;
|
||||
}
|
||||
|
||||
/***
|
||||
* A feature with a place
|
||||
*/
|
||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
extends Feature<T, any> {
|
||||
/**
|
||||
* The place of the feature
|
||||
*/
|
||||
place?: SCRoomWithoutReferences | SCPointOfInterestWithoutReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a floor
|
||||
*/
|
||||
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the floor name
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
floorName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about floors
|
||||
*/
|
||||
export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFloor> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
plan: 'Grundriss',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
floorName: 'floor name',
|
||||
plan: 'plan',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Etage',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Floor,
|
||||
},
|
||||
};
|
||||
}
|
||||
186
packages/core/src/things/message.ts
Normal file
186
packages/core/src/things/message.ts
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCUserGroup} from './abstract/user-groups';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
|
||||
/**
|
||||
* Categories of a message
|
||||
*/
|
||||
export type SCMessageCategories = 'news';
|
||||
|
||||
/**
|
||||
* A message without references
|
||||
*/
|
||||
export interface SCMessageWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Organizational unit for which the message is intended
|
||||
*/
|
||||
audienceOrganizations?: SCOrganizationWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Roles for which the message is intended
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
audiences: SCUserGroup[];
|
||||
|
||||
/**
|
||||
* Categories of a message
|
||||
*/
|
||||
categories: SCMessageCategories[];
|
||||
|
||||
/**
|
||||
* When the message was created
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
dateCreated?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Message itself
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
messageBody: string;
|
||||
|
||||
/**
|
||||
* An index for applying a custom sorting of multiple messages
|
||||
*/
|
||||
sequenceIndex?: number;
|
||||
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
translations?: SCTranslations<SCMessageTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a message
|
||||
*/
|
||||
type: SCThingType.Message;
|
||||
}
|
||||
|
||||
/**
|
||||
* A message
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
translations?: SCTranslations<SCMessageTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a message
|
||||
*/
|
||||
type: SCThingType.Message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a message
|
||||
*/
|
||||
export interface SCMessageTranslatableProperties
|
||||
extends SCCreativeWorkTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Message itself
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
messageBody?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about messages
|
||||
*/
|
||||
export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
audienceOrganizations: 'Zielgruppenorganisationen',
|
||||
audiences: 'Zielgruppen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
messageBody: 'Nachrichteninhalt',
|
||||
sequenceIndex: 'Sequenzindex',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
audienceOrganizations: 'audience organizations',
|
||||
audiences: 'audiences',
|
||||
dateCreated: 'date created',
|
||||
messageBody: 'message body',
|
||||
sequenceIndex: 'sequence index',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
audiences: {
|
||||
employees: 'Angestellte',
|
||||
guests: 'Gäste',
|
||||
students: 'Studenten',
|
||||
},
|
||||
categories: {
|
||||
news: 'Neuigkeiten',
|
||||
},
|
||||
type: 'Nachricht',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
};
|
||||
}
|
||||
79
packages/core/src/things/organization.ts
Normal file
79
packages/core/src/things/organization.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {SCContactPointWithoutReferences} from './contact-point';
|
||||
|
||||
/**
|
||||
* An organization without references
|
||||
*/
|
||||
export interface SCOrganizationWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
type: SCThingType.Organization;
|
||||
}
|
||||
|
||||
/**
|
||||
* An organization
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* A list of contact points concerning the organization
|
||||
*/
|
||||
contactPoints?: SCContactPointWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
type: SCThingType.Organization;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about an organization
|
||||
*/
|
||||
export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
contactPoints: 'Kontaktinformationen',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
contactPoints: 'contact details',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Einrichtung',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Organization,
|
||||
},
|
||||
};
|
||||
}
|
||||
162
packages/core/src/things/periodical.ts
Normal file
162
packages/core/src/things/periodical.ts
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* Categories of a periodical
|
||||
*/
|
||||
export type SCPeriodicalCategories = 'journal' | 'electronic';
|
||||
|
||||
/**
|
||||
* A periodical without references
|
||||
*/
|
||||
export interface SCPeriodicalWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Categories of a periodical
|
||||
*/
|
||||
categories: SCPeriodicalCategories[];
|
||||
/**
|
||||
* A list of ISSNs of a periodical
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
ISSNs?: string[];
|
||||
|
||||
/**
|
||||
* Translated properties of a periodical
|
||||
*/
|
||||
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a periodical
|
||||
*/
|
||||
type: SCThingType.Periodical;
|
||||
}
|
||||
|
||||
/**
|
||||
* A publication published at regular intervals (e.g. a magazine or newspaper)
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPeriodical
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCPeriodicalWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a periodical
|
||||
*/
|
||||
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a periodical
|
||||
*/
|
||||
type: SCThingType.Periodical;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a periodical
|
||||
*/
|
||||
export interface SCPeriodicalTranslatableFields
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCCreativeWorkTranslatableProperties {}
|
||||
|
||||
/**
|
||||
* Meta information about a periodical
|
||||
*/
|
||||
export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<SCPeriodical> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
categories: 'Format',
|
||||
ISSNs: 'ISSN',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
categories: 'format',
|
||||
ISSNs: 'ISSN',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
type: 'Periodikum',
|
||||
categories: {
|
||||
electronic: 'E-Journal',
|
||||
journal: 'Zeitschrift',
|
||||
},
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: 'periodical',
|
||||
categories: {
|
||||
electronic: 'E-Journal',
|
||||
journal: 'journal',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
234
packages/core/src/things/person.ts
Normal file
234
packages/core/src/things/person.ts
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCNationality} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCBuildingWithoutReferences} from './building';
|
||||
import {SCContactPointWithoutReferences} from './contact-point';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
|
||||
/**
|
||||
* A person without references
|
||||
*/
|
||||
export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Additional first names of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
additionalName?: string;
|
||||
|
||||
/**
|
||||
* The birth date of the person.
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
birthDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* The private email address of the person.
|
||||
*
|
||||
* @TJS-format email
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* The family name of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
familyName?: string;
|
||||
|
||||
/**
|
||||
* The private fax number of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* The gender of the person.
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
gender?: SCPersonGender;
|
||||
|
||||
/**
|
||||
* The first name of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
givenName?: string;
|
||||
|
||||
/**
|
||||
* Honorific prefix of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
honorificPrefix?: string;
|
||||
|
||||
/**
|
||||
* Honorific suffix of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
honorificSuffix?: string;
|
||||
|
||||
/**
|
||||
* Titles of jobs that the person has.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
jobTitles?: string[];
|
||||
|
||||
/**
|
||||
* The complete name of the person combining all the parts of the name into one.
|
||||
*
|
||||
* @filterable
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The nationality of the person.
|
||||
*/
|
||||
nationality?: SCNationality;
|
||||
|
||||
/**
|
||||
* The private telephone number of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
*/
|
||||
type: SCThingType.Person;
|
||||
}
|
||||
|
||||
/**
|
||||
* A person
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPerson extends SCPersonWithoutReferences, SCThing {
|
||||
/**
|
||||
* Organization the person works for
|
||||
*/
|
||||
affiliations?: SCOrganizationWithoutReferences[];
|
||||
|
||||
/**
|
||||
* A list of homes of the person
|
||||
*/
|
||||
homeLocations?: Array<
|
||||
SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences
|
||||
>;
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
*/
|
||||
type: SCThingType.Person;
|
||||
|
||||
/**
|
||||
* Locations where the person performs her/his work
|
||||
*/
|
||||
workLocations?: SCContactPointWithoutReferences[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a person
|
||||
*/
|
||||
export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPerson> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
additionalName: 'Zusatzname',
|
||||
affiliations: 'Zugehörigkeiten',
|
||||
birthDate: 'Geburtsdatum',
|
||||
email: 'E-Mail',
|
||||
familyName: 'Nachname',
|
||||
faxNumber: 'Faxnummer',
|
||||
gender: 'Geschlecht',
|
||||
givenName: 'Vorname',
|
||||
homeLocations: 'Heimatstandorte',
|
||||
honorificPrefix: 'Ehrentitel',
|
||||
honorificSuffix: 'Ehrentitel (Suffix)',
|
||||
jobTitles: 'Berufsbezeichnungen',
|
||||
nationality: 'Staatsangehörigkeit',
|
||||
telephone: 'Telefonnummer',
|
||||
workLocations: 'Arbeitsstandorte',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
additionalName: 'additional name',
|
||||
affiliations: 'affiliations',
|
||||
birthDate: 'birth date',
|
||||
contactDetails: 'contact details',
|
||||
email: 'email',
|
||||
familyName: 'family name',
|
||||
faxNumber: 'fax',
|
||||
gender: 'gender',
|
||||
givenName: 'given name',
|
||||
homeLocations: 'home locations',
|
||||
honorificPrefix: 'honorific title',
|
||||
honorificSuffix: 'honorific title (suffix)',
|
||||
jobTitles: 'job titles',
|
||||
nationality: 'nationality',
|
||||
telephone: 'telephone',
|
||||
workLocations: 'work locations',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
gender: {
|
||||
female: 'weiblich',
|
||||
inter: 'divers',
|
||||
male: 'männlich',
|
||||
undefined: 'undefiniert',
|
||||
},
|
||||
type: 'Person',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Person,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gender of a person
|
||||
*/
|
||||
export type SCPersonGender = 'male' | 'female' | 'inter' | 'undefined';
|
||||
133
packages/core/src/things/point-of-interest.ts
Normal file
133
packages/core/src/things/point-of-interest.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* A point of interest without references
|
||||
*/
|
||||
export interface SCPointOfInterestWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a point of interest
|
||||
*/
|
||||
type: SCThingType.PointOfInterest;
|
||||
}
|
||||
|
||||
/**
|
||||
* A point of interest
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPointOfInterest
|
||||
extends SCPointOfInterestWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCPlace,
|
||||
SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a point of interest
|
||||
*/
|
||||
type: SCThingType.PointOfInterest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of a point of interest
|
||||
*/
|
||||
export type SCPointOfInterestCategories =
|
||||
| 'computer'
|
||||
| 'validator'
|
||||
| 'card charger'
|
||||
| 'printer'
|
||||
| 'disabled access';
|
||||
|
||||
/**
|
||||
* Meta information about points of interest
|
||||
*/
|
||||
export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations<SCPointOfInterest> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'card charger': 'Kartenaufwerter',
|
||||
'computer': 'Computer',
|
||||
'disabled access': 'barrierefreier Zugang',
|
||||
'printer': 'Drucker',
|
||||
'validator': 'Validierer',
|
||||
},
|
||||
type: 'Sonderziel',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.PointOfInterest,
|
||||
},
|
||||
};
|
||||
}
|
||||
100
packages/core/src/things/publication-event.ts
Normal file
100
packages/core/src/things/publication-event.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* An publication event without references
|
||||
*/
|
||||
export interface SCPublicationEventWithoutReferences extends SCEventWithoutReferences {
|
||||
/**
|
||||
* All the locations related to the event (e.g. where a creative work was published)
|
||||
*/
|
||||
locations?: string[];
|
||||
|
||||
/**
|
||||
* An organization (or a person) that is publishing at the event
|
||||
*/
|
||||
publisher?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an publication event
|
||||
*/
|
||||
translations?: SCTranslations<SCPublicationEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an publication event
|
||||
*/
|
||||
type: SCThingType.PublicationEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* An publication event
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPublicationEvent extends SCEvent, SCPublicationEventWithoutReferences {
|
||||
/**
|
||||
* Translated fields of an publication event
|
||||
*/
|
||||
translations?: SCTranslations<SCPublicationEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an publication event
|
||||
*/
|
||||
type: SCThingType.PublicationEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of an publication event
|
||||
*/
|
||||
export type SCPublicationEventTranslatableProperties = SCThingTranslatableProperties;
|
||||
|
||||
/**
|
||||
* Meta information about publication events
|
||||
*/
|
||||
export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTranslations<SCPublicationEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
locations: 'Erscheinungsorte',
|
||||
publisher: 'Verlag',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldTranslations.en,
|
||||
locations: 'places of publication',
|
||||
publisher: 'publisher',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
type: 'Veröffentlichung',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldValueTranslations.en,
|
||||
type: 'publication event',
|
||||
},
|
||||
};
|
||||
}
|
||||
196
packages/core/src/things/room.ts
Normal file
196
packages/core/src/things/room.ts
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCMap} from '../general/map';
|
||||
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
|
||||
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {
|
||||
SCThingThatAcceptsPayments,
|
||||
SCThingThatAcceptsPaymentsWithoutReferences,
|
||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta,
|
||||
} from './abstract/thing-that-accepts-payments';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* Categories of a room
|
||||
*/
|
||||
export type SCRoomCategories =
|
||||
| 'cafe'
|
||||
| 'canteen'
|
||||
| 'computer'
|
||||
| 'education'
|
||||
| 'laboratory'
|
||||
| 'learn'
|
||||
| 'library'
|
||||
| 'lounge'
|
||||
| 'office'
|
||||
| 'restaurant'
|
||||
| 'restroom'
|
||||
| 'student canteen'
|
||||
| 'student union';
|
||||
|
||||
/**
|
||||
* A room without references
|
||||
*/
|
||||
export interface SCRoomWithoutReferences
|
||||
extends SCPlaceWithoutReferences,
|
||||
SCThingThatAcceptsPaymentsWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
||||
/**
|
||||
* The name of the floor in which the room is in.
|
||||
*
|
||||
* @filterable
|
||||
* @text
|
||||
*/
|
||||
floorName?: string;
|
||||
|
||||
/**
|
||||
* The inventory of the place/room as a list of items and their quantity.
|
||||
*/
|
||||
inventory?: SCMap<number>;
|
||||
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the room
|
||||
*/
|
||||
type: SCThingType.Room;
|
||||
}
|
||||
|
||||
/**
|
||||
* A room
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCRoom
|
||||
extends SCRoomWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCThingThatAcceptsPayments,
|
||||
SCPlace,
|
||||
SCThingWithCategories<SCRoomCategories, SCRoomSpecificValues> {
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the room
|
||||
*/
|
||||
type: SCThingType.Room;
|
||||
}
|
||||
|
||||
/**
|
||||
* Category specific values of a room
|
||||
*/
|
||||
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific opening hours of the room
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
openingHours?: string;
|
||||
|
||||
/**
|
||||
* Category specific service hours of the room (e.g. cooked food serving hours)
|
||||
*
|
||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||
* @keyword
|
||||
*/
|
||||
serviceHours?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
inventory: 'Bestand',
|
||||
serviceHours: 'Servicezeiten',
|
||||
},
|
||||
en: {
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
floorName: 'floor name',
|
||||
inventory: 'inventory',
|
||||
serviceHours: 'service hours',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
'computer': 'PC-Pool',
|
||||
'education': 'Bildung',
|
||||
'laboratory': 'Labor',
|
||||
'learn': 'Lernen',
|
||||
'library': 'Bibliothek',
|
||||
'lounge': 'Lounge',
|
||||
'office': 'Büro',
|
||||
'restaurant': 'Restaurant',
|
||||
'restroom': 'Toilette',
|
||||
'student canteen': 'Mensa',
|
||||
'student union': 'Studentenvereinigung',
|
||||
},
|
||||
type: 'Raum',
|
||||
},
|
||||
en: {
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Room,
|
||||
},
|
||||
};
|
||||
}
|
||||
94
packages/core/src/things/semester.ts
Normal file
94
packages/core/src/things/semester.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCAcademicTerm,
|
||||
SCAcademicTermWithoutReferences,
|
||||
SCAcademicTermWithoutReferencesMeta,
|
||||
} from './abstract/academic-term';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* A semester without references
|
||||
*/
|
||||
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
|
||||
/**
|
||||
* The short name of the semester, using the given pattern.
|
||||
*
|
||||
* @filterable
|
||||
* @pattern ^(WS|SS|WiSe|SoSe) [0-9]{4}(/[0-9]{2})?$
|
||||
* @keyword
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
/**
|
||||
* Type of the semester
|
||||
*/
|
||||
type: SCThingType.Semester;
|
||||
}
|
||||
|
||||
/**
|
||||
* A semester
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSemester extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||
/**
|
||||
* Type of the semester
|
||||
*/
|
||||
type: SCThingType.Semester;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a semester
|
||||
*/
|
||||
export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.de,
|
||||
acronym: 'Abkürzung',
|
||||
endDate: 'Ende',
|
||||
eventsEndDate: 'Vorlesungsschluss',
|
||||
eventsStartDate: 'Vorlesungsbeginn',
|
||||
startDate: 'Beginn',
|
||||
},
|
||||
en: {
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.en,
|
||||
acronym: 'acronym',
|
||||
endDate: 'end date',
|
||||
eventsEndDate: 'semester ending',
|
||||
eventsStartDate: 'semester beginning',
|
||||
startDate: 'start date',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
type: 'Semester',
|
||||
},
|
||||
en: {
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Semester,
|
||||
},
|
||||
};
|
||||
}
|
||||
236
packages/core/src/things/setting.ts
Normal file
236
packages/core/src/things/setting.ts
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCUserGroup} from './abstract/user-groups';
|
||||
|
||||
/**
|
||||
* A setting without references
|
||||
*/
|
||||
export interface SCSettingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* The default value of a setting
|
||||
*/
|
||||
defaultValue: SCSettingValue | SCSettingValues;
|
||||
/**
|
||||
* The input type of this setting
|
||||
*/
|
||||
inputType: SCSettingInputType;
|
||||
/**
|
||||
* The order number this setting should show up in its category list
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
order: number;
|
||||
/**
|
||||
* Translated fields of a setting
|
||||
*/
|
||||
translations?: SCTranslations<SCSettingValueTranslatableProperties>;
|
||||
/**
|
||||
* The type of this model
|
||||
*/
|
||||
type: SCThingType.Setting;
|
||||
/**
|
||||
* The key of a value of a setting
|
||||
*/
|
||||
value?: SCSettingValue | SCSettingValues;
|
||||
/**
|
||||
* The possible values of a setting
|
||||
*/
|
||||
values?: SCSettingValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of categories for settings
|
||||
*/
|
||||
export type SCSettingCategories = 'profile' | 'privacy' | 'credentials' | 'others';
|
||||
|
||||
/**
|
||||
* The types of input/value a setting object can carry
|
||||
*/
|
||||
export enum SCSettingInputType {
|
||||
SingleChoice = 'single choice',
|
||||
MultipleChoice = 'multiple choice',
|
||||
Number = 'number',
|
||||
Text = 'text',
|
||||
Password = 'password',
|
||||
}
|
||||
|
||||
/**
|
||||
* A setting with references
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSetting
|
||||
extends SCSettingWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a setting
|
||||
*/
|
||||
translations?: SCTranslations<SCSettingValueTranslatableProperties>;
|
||||
/**
|
||||
* The type of this model
|
||||
*/
|
||||
type: SCThingType.Setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type a value of a setting can have
|
||||
*/
|
||||
export type SCSettingValue = string | number | boolean;
|
||||
|
||||
/**
|
||||
* The type of multiple values a setting can have
|
||||
*/
|
||||
export type SCSettingValues = SCSettingValue[];
|
||||
|
||||
/**
|
||||
* Translatable properties of a setting
|
||||
*/
|
||||
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* The translations of the possible values of a setting
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
values?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about settings
|
||||
*/
|
||||
export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCSetting> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
defaultValue: 'Standard Wert',
|
||||
inputType: 'Eingabetyp',
|
||||
order: 'Position',
|
||||
value: 'Wert',
|
||||
values: 'Werte',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
defaultValue: 'default value',
|
||||
inputType: 'input type',
|
||||
order: 'position',
|
||||
value: 'value',
|
||||
values: 'values',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
credentials: 'Anmeldedaten',
|
||||
others: 'Andere',
|
||||
privacy: 'Privatsphäre',
|
||||
profile: 'Profil',
|
||||
},
|
||||
inputType: {
|
||||
'multiple choice': 'mehrfach Auswahl',
|
||||
'number': 'Zahl',
|
||||
'password': 'Passwort',
|
||||
'single choice': 'einfache Auswahl',
|
||||
'text': 'Text',
|
||||
},
|
||||
type: 'Einstellung',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Setting,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A user group setting
|
||||
*/
|
||||
export interface SCUserGroupSetting extends SCSetting {
|
||||
/**
|
||||
* Exact categories of the setting
|
||||
*/
|
||||
categories: ['profile'];
|
||||
/**
|
||||
* The default value of the setting
|
||||
*/
|
||||
defaultValue: SCUserGroup;
|
||||
/**
|
||||
* Specific name of the setting
|
||||
*/
|
||||
name: 'group';
|
||||
/**
|
||||
* Chosen value of the setting
|
||||
*/
|
||||
value?: SCUserGroup;
|
||||
/**
|
||||
* The possible values of the setting
|
||||
*/
|
||||
values: SCUserGroup[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A language setting
|
||||
*/
|
||||
export interface SCLanguageSetting extends SCSetting {
|
||||
/**
|
||||
* Exact categories of the setting
|
||||
*/
|
||||
categories: ['profile'];
|
||||
/**
|
||||
* The default value of the setting
|
||||
*/
|
||||
defaultValue: SCLanguageCode;
|
||||
/**
|
||||
* Specific name of the setting
|
||||
*/
|
||||
name: 'language';
|
||||
/**
|
||||
* Chosen value of the setting
|
||||
*/
|
||||
value?: SCLanguageCode;
|
||||
/**
|
||||
* The possible values of the setting
|
||||
*/
|
||||
values: SCLanguageCode[];
|
||||
}
|
||||
71
packages/core/src/things/sport-course.ts
Normal file
71
packages/core/src/things/sport-course.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* A sport course without references
|
||||
*/
|
||||
export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
type: SCThingType.SportCourse;
|
||||
}
|
||||
|
||||
/**
|
||||
* A sport course
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
type: SCThingType.SportCourse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a sport course
|
||||
*/
|
||||
export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations<SCSportCourse> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
type: 'Sportkurs',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.SportCourse,
|
||||
},
|
||||
};
|
||||
}
|
||||
196
packages/core/src/things/study-module.ts
Normal file
196
packages/core/src/things/study-module.ts
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCMap} from '../general/map';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCAcademicEventWithoutReferences} from './academic-event';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
import {SCPersonWithoutReferences} from './person';
|
||||
|
||||
/**
|
||||
* A study module without references
|
||||
*/
|
||||
export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* ECTS points (European Credit Transfer System)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
ects: number;
|
||||
|
||||
/**
|
||||
* The language in which the study module is offered
|
||||
*/
|
||||
language: SCLanguage;
|
||||
|
||||
/**
|
||||
* Majors that this study module is meant for
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
majors: string[];
|
||||
|
||||
/**
|
||||
* Represents the modules necessity for each given major (of the major property)
|
||||
*/
|
||||
necessity: SCMap<SCStudyModuleNecessity>;
|
||||
|
||||
/**
|
||||
* Translated fields of a study module
|
||||
*/
|
||||
translations?: SCTranslations<SCStudyModuleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the study module
|
||||
*/
|
||||
type: SCThingType.StudyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* A study module
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCStudyModule
|
||||
extends SCStudyModuleWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Academic events that make up a study module
|
||||
*/
|
||||
academicEvents: SCAcademicEventWithoutReferences[];
|
||||
|
||||
/**
|
||||
* The faculty that manages and curates the study module
|
||||
*/
|
||||
faculty: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Study modules needed for each others fulfillment
|
||||
*/
|
||||
partnerModules?: SCStudyModuleWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Study modules required beforehand
|
||||
*/
|
||||
requiredModules?: SCStudyModuleWithoutReferences[];
|
||||
|
||||
/**
|
||||
* 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<SCStudyModuleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the study module
|
||||
*/
|
||||
type: SCThingType.StudyModule;
|
||||
}
|
||||
|
||||
export interface SCStudyModuleTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Translations of the majors that this study module is meant for
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Translations of the modules necessity for each given major (of the major property)
|
||||
*/
|
||||
necessity: SCMap<SCStudyModuleNecessity>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export enum SCStudyModuleNecessity {
|
||||
Required = 'required',
|
||||
Elective = 'elective',
|
||||
Optional = 'optional',
|
||||
}
|
||||
|
||||
/**
|
||||
* Study module meta data
|
||||
*/
|
||||
export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations<SCStudyModule> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
academicEvents: 'Veranstaltungen',
|
||||
ects: 'ECTS-Punkte',
|
||||
faculty: 'Fachbereich',
|
||||
language: 'Unterrichtssprache',
|
||||
majors: 'Fachrichtungen',
|
||||
necessity: 'Erforderlichkeit',
|
||||
partnerModules: 'Partnermodule',
|
||||
requiredModules: 'Benötigte Module',
|
||||
secretary: 'Sekretariat',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
academicEvents: 'academic events',
|
||||
ects: 'ECTS points',
|
||||
faculty: 'faculty',
|
||||
language: 'teaching language',
|
||||
majors: 'majors',
|
||||
necessity: 'necessity',
|
||||
partnerModules: 'partner modules',
|
||||
requiredModules: 'required modules',
|
||||
secretary: 'secretary',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
necessity: {
|
||||
elective: 'Wahlfach',
|
||||
optional: 'optional',
|
||||
required: 'benötigt',
|
||||
},
|
||||
type: 'Studiengangmodul',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.StudyModule,
|
||||
},
|
||||
};
|
||||
}
|
||||
95
packages/core/src/things/ticket.ts
Normal file
95
packages/core/src/things/ticket.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCISO8601Duration} from '../general/time';
|
||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
|
||||
/**
|
||||
* A ticket without references
|
||||
*/
|
||||
export interface SCTicketWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Approximate wait time
|
||||
*/
|
||||
approxWaitingTime: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Waiting number of the ticket
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
currentTicketNumber: string;
|
||||
|
||||
/**
|
||||
* Service type of the ticket
|
||||
*/
|
||||
serviceType: string;
|
||||
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
type: SCThingType.Ticket;
|
||||
}
|
||||
|
||||
/**
|
||||
* A ticket
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
type: SCThingType.Ticket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a ticket
|
||||
*/
|
||||
export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTicket> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
approxWaitingTime: 'ungefähre Wartezeit',
|
||||
currentTicketNumber: 'aktuelle Ticketnummer',
|
||||
serviceType: 'Service Kategorie',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
approxWaitingTime: 'approximate waiting time',
|
||||
currentTicketNumber: 'current ticket number',
|
||||
serviceType: 'type of service',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Ticket',
|
||||
},
|
||||
en: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Ticket,
|
||||
},
|
||||
};
|
||||
}
|
||||
123
packages/core/src/things/todo.ts
Normal file
123
packages/core/src/things/todo.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* A "to do" without references
|
||||
*/
|
||||
export interface SCToDoWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<string, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Whether or not the "to do" is already done
|
||||
*/
|
||||
done: boolean;
|
||||
|
||||
/**
|
||||
* A date when the "to do" is due
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
dueDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Priority of the "to do"
|
||||
*/
|
||||
priority: SCToDoPriority;
|
||||
|
||||
/**
|
||||
* Type of the "to do"
|
||||
*/
|
||||
type: SCThingType.ToDo;
|
||||
}
|
||||
|
||||
/**
|
||||
* A "to do"
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCToDo
|
||||
extends SCToDoWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the "to do"
|
||||
*/
|
||||
type: SCThingType.ToDo;
|
||||
}
|
||||
|
||||
/**
|
||||
* A priority of a "to do"
|
||||
*/
|
||||
export enum SCToDoPriority {
|
||||
LOW = 0,
|
||||
NORMAL = 2,
|
||||
HIGH = 5,
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about todo
|
||||
*/
|
||||
export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldTranslations.de,
|
||||
done: 'Erledigt',
|
||||
dueDate: 'Fälligkeitsdatum',
|
||||
priority: 'Priorität',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldTranslations.en,
|
||||
done: 'done',
|
||||
dueDate: 'due date',
|
||||
priority: 'priority',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'ToDo',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.ToDo,
|
||||
},
|
||||
};
|
||||
}
|
||||
244
packages/core/src/things/tour.ts
Normal file
244
packages/core/src/things/tour.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* A tour without references
|
||||
*/
|
||||
export interface SCTourWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Init script for the tour
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
init?: string;
|
||||
|
||||
/**
|
||||
* Steps of a tour
|
||||
*/
|
||||
steps: SCTourStep[];
|
||||
|
||||
/**
|
||||
* Type of a tour
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
type: SCThingType.Tour;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tour
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCTour extends SCTourWithoutReferences, SCThing {
|
||||
/**
|
||||
* Type of a tour
|
||||
*/
|
||||
type: SCThingType.Tour;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a tour
|
||||
*/
|
||||
export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
init: 'Initiales Skript',
|
||||
steps: 'Schritte',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
init: 'initial script',
|
||||
steps: 'steps',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Tour',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Tour,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A step in a tour
|
||||
*/
|
||||
export type SCTourStep = SCTourStepMenu | SCTourStepLocation | SCTourStepTooltip;
|
||||
|
||||
/**
|
||||
* A location of a tour step
|
||||
*/
|
||||
export interface SCTourStepLocation {
|
||||
/**
|
||||
* Location to go to
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
location: string;
|
||||
|
||||
/**
|
||||
* Type of the step
|
||||
*/
|
||||
type: 'location';
|
||||
}
|
||||
|
||||
/**
|
||||
* A tooltip in a tour step
|
||||
*/
|
||||
export interface SCTourStepTooltip {
|
||||
/**
|
||||
* Whether the tooltip may fail or not
|
||||
*/
|
||||
canFail?: boolean;
|
||||
|
||||
/**
|
||||
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
element: string | string[];
|
||||
|
||||
/**
|
||||
* Position of the tooltip
|
||||
*/
|
||||
position?: 'bottom' | 'left' | 'right' | 'top';
|
||||
|
||||
/**
|
||||
* How the step shall be resolved
|
||||
*/
|
||||
resolved?: SCTourResolvedElement | SCTourResolvedEvent | SCTourResolvedLocation | SCTourResolvedMenu;
|
||||
|
||||
/**
|
||||
* Text that the tooltip shall contain
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* How often it shall be retried
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
tries?: number;
|
||||
|
||||
/**
|
||||
* Type of the step
|
||||
*/
|
||||
type: 'tooltip';
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu interaction of a tour step
|
||||
*/
|
||||
export interface SCTourStepMenu {
|
||||
/**
|
||||
* The action that needs to be completed on the menu
|
||||
*/
|
||||
action: 'close';
|
||||
|
||||
/**
|
||||
* The side of the menu that the step refers to
|
||||
*/
|
||||
side: 'right';
|
||||
|
||||
/**
|
||||
* The type of the step
|
||||
*/
|
||||
type: 'menu';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tour step resolved by an element
|
||||
*/
|
||||
export interface SCTourResolvedElement {
|
||||
/**
|
||||
* Element name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
element: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tour step resolved by an event
|
||||
*/
|
||||
export interface SCTourResolvedEvent {
|
||||
/**
|
||||
* Event name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
event: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tour step resolved by a location
|
||||
*/
|
||||
export interface SCTourResolvedLocation {
|
||||
/**
|
||||
* Matching location
|
||||
*/
|
||||
location: SCTourResolvedLocationTypeIs | SCTourResolvedLocationTypeMatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tour step resolved by a location for a specific location
|
||||
*/
|
||||
export interface SCTourResolvedLocationTypeIs {
|
||||
/**
|
||||
* Specific location name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
is: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tour step resolved by a location for a specific location
|
||||
*/
|
||||
export interface SCTourResolvedLocationTypeMatch {
|
||||
/**
|
||||
* Regex location name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
match: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tour step resolved by interacting with a menu
|
||||
*/
|
||||
export interface SCTourResolvedMenu {
|
||||
/**
|
||||
* Menu location
|
||||
*/
|
||||
menu: 'open-left' | 'open-right';
|
||||
}
|
||||
230
packages/core/src/things/video.ts
Normal file
230
packages/core/src/things/video.ts
Normal file
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Duration} from '../general/time';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCPersonWithoutReferences} from './person';
|
||||
|
||||
/**
|
||||
* A video without references
|
||||
*/
|
||||
export interface SCVideoWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The Duration of the Video
|
||||
*/
|
||||
duration?: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Downloadable/Streamable Files of the Video
|
||||
*/
|
||||
sources?: SCVideoSource[];
|
||||
|
||||
/**
|
||||
* URLs to a thumbnails for the Video
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
thumbnails?: string[];
|
||||
|
||||
/**
|
||||
* Track Files for the Video
|
||||
*/
|
||||
tracks?: SCVideoTrack;
|
||||
|
||||
/**
|
||||
* A Transcript of the Video
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
transcript?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of a video
|
||||
*/
|
||||
translations?: SCTranslations<SCVideoTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of an Video
|
||||
*/
|
||||
type: SCThingType.Video;
|
||||
}
|
||||
|
||||
export interface SCVideoSource {
|
||||
/**
|
||||
* Pixel Height of the Video
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
/**
|
||||
* MIME-Type of the source File
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
mimeType: SCVideoMimeType;
|
||||
|
||||
/**
|
||||
* Size of the Video File in bytes
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* URL to the Video File
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Pixel Width of the Video
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface SCVideoTrack {
|
||||
/**
|
||||
* Language of the Subtitle
|
||||
*/
|
||||
language: SCLanguage;
|
||||
|
||||
/**
|
||||
* Content Type of the Track File
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
type: SCVideoTrackTypes;
|
||||
|
||||
/**
|
||||
* URL to the Track File
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A video
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCVideo
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCVideoWithoutReferences {
|
||||
/**
|
||||
* Persons acting in the Video
|
||||
*/
|
||||
actors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a video
|
||||
*/
|
||||
translations?: SCTranslations<SCVideoTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a video
|
||||
*/
|
||||
type: SCThingType.Video;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a video
|
||||
*/
|
||||
export interface SCVideoTranslatableFields
|
||||
extends SCCreativeWorkTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties {}
|
||||
|
||||
/**
|
||||
* Meta information about a video
|
||||
*/
|
||||
export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVideo> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
actors: 'Darsteller',
|
||||
duration: 'Dauer',
|
||||
sources: 'Quellen',
|
||||
thumbnails: 'Vorschaubilder',
|
||||
tracks: 'Spuren',
|
||||
transcript: 'Transkript',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
actors: 'actors',
|
||||
duration: 'duration',
|
||||
sources: 'sources',
|
||||
thumbnails: 'thumbnails',
|
||||
tracks: 'tracks',
|
||||
transcript: 'transcript',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
type: 'Video',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.Video,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Video Encoding Formats
|
||||
*/
|
||||
export type SCVideoMimeType =
|
||||
| 'video/mp4'
|
||||
| 'video/ogg'
|
||||
| 'video/webm'
|
||||
| 'application/vnd.apple.mpegurl'
|
||||
| 'application/dash+xml';
|
||||
|
||||
/**
|
||||
* Video Track Types
|
||||
*/
|
||||
export type SCVideoTrackTypes = 'closed captions' | 'chapters' | 'description' | 'metadata' | 'subtitles';
|
||||
Reference in New Issue
Block a user