refactor: move core to monorepo

This commit is contained in:
2023-05-24 14:06:47 +02:00
parent 927f8df900
commit 9aad8eda9a
182 changed files with 0 additions and 0 deletions

View 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,
},
};
}

View 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,
},
};
}

View 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,
},
};
}

View 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,
},
};
}

View 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;
}

View 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;
};

View 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;
}

View 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,
},
};
}

View 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 {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,
},
};
}

View 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,
},
};
}

View 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,
},
};
}

View 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',
},
};
}

View 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';