mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-02-27 19:32:12 +00:00
feat: add core
This commit is contained in:
98
src/core/Classes.ts
Normal file
98
src/core/Classes.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAcademicEvent, SCAcademicEventMeta} from './things/AcademicEvent';
|
||||
import {SCArticle, SCArticleMeta} from './things/Article';
|
||||
import {SCBook, SCBookMeta} from './things/Book';
|
||||
import {SCBuilding, SCBuildingMeta} from './things/Building';
|
||||
import {SCCatalog, SCCatalogMeta} from './things/Catalog';
|
||||
import {SCDateSeries, SCDateSeriesMeta} from './things/DateSeries';
|
||||
import {SCDiff, SCDiffMeta} from './things/Diff';
|
||||
import {SCDish, SCDishMeta} from './things/Dish';
|
||||
import {SCFavorite, SCFavoriteMeta} from './things/Favorite';
|
||||
import {SCFloor, SCFloorMeta} from './things/Floor';
|
||||
import {SCMessage, SCMessageMeta} from './things/Message';
|
||||
import {SCOrganization, SCOrganizationMeta} from './things/Organization';
|
||||
import {SCPerson, SCPersonMeta} from './things/Person';
|
||||
import {SCPointOfInterest, SCPointOfInterestMeta} from './things/PointOfInterest';
|
||||
import {SCRoom, SCRoomMeta} from './things/Room';
|
||||
import {SCSemester, SCSemesterMeta} from './things/Semester';
|
||||
import {SCSetting, SCSettingMeta} from './things/Setting';
|
||||
import {SCSportCourse, SCSportCourseMeta} from './things/SportCourse';
|
||||
import {SCTicket, SCTicketMeta} from './things/Ticket';
|
||||
import {SCTour, SCTourMeta} from './things/Tour';
|
||||
import {SCVideo, SCVideoMeta} from './things/Video';
|
||||
|
||||
/* tslint:disable:variable-name */
|
||||
/**
|
||||
* A map of things, from type to meta data
|
||||
*/
|
||||
export const SCClasses = {
|
||||
/* tslint:enable */
|
||||
'academic event': SCAcademicEventMeta,
|
||||
article: SCArticleMeta,
|
||||
book: SCBookMeta,
|
||||
building: SCBuildingMeta,
|
||||
catalog: SCCatalogMeta,
|
||||
'date series': SCDateSeriesMeta,
|
||||
diff: SCDiffMeta,
|
||||
dish: SCDishMeta,
|
||||
favorite: SCFavoriteMeta,
|
||||
floor: SCFloorMeta,
|
||||
message: SCMessageMeta,
|
||||
organization: SCOrganizationMeta,
|
||||
person: SCPersonMeta,
|
||||
'point of interest': SCPointOfInterestMeta,
|
||||
room: SCRoomMeta,
|
||||
'semester': SCSemesterMeta,
|
||||
setting: SCSettingMeta,
|
||||
'sport course': SCSportCourseMeta,
|
||||
ticket: SCTicketMeta,
|
||||
tour: SCTourMeta,
|
||||
video: SCVideoMeta,
|
||||
};
|
||||
|
||||
export type SCThingsWithoutDiff =
|
||||
SCAcademicEvent
|
||||
| SCArticle
|
||||
| SCBook
|
||||
| SCBuilding
|
||||
| SCCatalog
|
||||
| SCDateSeries
|
||||
| SCDish
|
||||
| SCFavorite
|
||||
| SCFloor
|
||||
| SCMessage
|
||||
| SCOrganization
|
||||
| SCPerson
|
||||
| SCPointOfInterest
|
||||
| SCRoom
|
||||
| SCSemester
|
||||
| SCSetting
|
||||
| SCSportCourse
|
||||
| SCTicket
|
||||
| SCTour
|
||||
| SCVideo;
|
||||
|
||||
/**
|
||||
* An object that exists in the StAppsCore
|
||||
*/
|
||||
export type SCThings =
|
||||
SCThingsWithoutDiff
|
||||
| SCDiff;
|
||||
|
||||
/**
|
||||
* A field of a thing
|
||||
*/
|
||||
export type SCThingsField = keyof SCThings | string;
|
||||
154
src/core/Route.ts
Normal file
154
src/core/Route.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Possible HTTP verbs for routes
|
||||
*/
|
||||
import {SCBookAvailabilityRequest} from './protocol/routes/bookAvailability/BookAvailabilityRequest';
|
||||
import {SCBookAvailabilityResponse} from './protocol/routes/bookAvailability/BookAvailabilityResponse';
|
||||
import {SCBulkRequest} from './protocol/routes/bulk/BulkRequest';
|
||||
import {SCBulkResponse} from './protocol/routes/bulk/BulkResponse';
|
||||
import {SCBulkAddRequest} from './protocol/routes/bulk/UID/BulkAddRequest';
|
||||
import {SCBulkAddResponse} from './protocol/routes/bulk/UID/BulkAddResponse';
|
||||
import {SCBulkDoneRequest} from './protocol/routes/bulk/UID/BulkDoneRequest';
|
||||
import {SCBulkDoneResponse} from './protocol/routes/bulk/UID/BulkDoneResponse';
|
||||
import {SCFeedbackRequest} from './protocol/routes/feedback/FeedbackRequest';
|
||||
import {SCFeedbackResponse} from './protocol/routes/feedback/FeedbackResponse';
|
||||
import {SCIndexRequest} from './protocol/routes/INDEX/IndexRequest';
|
||||
import {SCIndexResponse} from './protocol/routes/INDEX/IndexResponse';
|
||||
import {SCMultiSearchRequest} from './protocol/routes/search/MultiSearchRequest';
|
||||
import {SCMultiSearchResponse} from './protocol/routes/search/MultiSearchResponse';
|
||||
import {SCSearchRequest} from './protocol/routes/search/SearchRequest';
|
||||
import {SCSearchResponse} from './protocol/routes/search/SearchResponse';
|
||||
import {SCThingUpdateRequest} from './protocol/routes/TYPE/UID/ThingUpdateRequest';
|
||||
import {SCThingUpdateResponse} from './protocol/routes/TYPE/UID/ThingUpdateResponse';
|
||||
|
||||
export type SCRouteHttpVerbs = 'GET' | 'POST' | 'PUT';
|
||||
|
||||
/**
|
||||
* A description of a route
|
||||
*/
|
||||
export interface SCRoute {
|
||||
/**
|
||||
* A map of names of possible errors that can be returned by the route with their appropriate status codes
|
||||
*/
|
||||
errorNames: string[];
|
||||
|
||||
/**
|
||||
* HTTP verb to use to request the route
|
||||
*/
|
||||
method: SCRouteHttpVerbs;
|
||||
|
||||
/**
|
||||
* List of obligatory parameters that have to be set via the requested path
|
||||
*/
|
||||
obligatoryParameters?: string[];
|
||||
|
||||
/**
|
||||
* Name of the type of the request body
|
||||
*/
|
||||
requestBodyName: string;
|
||||
|
||||
/**
|
||||
* Name of the type of the response body
|
||||
*/
|
||||
responseBodyName: string;
|
||||
|
||||
/**
|
||||
* Status code for success
|
||||
*/
|
||||
statusCodeSuccess: number;
|
||||
|
||||
/**
|
||||
* URL fragment of the route
|
||||
*/
|
||||
urlFragment: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An abstract route
|
||||
*/
|
||||
export abstract class SCAbstractRoute implements SCRoute {
|
||||
errorNames = [
|
||||
'SCErrorResponse',
|
||||
];
|
||||
method: SCRouteHttpVerbs = 'GET';
|
||||
obligatoryParameters?: string[];
|
||||
requestBodyName = 'any';
|
||||
responseBodyName = 'any';
|
||||
statusCodeSuccess = 200;
|
||||
urlFragment = '/';
|
||||
|
||||
public getUrlFragment(parameters?: { [k: string]: string }): string {
|
||||
if (typeof parameters === 'undefined') {
|
||||
parameters = {};
|
||||
}
|
||||
|
||||
let obligatoryParameters: string[] = [];
|
||||
|
||||
if (Array.isArray(this.obligatoryParameters)) {
|
||||
obligatoryParameters = this.obligatoryParameters;
|
||||
}
|
||||
|
||||
if (Object.keys(parameters).length > obligatoryParameters.length) {
|
||||
throw new Error('Extraneous parameters provided.');
|
||||
}
|
||||
|
||||
return this.urlFragment
|
||||
.split('/')
|
||||
.map((part) => {
|
||||
if (part.indexOf(':') !== 0) {
|
||||
return part;
|
||||
}
|
||||
|
||||
const parameter = part.substr(1);
|
||||
|
||||
// @ts-ignore
|
||||
if (typeof parameters[parameter] === 'undefined') {
|
||||
throw new Error(`Parameter '${parameter}' not provided.`);
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return parameters[parameter];
|
||||
}).join('/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible requests
|
||||
*/
|
||||
export type SCRequests =
|
||||
SCBookAvailabilityRequest
|
||||
| SCBulkRequest
|
||||
| SCBulkAddRequest
|
||||
| SCBulkDoneRequest
|
||||
| SCFeedbackRequest
|
||||
| SCIndexRequest
|
||||
| SCMultiSearchRequest
|
||||
| SCSearchRequest
|
||||
| SCThingUpdateRequest;
|
||||
|
||||
/**
|
||||
* Possible responses
|
||||
*/
|
||||
export type SCResponses =
|
||||
SCBookAvailabilityResponse
|
||||
| SCBulkResponse
|
||||
| SCBulkAddResponse
|
||||
| SCBulkDoneResponse
|
||||
| SCFeedbackResponse
|
||||
| SCIndexResponse
|
||||
| SCMultiSearchResponse
|
||||
| SCSearchResponse
|
||||
| SCThingUpdateResponse;
|
||||
273
src/core/Thing.ts
Normal file
273
src/core/Thing.ts
Normal file
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsField} from './Classes';
|
||||
import {SCOrganization} from './things/Organization';
|
||||
import {SCPerson} from './things/Person';
|
||||
import {isThingWithTranslations} from './types/Guards';
|
||||
import {SCTranslations} from './types/i18n';
|
||||
import {SCISO8601Date} from './types/Time';
|
||||
import {SCUuid} from './types/UUID';
|
||||
|
||||
/**
|
||||
* Types a thing can be
|
||||
*/
|
||||
export type SCThingTypes = 'article'
|
||||
| 'academic event'
|
||||
| 'book'
|
||||
| 'building'
|
||||
| 'catalog'
|
||||
| 'date series'
|
||||
| 'diff'
|
||||
| 'dish'
|
||||
| 'favorite'
|
||||
| 'floor'
|
||||
| 'message'
|
||||
| 'offer'
|
||||
| 'organization'
|
||||
| 'person'
|
||||
| 'point of interest'
|
||||
| 'room'
|
||||
| 'semester'
|
||||
| 'setting'
|
||||
| 'sport course'
|
||||
| 'ticket'
|
||||
| 'tour'
|
||||
| 'video';
|
||||
|
||||
/**
|
||||
* A thing
|
||||
*/
|
||||
export interface SCThing {
|
||||
/**
|
||||
* Alternate names of the thing
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
/**
|
||||
* Description of the thing
|
||||
*
|
||||
* @minLength 1
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Image of the thing
|
||||
*/
|
||||
image?: string;
|
||||
/**
|
||||
* Name of the thing
|
||||
*
|
||||
* @minLength 1
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin: SCThingOrigin;
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||
/**
|
||||
* Type of the thing
|
||||
*/
|
||||
type: SCThingTypes;
|
||||
/**
|
||||
* Universally unique identifier of the thing
|
||||
*/
|
||||
uid: SCUuid;
|
||||
/**
|
||||
* URL of the thing
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Origin of a thing
|
||||
*/
|
||||
export interface SCThingOrigin {
|
||||
/**
|
||||
* When the thing was indexed last from the origin
|
||||
*/
|
||||
indexed: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Maintainer of the origin
|
||||
*
|
||||
* e.g. restaurant of a dish
|
||||
*/
|
||||
maintainer?: SCPerson | SCOrganization;
|
||||
|
||||
/**
|
||||
* When the thing was modified last in the origin
|
||||
*/
|
||||
modified?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Name of the origin
|
||||
*/
|
||||
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?: SCPerson | SCOrganization;
|
||||
|
||||
/**
|
||||
* Main URL of the origin
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about things
|
||||
*/
|
||||
export class SCThingMeta {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
static fieldTranslations: any = {
|
||||
de: {
|
||||
alternateNames: 'alternative Namen',
|
||||
description: 'Beschreibung',
|
||||
image: 'Bild',
|
||||
name: 'Name',
|
||||
translations: 'Übersetzungen',
|
||||
type: 'Typ',
|
||||
uid: 'Identifikation',
|
||||
url: 'URL',
|
||||
},
|
||||
en: {
|
||||
alternateNames: 'alternate names',
|
||||
description: 'description',
|
||||
uid: 'identification',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
static fieldValueTranslations: any = {
|
||||
de: {
|
||||
type: {
|
||||
AcademicTerm: 'Studienabschnitt',
|
||||
Article: 'Artikel',
|
||||
Book: 'Buch',
|
||||
Catalog: 'Katalog',
|
||||
Date: 'Termin',
|
||||
Diff: 'Unterschied',
|
||||
Dish: 'Essen',
|
||||
Event: 'Veranstaltung',
|
||||
Favorite: 'Favorit',
|
||||
FloorPlan: 'Etagenplan',
|
||||
Message: 'Nachricht',
|
||||
Offer: 'Angebot',
|
||||
Organization: 'Organisation',
|
||||
Person: 'Person',
|
||||
Place: 'Ort',
|
||||
Setting: 'Einstellung',
|
||||
Thing: 'Ding',
|
||||
Ticket: 'Ticket',
|
||||
Tour: 'Tour',
|
||||
Video: 'Video',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Get field translation
|
||||
*
|
||||
* @param {keyof SCTranslations<T extends SCThing>} language Language to get field translation for
|
||||
* @param {keyof T} field Field to get translation for
|
||||
* @returns {string} Translated field or field itself
|
||||
*/
|
||||
static getFieldTranslation<T extends SCThing>(language: keyof SCTranslations<T>,
|
||||
field: SCThingsField): string {
|
||||
if (typeof this.fieldTranslations[language] !== 'undefined'
|
||||
&& typeof this.fieldTranslations[language][field] !== 'undefined') {
|
||||
return this.fieldTranslations[language][field];
|
||||
}
|
||||
|
||||
return field as string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field value translation
|
||||
*
|
||||
* @param {keyof SCTranslations<T>} language Language to get value translation for
|
||||
* @param {string} field Field to get value translation for
|
||||
* @param {T} thing SCThing to get value translation for
|
||||
* @returns {string} Translated value or value itself
|
||||
*/
|
||||
static getFieldValueTranslation<T extends SCThing>(language: keyof SCTranslations<T>,
|
||||
field: SCThingsField,
|
||||
thing: T): string {
|
||||
|
||||
let translations: SCTranslations<SCThingTranslatableProperties>;
|
||||
|
||||
if (isThingWithTranslations(thing)) {
|
||||
translations = thing.translations;
|
||||
|
||||
const languageTranslations: SCThingTranslatableProperties | undefined = translations[language];
|
||||
|
||||
if (typeof languageTranslations !== 'undefined') {
|
||||
if (typeof (languageTranslations as any)[field] !== 'undefined') {
|
||||
return (languageTranslations as any)[field];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get translation from meta object
|
||||
if (typeof this.fieldValueTranslations[language] !== 'undefined'
|
||||
&& typeof this.fieldValueTranslations[language][field] !== 'undefined'
|
||||
&& typeof (thing as any)[field] !== 'undefined'
|
||||
&& typeof this.fieldValueTranslations[language][field][(thing as any)[field]]) {
|
||||
return this.fieldValueTranslations[language][field][(thing as any)[field]];
|
||||
}
|
||||
|
||||
// fallback to value itself
|
||||
return (thing as any)[field];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of things
|
||||
*/
|
||||
export interface SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the description of the thing
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Translation of the name of the thing
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin?: {
|
||||
/**
|
||||
* Translation of the name of the origin of the thing
|
||||
*/
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
46
src/core/base/AcademicTerm.ts
Normal file
46
src/core/base/AcademicTerm.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing} from '../Thing';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* An academic term without references
|
||||
*/
|
||||
export interface SCAcademicTermWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Short name of the academic term, using the given pattern
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
/**
|
||||
* End date of the academic term
|
||||
*/
|
||||
endDate: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* End date of lectures in the academic term
|
||||
*/
|
||||
eventsEndDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Start date of lectures in the academic term
|
||||
*/
|
||||
eventsStartDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Start date of the academic term
|
||||
*/
|
||||
startDate: SCISO8601Date;
|
||||
}
|
||||
80
src/core/base/CreativeWork.ts
Normal file
80
src/core/base/CreativeWork.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCLanguage, SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
} from './ThingThatCanBeOffered';
|
||||
|
||||
/**
|
||||
* A creative work without references
|
||||
*/
|
||||
export interface SCCreativeWorkWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Date the creative work was published
|
||||
*/
|
||||
datePublished?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* List of languages this creative work is written/recorded/... in
|
||||
*/
|
||||
inLanguages?: SCLanguage[];
|
||||
|
||||
/**
|
||||
* Keywords of the creative work
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
* Translated fields of the creative work
|
||||
*/
|
||||
translations?: SCTranslations<SCCreativeWorkTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A creative work
|
||||
*/
|
||||
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
authors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* List of publishers of the creative work
|
||||
*/
|
||||
publishers?: Array<SCPersonWithoutReferences | SCOrganizationWithoutReferences>;
|
||||
|
||||
/**
|
||||
* Translated fields of the creative work
|
||||
*/
|
||||
translations?: SCTranslations<SCCreativeWorkTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of creative works
|
||||
*/
|
||||
export interface SCCreativeWorkTranslatableProperties
|
||||
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Translation of the keywords of the creative work
|
||||
*/
|
||||
keywords?: string[];
|
||||
}
|
||||
70
src/core/base/Event.ts
Normal file
70
src/core/base/Event.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing} from '../Thing';
|
||||
import {SCCatalogWithoutReferences} from '../things/Catalog';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCAcademicTermWithoutReferences} from './AcademicTerm';
|
||||
import {SCCreativeWorkWithoutReferences} from './CreativeWork';
|
||||
|
||||
/**
|
||||
* An event without references
|
||||
*/
|
||||
export interface SCEventWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Maximum number of participants of the event
|
||||
*
|
||||
* A maximum number of people that can participate in the event.
|
||||
*/
|
||||
maximumParticipants?: number;
|
||||
|
||||
/**
|
||||
* Remaining attendee capacity of the event
|
||||
*
|
||||
* This number represents the remaining open spots.
|
||||
*/
|
||||
remainingAttendeeCapacity?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event
|
||||
*/
|
||||
export interface SCEvent extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Academic terms that an event belongs to, e.g. semester(s).
|
||||
*/
|
||||
academicTerms?: SCAcademicTermWithoutReferences[];
|
||||
|
||||
/**
|
||||
* 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[];
|
||||
}
|
||||
44
src/core/base/Place.ts
Normal file
44
src/core/base/Place.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Point, Polygon} from 'geojson';
|
||||
import {SCThing} from '../Thing';
|
||||
import {SCPostalAddress} from '../types/PostalAddress';
|
||||
|
||||
/**
|
||||
* A place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Address of the place
|
||||
*/
|
||||
address?: SCPostalAddress;
|
||||
|
||||
/**
|
||||
* Position/shape of the place
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* Can not be a GeometryCollection because ElasticSearch does not allow distance filtering/sorting on other types
|
||||
*/
|
||||
geo: {
|
||||
point: Point,
|
||||
polygon?: Polygon,
|
||||
};
|
||||
|
||||
/**
|
||||
* Opening hours of the place
|
||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||
*/
|
||||
openingHours?: string;
|
||||
}
|
||||
31
src/core/base/ThingInPlace.ts
Normal file
31
src/core/base/ThingInPlace.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing} from '../Thing';
|
||||
import {SCBuildingWithoutReferences} from '../things/Building';
|
||||
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from '../things/Room';
|
||||
|
||||
/**
|
||||
* A thing that is or happens in a place
|
||||
*/
|
||||
export interface SCThingInPlace extends SCThing {
|
||||
/**
|
||||
* Place the thing is or happens in
|
||||
*/
|
||||
inPlace?:
|
||||
SCBuildingWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences;
|
||||
}
|
||||
33
src/core/base/ThingThatAcceptsPayments.ts
Normal file
33
src/core/base/ThingThatAcceptsPayments.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing} from '../Thing';
|
||||
|
||||
/**
|
||||
* Types of payment that are accepted at a place.
|
||||
*/
|
||||
export type SCThingThatAcceptsPaymentsAcceptedPayments =
|
||||
'Cash'
|
||||
| 'Credit'
|
||||
| 'Cafeteria Card';
|
||||
|
||||
/**
|
||||
* A place without references that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Accepted payments of the place
|
||||
*/
|
||||
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
|
||||
}
|
||||
128
src/core/base/ThingThatCanBeOffered.ts
Normal file
128
src/core/base/ThingThatCanBeOffered.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCBuildingWithoutReferences} from '../things/Building';
|
||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from '../things/Room';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* A map from group name to price
|
||||
*/
|
||||
export interface SCPriceGroup {
|
||||
[s: string]: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Price distinctions for academic context
|
||||
*/
|
||||
export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
/**
|
||||
* Price for employees
|
||||
*/
|
||||
employee?: number;
|
||||
|
||||
/**
|
||||
* Price for guests
|
||||
*/
|
||||
guest?: number;
|
||||
|
||||
/**
|
||||
* Price for students
|
||||
*/
|
||||
student?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing without references that has a price tag
|
||||
*/
|
||||
export interface SCThingThatCanBeOffered<T extends SCPriceGroup> extends SCThing {
|
||||
/**
|
||||
* 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> {
|
||||
/**
|
||||
* Availability of an offer
|
||||
*/
|
||||
availability: SCThingThatCanBeOfferedAvailabilty;
|
||||
|
||||
/**
|
||||
* The time when the thing becomes unavailable as an SCISO8601Date formatted string.
|
||||
*/
|
||||
availabilityEnds?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* The time when the thing becomes available as an SCISO8601Date formatted string.
|
||||
*/
|
||||
availabilityStarts?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Default price of the thing
|
||||
*/
|
||||
price: number;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
'offers[].availability'?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible things a provider can be
|
||||
*/
|
||||
export type SCThingThatCanBeOfferedProvider =
|
||||
SCBuildingWithoutReferences
|
||||
| SCOrganizationWithoutReferences
|
||||
| SCPersonWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences;
|
||||
|
||||
/**
|
||||
* Availability of an Offer
|
||||
*/
|
||||
export type SCThingThatCanBeOfferedAvailabilty =
|
||||
'in stock'
|
||||
| 'out of stock'
|
||||
| 'online only'
|
||||
| 'limited availabilty';
|
||||
90
src/core/base/ThingWithCategories.ts
Normal file
90
src/core/base/ThingWithCategories.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A thing without references with categories
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
||||
*/
|
||||
export interface SCThingWithCategoriesWithoutReferences<T,
|
||||
U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThing {
|
||||
/**
|
||||
* Categories of a thing with categories
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* TypeScript does not allow generics as index signatures. The properties of the map should exist in `T`.
|
||||
*/
|
||||
categorySpecificValues?: {
|
||||
[s: string]: 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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
|
||||
/**
|
||||
* Category specific description of a thing
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Category specific image of a thing
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Category specific name of a thing
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Category specific URL of a thing
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
23
src/core/base/ThingWithTranslations.ts
Normal file
23
src/core/base/ThingWithTranslations.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A thing that has translations
|
||||
*/
|
||||
export interface SCThingWithTranslations extends SCThing {
|
||||
translations: SCTranslations<SCThingTranslatableProperties>;
|
||||
}
|
||||
43
src/core/files/ConfigFile.ts
Normal file
43
src/core/files/ConfigFile.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { SCAppConfiguration } from '../types/config/App';
|
||||
import { SCBackendConfiguration, SCBackendInternalConfiguration } from '../types/config/Backend';
|
||||
import { SCLicensePlate } from '../types/namespaces';
|
||||
|
||||
/**
|
||||
* A configuration file that configures app and backend
|
||||
*/
|
||||
export interface SCConfigFile {
|
||||
|
||||
/**
|
||||
* Configuration for the app that is visible to clients
|
||||
*/
|
||||
app: SCAppConfiguration;
|
||||
|
||||
/**
|
||||
* Configuration for the backend that is visible to clients
|
||||
*/
|
||||
backend: SCBackendConfiguration;
|
||||
|
||||
/**
|
||||
* Configuration that is not visible to clients
|
||||
*/
|
||||
internal: SCBackendInternalConfiguration;
|
||||
|
||||
/**
|
||||
* UID of the university, e.g. the license plate
|
||||
*/
|
||||
uid: SCLicensePlate;
|
||||
}
|
||||
150
src/core/protocol/errors/ErrorResponse.ts
Normal file
150
src/core/protocol/errors/ErrorResponse.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ValidationError} from 'jsonschema';
|
||||
|
||||
/**
|
||||
* A generic error that can be returned by the backend if somethings fails during the processing of a request
|
||||
*/
|
||||
export interface SCErrorResponse extends Error {
|
||||
/**
|
||||
* Additional data that describes the error
|
||||
*/
|
||||
additionalData?: any;
|
||||
|
||||
/**
|
||||
* HTTP status code to return this error with
|
||||
*/
|
||||
statusCode: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that can be created by the backend during the processing of a request
|
||||
*/
|
||||
export abstract class SCError implements SCErrorResponse {
|
||||
/**
|
||||
* Call stack of the error
|
||||
*/
|
||||
stack?: string;
|
||||
|
||||
/**
|
||||
* Instatiate an SCError
|
||||
* @param name Name of the error
|
||||
* @param message Message of the error
|
||||
* @param statusCode HTTP status code to return this error with
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(public name: string, public message: string, public statusCode: number, stack?: boolean) {
|
||||
// generate stacktrace if needed
|
||||
if (stack) {
|
||||
this.stack = (new Error()).stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned when the validation of a request fails
|
||||
*/
|
||||
export class SCValidationErrorResponse extends SCError {
|
||||
/**
|
||||
* List of validatation errors
|
||||
*/
|
||||
additionalData: ValidationError[];
|
||||
|
||||
/**
|
||||
* Create a SCValidationErrorResponse
|
||||
* @param errors List of validation errors
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(errors: ValidationError[], stack?: boolean) {
|
||||
super('ValidationError', 'Validation of request failed', 400, stack);
|
||||
this.additionalData = errors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned when the content type of the request is not supported
|
||||
*/
|
||||
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCUnsupportedMediaTypeErrorResponse
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('UnsupportedMediaTypeError', 'Unsupported media type', 415, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
||||
*/
|
||||
export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCMethodNotAllowedErrorResponse
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', 405, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned, when to many request are submitted at once
|
||||
*/
|
||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCTooManyRequestsErrorResponse
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('TooManyRequestsError', 'Too many requests. You can not submit more than 5 queries an once', 429, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned when the requested route or resource was not found
|
||||
*/
|
||||
export class SCNotFoundErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCNotFoundErrorResponse
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('NotFoundError', 'Resource not found', 404, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned, when an internal server error occured
|
||||
*/
|
||||
export class SCInternalServerErrorResponse extends SCError {
|
||||
/**
|
||||
* Internal error that occured. If the stack is disabled this error is not set for security reasons
|
||||
*/
|
||||
additionalData?: Error;
|
||||
|
||||
/**
|
||||
* Create a SCInternalServerErrorResponse
|
||||
* @param err Internal server error
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
* and the internal server error should be displayed to the client
|
||||
*/
|
||||
constructor(err?: Error, stack?: boolean) {
|
||||
super('InternalServerError', 'Internal server error', 502, stack);
|
||||
|
||||
if (stack) {
|
||||
this.additionalData = err;
|
||||
}
|
||||
}
|
||||
}
|
||||
41
src/core/protocol/routes/INDEX/IndexRequest.ts
Normal file
41
src/core/protocol/routes/INDEX/IndexRequest.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../Route';
|
||||
|
||||
/**
|
||||
* Index request
|
||||
*/
|
||||
export interface SCIndexRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Route to request meta information about the deployment
|
||||
*/
|
||||
export class SCIndexRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.requestBodyName = 'SCIndexRequest';
|
||||
this.responseBodyName = 'SCIndexResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/';
|
||||
}
|
||||
}
|
||||
25
src/core/protocol/routes/INDEX/IndexResponse.ts
Normal file
25
src/core/protocol/routes/INDEX/IndexResponse.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAppConfiguration} from '../../../types/config/App';
|
||||
import {SCBackendConfiguration} from '../../../types/config/Backend';
|
||||
|
||||
/**
|
||||
* A response to an index request
|
||||
*/
|
||||
export interface SCIndexResponse {
|
||||
app: SCAppConfiguration;
|
||||
|
||||
backend: SCBackendConfiguration;
|
||||
}
|
||||
46
src/core/protocol/routes/TYPE/UID/ThingUpdateRequest.ts
Normal file
46
src/core/protocol/routes/TYPE/UID/ThingUpdateRequest.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThings} from '../../../../Classes';
|
||||
import {SCAbstractRoute} from '../../../../Route';
|
||||
|
||||
/**
|
||||
* Request to update an existing thing
|
||||
*/
|
||||
export type SCThingUpdateRequest = SCThings;
|
||||
|
||||
/**
|
||||
* Route for updating existing things
|
||||
*/
|
||||
export class SCThingUpdateRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCNotFoundErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'PUT';
|
||||
this.obligatoryParameters = [
|
||||
'TYPE',
|
||||
'UID',
|
||||
];
|
||||
this.requestBodyName = 'SCThingUpdateRequest';
|
||||
this.responseBodyName = 'SCThingUpdateResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/:TYPE/:UID';
|
||||
}
|
||||
}
|
||||
19
src/core/protocol/routes/TYPE/UID/ThingUpdateResponse.ts
Normal file
19
src/core/protocol/routes/TYPE/UID/ThingUpdateResponse.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Response for an entity update request
|
||||
*/
|
||||
export interface SCThingUpdateResponse {
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../Route';
|
||||
import {SCUuid} from '../../../types/UUID';
|
||||
|
||||
/**
|
||||
* Request to check the availability of books
|
||||
*/
|
||||
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
|
||||
|
||||
/**
|
||||
* Availability request by ISBN
|
||||
*/
|
||||
export interface SCBookAvailabilityRequestByIsbn {
|
||||
/**
|
||||
* ISBN of the book to check availability for
|
||||
*/
|
||||
isbn: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Availability request by UUID
|
||||
*/
|
||||
export interface SCBookAvailabilityRequestByUuid {
|
||||
/**
|
||||
* UID of the book to check availability for
|
||||
*/
|
||||
uid: SCUuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route for book availiability
|
||||
*/
|
||||
export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCNotFoundErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/bookAvailability';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/ThingThatCanBeOffered';
|
||||
|
||||
/**
|
||||
* List of availabilities of a book
|
||||
*/
|
||||
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
||||
71
src/core/protocol/routes/bulk/BulkRequest.ts
Normal file
71
src/core/protocol/routes/bulk/BulkRequest.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../Route';
|
||||
import {SCThingTypes} from '../../../Thing';
|
||||
import {SCISO8601Date} from '../../../types/Time';
|
||||
|
||||
/**
|
||||
* A bulk request
|
||||
*
|
||||
* Parameters to be sent to request a new bulk.
|
||||
*/
|
||||
export interface SCBulkRequest extends SCBulkParameters {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters for a bulk
|
||||
*/
|
||||
export interface SCBulkParameters {
|
||||
/**
|
||||
* Expiration of bulk
|
||||
*
|
||||
* If the date is hit and the bulk is not done, it will be deleted and all data removed.
|
||||
* Defaults to one hour.
|
||||
*/
|
||||
expiration?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Source of data for this bulk
|
||||
*
|
||||
* A short "description" of the source of the data to identify it inside the database.
|
||||
* A second bulk with the same source overrides the data of the first bulk once it is done.
|
||||
*/
|
||||
source: string;
|
||||
|
||||
/**
|
||||
* Type of things that are indexed in this bulk
|
||||
*/
|
||||
type: SCThingTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route for bulk creation
|
||||
*/
|
||||
export class SCBulkRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.requestBodyName = 'SCBulkRequest';
|
||||
this.responseBodyName = 'SCBulkResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/bulk';
|
||||
}
|
||||
}
|
||||
34
src/core/protocol/routes/bulk/BulkResponse.ts
Normal file
34
src/core/protocol/routes/bulk/BulkResponse.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCUuid} from '../../../types/UUID';
|
||||
import {SCBulkParameters} from './BulkRequest';
|
||||
|
||||
/**
|
||||
* Requested Bulk from backend
|
||||
*/
|
||||
export interface SCBulkResponse extends SCBulkParameters {
|
||||
/**
|
||||
* State of bulk
|
||||
*
|
||||
* The state is `in progress` while it accepts things to be added to the bulk.
|
||||
* The state is `done` once it is closed.
|
||||
*/
|
||||
state: 'in progress' | 'done';
|
||||
|
||||
/**
|
||||
* Universally unique identifier of the bulk
|
||||
*/
|
||||
uid: SCUuid;
|
||||
}
|
||||
43
src/core/protocol/routes/bulk/UID/BulkAddRequest.ts
Normal file
43
src/core/protocol/routes/bulk/UID/BulkAddRequest.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThings} from '../../../../Classes';
|
||||
import {SCAbstractRoute} from '../../../../Route';
|
||||
|
||||
/**
|
||||
* Request to add a thing to a bulk
|
||||
*/
|
||||
export type SCBulkAddRequest = SCThings;
|
||||
|
||||
/**
|
||||
* Route for indexing SC things in a bulk
|
||||
*/
|
||||
export class SCBulkAddRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCNotFoundErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.obligatoryParameters = ['UID'];
|
||||
this.requestBodyName = 'SCBulkAddRequest';
|
||||
this.responseBodyName = 'SCBulkAddResponse';
|
||||
this.statusCodeSuccess = 201;
|
||||
this.urlFragment = '/bulk/:UID';
|
||||
}
|
||||
}
|
||||
19
src/core/protocol/routes/bulk/UID/BulkAddResponse.ts
Normal file
19
src/core/protocol/routes/bulk/UID/BulkAddResponse.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Response to a request to add a thing to a bulk
|
||||
*/
|
||||
export interface SCBulkAddResponse {
|
||||
}
|
||||
43
src/core/protocol/routes/bulk/UID/BulkDoneRequest.ts
Normal file
43
src/core/protocol/routes/bulk/UID/BulkDoneRequest.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../../Route';
|
||||
|
||||
/**
|
||||
* Request to change the bulk state to done (close the bulk process)
|
||||
*/
|
||||
export interface SCBulkDoneRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Route for closing bulks
|
||||
*/
|
||||
export class SCBulkDoneRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCNotFoundErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.obligatoryParameters = ['UID'];
|
||||
this.requestBodyName = 'SCBulkDoneRequest';
|
||||
this.responseBodyName = 'SCBulkDoneResponse';
|
||||
this.statusCodeSuccess = 204;
|
||||
this.urlFragment = '/bulk/:UID/done';
|
||||
}
|
||||
}
|
||||
19
src/core/protocol/routes/bulk/UID/BulkDoneResponse.ts
Normal file
19
src/core/protocol/routes/bulk/UID/BulkDoneResponse.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Response to a request to change the state of a bulk to done
|
||||
*/
|
||||
export interface SCBulkDoneResponse {
|
||||
}
|
||||
81
src/core/protocol/routes/feedback/FeedbackRequest.ts
Normal file
81
src/core/protocol/routes/feedback/FeedbackRequest.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../Route';
|
||||
import {SCMessage} from '../../../things/Message';
|
||||
|
||||
/**
|
||||
* User feedback
|
||||
*/
|
||||
export interface SCFeedbackRequest extends SCMessage {
|
||||
/**
|
||||
* Meta data that helps to understand the feedback
|
||||
*/
|
||||
metaData: {
|
||||
/**
|
||||
* Whether or not the user enabled the debug mode
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Platform identifier
|
||||
*/
|
||||
platform: string;
|
||||
|
||||
/**
|
||||
* Scope/app state at feedback invocation
|
||||
*/
|
||||
scope: any;
|
||||
|
||||
/**
|
||||
* Whether or not the feedback is sendable
|
||||
*/
|
||||
sendable?: boolean;
|
||||
|
||||
/**
|
||||
* App state that feedback was invoked from
|
||||
*/
|
||||
state: any;
|
||||
|
||||
/**
|
||||
* User agent
|
||||
*/
|
||||
userAgent: string;
|
||||
|
||||
/**
|
||||
* StApps version string
|
||||
*/
|
||||
version: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Route for feedback submission
|
||||
*/
|
||||
export class SCFeedbackRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.requestBodyName = 'SCFeedbackRequest';
|
||||
this.responseBodyName = 'SCFeedbackResponse';
|
||||
this.statusCodeSuccess = 204;
|
||||
this.urlFragment = '/feedback';
|
||||
}
|
||||
}
|
||||
19
src/core/protocol/routes/feedback/FeedbackResponse.ts
Normal file
19
src/core/protocol/routes/feedback/FeedbackResponse.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* A response to a feedback request
|
||||
*/
|
||||
export interface SCFeedbackResponse {
|
||||
}
|
||||
48
src/core/protocol/routes/search/MultiSearchRequest.ts
Normal file
48
src/core/protocol/routes/search/MultiSearchRequest.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../Route';
|
||||
import {SCSearchQuery} from './SearchRequest';
|
||||
|
||||
/**
|
||||
* A multi search request
|
||||
*
|
||||
* This is a map of [[SCSearchRequest]]s indexed by name.
|
||||
*
|
||||
* **CAUTION: This is limited to an amount of queries. Currently this limit is 5.**
|
||||
*/
|
||||
export interface SCMultiSearchRequest {
|
||||
[k: string]: SCSearchQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route for submission of multiple search requests at once
|
||||
*/
|
||||
export class SCMultiSearchRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCTooManyRequestsErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.requestBodyName = 'SCMultiSearchRequest';
|
||||
this.responseBodyName = 'SCMultiSearchResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/search/multi';
|
||||
}
|
||||
}
|
||||
24
src/core/protocol/routes/search/MultiSearchResponse.ts
Normal file
24
src/core/protocol/routes/search/MultiSearchResponse.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCSearchResult} from './SearchResponse';
|
||||
|
||||
/**
|
||||
* A multi search response
|
||||
*
|
||||
* This is a map of [[SCSearchResponse]]s indexed by name
|
||||
*/
|
||||
export interface SCMultiSearchResponse {
|
||||
[k: string]: SCSearchResult;
|
||||
}
|
||||
73
src/core/protocol/routes/search/SearchRequest.ts
Normal file
73
src/core/protocol/routes/search/SearchRequest.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute} from '../../../Route';
|
||||
import {SCSearchFilter} from '../../../types/filters/Abstract';
|
||||
import {SCSearchSort} from '../../../types/sorts/Abstract';
|
||||
|
||||
/**
|
||||
* A search request
|
||||
*/
|
||||
export interface SCSearchRequest extends SCSearchQuery {
|
||||
}
|
||||
|
||||
/**
|
||||
* A search query
|
||||
*/
|
||||
export interface SCSearchQuery {
|
||||
/**
|
||||
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
|
||||
*/
|
||||
filter?: SCSearchFilter;
|
||||
|
||||
/**
|
||||
* Number of things to skip in result set (paging)
|
||||
*/
|
||||
from?: number;
|
||||
|
||||
/**
|
||||
* A term to search for
|
||||
*/
|
||||
query?: string;
|
||||
|
||||
/**
|
||||
* Number of things to have in the result set (paging)
|
||||
*/
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* A list of sorting parameters to order the result set by
|
||||
*/
|
||||
sort?: SCSearchSort[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Route for searching things
|
||||
*/
|
||||
export class SCSearchRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
'SCInternalServerErrorResponse',
|
||||
'SCMethodNotAllowedErrorResponse',
|
||||
'SCUnsupportedMediaTypeErrorResponse',
|
||||
'SCValidationErrorResponse',
|
||||
];
|
||||
this.method = 'POST';
|
||||
this.requestBodyName = 'SCSearchRequest';
|
||||
this.responseBodyName = 'SCSearchResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/search';
|
||||
}
|
||||
}
|
||||
86
src/core/protocol/routes/search/SearchResponse.ts
Normal file
86
src/core/protocol/routes/search/SearchResponse.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThings, SCThingsField} from '../../../Classes';
|
||||
|
||||
/**
|
||||
* A search response
|
||||
*/
|
||||
export interface SCSearchResponse extends SCSearchResult {
|
||||
}
|
||||
|
||||
/**
|
||||
* A search response
|
||||
*/
|
||||
export interface SCSearchResult {
|
||||
/**
|
||||
* Data (any data object)
|
||||
*/
|
||||
data: SCThings[];
|
||||
|
||||
/**
|
||||
* Facets (aggregations over all matching data)
|
||||
*/
|
||||
facets: SCFacet[];
|
||||
|
||||
/**
|
||||
* Pagination information
|
||||
*/
|
||||
pagination: {
|
||||
/**
|
||||
* Count of given data. Same as data.length
|
||||
*/
|
||||
count: number;
|
||||
|
||||
/**
|
||||
* Offset of data on all matching data. Given by [[SCSearchQuery.from]]
|
||||
*/
|
||||
offset: number;
|
||||
|
||||
/**
|
||||
* Number of total matching data
|
||||
*/
|
||||
total: number
|
||||
};
|
||||
|
||||
/**
|
||||
* Stats of the search engine
|
||||
*/
|
||||
stats: {
|
||||
/**
|
||||
* Response time of the search engine in ms
|
||||
*/
|
||||
time: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A search facet
|
||||
*/
|
||||
export interface SCFacet {
|
||||
/**
|
||||
* Values for the aggregation
|
||||
*/
|
||||
buckets: Array<{
|
||||
/**
|
||||
* One value with its number of occurrences
|
||||
*/
|
||||
[key: string]: number;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Field of the aggregation
|
||||
*/
|
||||
field: SCThingsField;
|
||||
}
|
||||
113
src/core/things/AcademicEvent.ts
Normal file
113
src/core/things/AcademicEvent.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCEvent, SCEventWithoutReferences} from '../base/Event';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Type of an academic event
|
||||
*/
|
||||
export type SCAcademicEventType = 'academic event';
|
||||
|
||||
/**
|
||||
* An academic event without references
|
||||
*/
|
||||
export interface SCAcademicEventWithoutReferences
|
||||
extends SCEventWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Majors of the academic event that this event belongs to
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Original unmapped category from the source of the academic event
|
||||
*/
|
||||
originalCategory?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
*/
|
||||
translations?: SCTranslations<SCAcademicEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an academic event
|
||||
*/
|
||||
type: SCAcademicEventType;
|
||||
}
|
||||
|
||||
export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences {
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
*/
|
||||
translations?: SCTranslations<SCAcademicEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an academic event
|
||||
*/
|
||||
type: SCAcademicEventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event meta data
|
||||
*/
|
||||
export class SCAcademicEventMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
type: 'Event',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of academic events
|
||||
*/
|
||||
export type SCAcademicEventCategories =
|
||||
'lecture'
|
||||
| 'seminar'
|
||||
| 'integrated course'
|
||||
| 'written exam'
|
||||
| 'tutorial'
|
||||
| 'project'
|
||||
| 'colloquium'
|
||||
| 'practicum'
|
||||
| 'introductory class'
|
||||
| 'course'
|
||||
| 'practicum introduction'
|
||||
| 'excursion'
|
||||
| '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
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Translation of the original unmapped category from the source of the academic event
|
||||
*/
|
||||
originalCategory?: string;
|
||||
}
|
||||
98
src/core/things/Article.ts
Normal file
98
src/core/things/Article.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from '../base/CreativeWork';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Type of an article
|
||||
*/
|
||||
export type SCArticleType = 'article';
|
||||
|
||||
/**
|
||||
* An article without references
|
||||
*/
|
||||
export interface SCArticleWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Article itself as markdown
|
||||
*/
|
||||
articleBody: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
translations?: SCTranslations<SCArticleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an article
|
||||
*/
|
||||
type: SCArticleType;
|
||||
}
|
||||
|
||||
/**
|
||||
* An article
|
||||
*/
|
||||
export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences {
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
translations?: SCTranslations<SCArticleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an article
|
||||
*/
|
||||
type: SCArticleType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about an article
|
||||
*/
|
||||
export class SCArticleMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
articleBody: 'Artikeltext',
|
||||
categories: 'Kategorien',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of articles
|
||||
*/
|
||||
export type SCArticleCategories = 'unipedia';
|
||||
|
||||
/**
|
||||
* Translatable properties of creative works
|
||||
*/
|
||||
export interface SCArticleTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of the article itself as markdown
|
||||
*/
|
||||
articleBody?: string[];
|
||||
}
|
||||
103
src/core/things/Book.ts
Normal file
103
src/core/things/Book.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from '../base/CreativeWork';
|
||||
import {SCThingWithCategoriesTranslatableProperties} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
|
||||
/**
|
||||
* Type of a book
|
||||
*/
|
||||
export type SCBookType = 'book';
|
||||
|
||||
/**
|
||||
* A book without references
|
||||
*/
|
||||
export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* Edition of a book
|
||||
*/
|
||||
bookEdition?: string;
|
||||
|
||||
/**
|
||||
* ISBN of a book
|
||||
*/
|
||||
isbn: string;
|
||||
|
||||
/**
|
||||
* Number of pages of a book
|
||||
*/
|
||||
numberOfPages?: number;
|
||||
|
||||
/**
|
||||
* Translated properties of a book
|
||||
*/
|
||||
translations?: SCTranslations<SCBookTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a book
|
||||
*/
|
||||
type: SCBookType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A book
|
||||
*/
|
||||
export interface SCBook extends SCCreativeWork, SCBookWithoutReferences {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
authors: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated properties of a book
|
||||
*/
|
||||
translations?: SCTranslations<SCBookTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a book
|
||||
*/
|
||||
type: SCBookType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a book
|
||||
*/
|
||||
export class SCBookMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
bookEdition: 'Edition',
|
||||
isbn: 'ISBN',
|
||||
numberOfPages: 'Seitenanzahl',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a book
|
||||
*/
|
||||
export interface SCBookTranslatableFields
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of an edition of a book
|
||||
*/
|
||||
bookEdition?: string;
|
||||
}
|
||||
83
src/core/things/Building.ts
Normal file
83
src/core/things/Building.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCPlaceWithoutReferences} from '../base/Place';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
export type SCBuildingType = 'building';
|
||||
|
||||
export type SCBuildingCategories =
|
||||
'cafe'
|
||||
| 'education'
|
||||
| 'library'
|
||||
| 'office'
|
||||
| 'canteen'
|
||||
| 'student canteen'
|
||||
| 'restaurant'
|
||||
| 'restroom';
|
||||
|
||||
export interface SCBuildingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Categories of a building
|
||||
*/
|
||||
categories: SCBuildingCategories[];
|
||||
|
||||
/**
|
||||
* List of floor names of the place
|
||||
*/
|
||||
floors?: string[];
|
||||
|
||||
/**
|
||||
* Translated fields of a building
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the building
|
||||
*/
|
||||
type: SCBuildingType;
|
||||
}
|
||||
|
||||
export interface SCBuilding extends SCBuildingWithoutReferences {
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCBuildingMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
'education': 'Bildung',
|
||||
'library': 'Bibliothek',
|
||||
'office': 'Büro',
|
||||
'restaurant': 'Restaurant',
|
||||
'restroom': 'Toilette',
|
||||
'student canteen': 'Mensa',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
72
src/core/things/Catalog.ts
Normal file
72
src/core/things/Catalog.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
|
||||
import {SCThingWithCategoriesSpecificValues, SCThingWithCategoriesWithoutReferences} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
|
||||
/**
|
||||
* Type of a catalog
|
||||
*/
|
||||
export type SCCatalogType = 'catalog';
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
level: number;
|
||||
|
||||
/**
|
||||
* Type of a catalog
|
||||
*/
|
||||
type: SCCatalogType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A catalog
|
||||
*/
|
||||
export interface SCCatalog extends SCCatalogWithoutReferences {
|
||||
/**
|
||||
* 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[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Catalog meta data
|
||||
*/
|
||||
export class SCCatalogMeta extends SCThingMeta {
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of catalogs
|
||||
*/
|
||||
export type SCCatalogCategories = 'university events';
|
||||
125
src/core/things/DateSeries.ts
Normal file
125
src/core/things/DateSeries.ts
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date, SCISO8601Duration} from '../types/Time';
|
||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
import {SCSportCourseWithoutReferences} from './SportCourse';
|
||||
|
||||
/**
|
||||
* Type of a date series
|
||||
*/
|
||||
export type SCDateSeriesType = 'date series';
|
||||
|
||||
/**
|
||||
* Price groups for sport courses
|
||||
*/
|
||||
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* Price for alumnis
|
||||
*/
|
||||
alumni: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date without references
|
||||
*/
|
||||
export interface SCDateSeriesWithoutReferences
|
||||
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
/**
|
||||
* Dates of the date series that are initially planned to be held
|
||||
*/
|
||||
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
|
||||
*/
|
||||
frequency: string;
|
||||
|
||||
/**
|
||||
* Translated properties
|
||||
*/
|
||||
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a date series
|
||||
*/
|
||||
type: SCDateSeriesType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date series
|
||||
*/
|
||||
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* 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: SCDateSeriesType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date series meta data
|
||||
*/
|
||||
export class SCDateSeriesMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
frequency: 'Wiederholung',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of date series'
|
||||
*/
|
||||
export interface SCDateSeriesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
frequency?: string;
|
||||
}
|
||||
71
src/core/things/Diff.ts
Normal file
71
src/core/things/Diff.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsWithoutDiff} from '../Classes';
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* Type of a diff
|
||||
*/
|
||||
export type SCDiffType = 'diff';
|
||||
|
||||
/**
|
||||
* A diff without references
|
||||
*/
|
||||
export interface SCDiffWithoutReferences extends SCThing {
|
||||
/**
|
||||
* 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: SCDiffType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A diff
|
||||
*/
|
||||
export interface SCDiff extends SCDiffWithoutReferences {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
object: SCThingsWithoutDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Diff meta data
|
||||
*/
|
||||
export class SCDiffMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
action: 'Aktion',
|
||||
changes: 'Änderungen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
},
|
||||
};
|
||||
}
|
||||
174
src/core/things/Dish.ts
Normal file
174
src/core/things/Dish.ts
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
export type SCDishType = 'dish';
|
||||
|
||||
/**
|
||||
* A dish without references
|
||||
*/
|
||||
export interface SCDishWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*/
|
||||
additives?: string[];
|
||||
|
||||
/**
|
||||
* Category of the dish
|
||||
*/
|
||||
categories: SCDishCategories[];
|
||||
|
||||
/**
|
||||
* Characteristics of the dish
|
||||
*/
|
||||
characteristics?: string[];
|
||||
|
||||
/**
|
||||
* Nutrition information (calories and nutrients with amounts)
|
||||
*/
|
||||
nutrition?: SCNutritionInformation;
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCDishTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
type: SCDishType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A dish
|
||||
*/
|
||||
export interface SCDish extends SCDishWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
|
||||
*/
|
||||
dishAddOns?: SCDishWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCDishTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
type: SCDishType;
|
||||
}
|
||||
|
||||
export interface SCDishTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
}
|
||||
|
||||
/**
|
||||
* Dish meta data
|
||||
*/
|
||||
export class SCDishMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
categories: 'Kategorien',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of categories for dishes
|
||||
*/
|
||||
export type SCDishCategories =
|
||||
'appetizer'
|
||||
| 'salad'
|
||||
| 'main dish'
|
||||
| 'dessert'
|
||||
| 'soup'
|
||||
| 'side dish';
|
||||
|
||||
/**
|
||||
* A list of categories for drinks
|
||||
*/
|
||||
export type SCDrinkCategories =
|
||||
'wine'
|
||||
| 'beer'
|
||||
| 'coffee'
|
||||
| 'tea'
|
||||
| 'milk drink'
|
||||
| 'juice'
|
||||
| 'short drink'
|
||||
| 'sparkling wine'
|
||||
| 'water'
|
||||
| 'soft drink';
|
||||
|
||||
/**
|
||||
* Type definition for SCNutritionInformation
|
||||
*
|
||||
* @see https://schema.org/NutritionInformation
|
||||
*/
|
||||
export interface SCNutritionInformation {
|
||||
/**
|
||||
* Number of calories contained (in kcal)
|
||||
*/
|
||||
calories?: number;
|
||||
|
||||
/**
|
||||
* Content of carbohydrates (in grams)
|
||||
*/
|
||||
carbohydrateContent?: number;
|
||||
|
||||
/**
|
||||
* Content of fat (in grams)
|
||||
*/
|
||||
fatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of proteins (in grams)
|
||||
*/
|
||||
proteinContent?: number;
|
||||
|
||||
/**
|
||||
* Content of salt (in grams)
|
||||
*/
|
||||
saltContent?: number;
|
||||
|
||||
/**
|
||||
* Content of saturated fat (in grams)
|
||||
*/
|
||||
saturatedFatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of sugar (in grams)
|
||||
*/
|
||||
sugarContent?: number;
|
||||
}
|
||||
78
src/core/things/Favorite.ts
Normal file
78
src/core/things/Favorite.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
||||
import {SCArticleWithoutReferences} from './Article';
|
||||
import {SCBookWithoutReferences} from './Book';
|
||||
import {SCBuildingWithoutReferences} from './Building';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from './Room';
|
||||
import {SCSportCourseWithoutReferences} from './SportCourse';
|
||||
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
export type SCFavoriteType = 'favorite';
|
||||
|
||||
/**
|
||||
* A favorite without references
|
||||
*/
|
||||
export interface SCFavoriteWithoutReferences extends SCThing {
|
||||
/**
|
||||
* When the favorite was last changed.
|
||||
*/
|
||||
changed: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* When the favorite was created.
|
||||
*/
|
||||
created: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* If it is deleted or not, defaults to false.
|
||||
*/
|
||||
deleted?: boolean;
|
||||
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
type: SCFavoriteType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A favorite
|
||||
*/
|
||||
export interface SCFavorite extends SCFavoriteWithoutReferences {
|
||||
/**
|
||||
* The contained thing.
|
||||
*/
|
||||
data:
|
||||
SCAcademicEventWithoutReferences
|
||||
| SCArticleWithoutReferences
|
||||
| SCBookWithoutReferences
|
||||
| SCBuildingWithoutReferences
|
||||
| SCPersonWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences
|
||||
| SCSportCourseWithoutReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a favorite
|
||||
*/
|
||||
export class SCFavoriteMeta extends SCThingMeta {
|
||||
}
|
||||
103
src/core/things/Floor.ts
Normal file
103
src/core/things/Floor.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from './Room';
|
||||
|
||||
/**
|
||||
* Type of a floor
|
||||
*/
|
||||
export type SCFloorType = 'floor';
|
||||
|
||||
/**
|
||||
* A floor without references
|
||||
*/
|
||||
export interface SCFloorWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
||||
*/
|
||||
floorName: string;
|
||||
|
||||
/**
|
||||
* Floor plan
|
||||
*/
|
||||
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
|
||||
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
translations?: SCTranslations<SCFloorTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a floor
|
||||
*/
|
||||
type: SCFloorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A floor
|
||||
*/
|
||||
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
translations?: SCTranslations<SCFloorTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a floor
|
||||
*/
|
||||
type: SCFloorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a floor
|
||||
*/
|
||||
export class SCFloorMeta extends SCThingMeta {
|
||||
}
|
||||
|
||||
/**
|
||||
* A feature collection
|
||||
*/
|
||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
|
||||
extends FeatureCollection<T, P> {
|
||||
/**
|
||||
* Features of the collection
|
||||
*/
|
||||
features: Array<SCFloorFeatureWithPlace<T, P>>;
|
||||
}
|
||||
|
||||
/***
|
||||
* A feature with a place
|
||||
*/
|
||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
|
||||
extends Feature<T, P> {
|
||||
/**
|
||||
* The place of the feature
|
||||
*/
|
||||
place?: SCRoomWithoutReferences | SCPointOfInterestWithoutReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a floor
|
||||
*/
|
||||
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the floor name
|
||||
*/
|
||||
floorName?: string;
|
||||
}
|
||||
98
src/core/things/Message.ts
Normal file
98
src/core/things/Message.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from '../base/CreativeWork';
|
||||
import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* Type of a message
|
||||
*/
|
||||
export type SCMessageType = 'message';
|
||||
|
||||
/**
|
||||
* A message without references
|
||||
*/
|
||||
export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* Audience of the message
|
||||
*/
|
||||
audiences: SCMessageAudience[];
|
||||
|
||||
/**
|
||||
* When the message was created
|
||||
*/
|
||||
dateCreated?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Message itself
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
translations?: SCTranslations<SCMessageTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a message
|
||||
*/
|
||||
type: SCMessageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A message
|
||||
*/
|
||||
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
translations?: SCTranslations<SCMessageTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a message
|
||||
*/
|
||||
type: SCMessageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a message
|
||||
*/
|
||||
export class SCMessageMeta extends SCThingMeta {
|
||||
}
|
||||
|
||||
/**
|
||||
* Audiences for messages
|
||||
*/
|
||||
export type SCMessageAudience =
|
||||
'students'
|
||||
| 'employees'
|
||||
| 'guests';
|
||||
|
||||
/**
|
||||
* Translatable properties of a message
|
||||
*/
|
||||
export interface SCMessageTranslatableProperties
|
||||
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Message itself
|
||||
*/
|
||||
message?: string;
|
||||
}
|
||||
47
src/core/things/Organization.ts
Normal file
47
src/core/things/Organization.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
export type SCOrganizationType = 'organization';
|
||||
|
||||
/**
|
||||
* An organization without references
|
||||
*/
|
||||
export interface SCOrganizationWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
type: SCOrganizationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* An organization
|
||||
*/
|
||||
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
type: SCOrganizationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about an organization
|
||||
*/
|
||||
export class SCOrganizationMeta extends SCThingMeta {
|
||||
}
|
||||
177
src/core/things/Person.ts
Normal file
177
src/core/things/Person.ts
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
import {SCNationality} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
import {SCBuildingWithoutReferences} from './Building';
|
||||
import {SCOrganizationWithoutReferences} from './Organization';
|
||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from './Room';
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
*/
|
||||
export type SCPersonType = 'person';
|
||||
|
||||
/**
|
||||
* A person without references
|
||||
*/
|
||||
export interface SCPersonWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Additional first names of the person.
|
||||
*/
|
||||
additionalName?: string;
|
||||
|
||||
/**
|
||||
* The birth date of the person.
|
||||
*/
|
||||
birthDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* The private email address of the person.
|
||||
*
|
||||
* @TJS-format email
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* The family name of the person.
|
||||
*/
|
||||
familyName: string;
|
||||
|
||||
/**
|
||||
* The private fax number of the person.
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* The gender of the person.
|
||||
*/
|
||||
gender?: SCPersonGender;
|
||||
|
||||
/**
|
||||
* The first name of the person.
|
||||
*/
|
||||
givenName: string;
|
||||
|
||||
/**
|
||||
* Honorific prefix of the person.
|
||||
*/
|
||||
honorificPrefix?: string;
|
||||
|
||||
/**
|
||||
* Honorific suffix of the person.
|
||||
*/
|
||||
honorificSuffix?: string;
|
||||
|
||||
/**
|
||||
* Titles of jobs that the person has.
|
||||
*/
|
||||
jobTitles?: string[];
|
||||
|
||||
/**
|
||||
* The complete name of the person combining all the parts of the name into one.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The nationality of the person.
|
||||
*/
|
||||
nationality?: SCNationality;
|
||||
|
||||
/**
|
||||
* The private telephone number of the person.
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
*/
|
||||
type: SCPersonType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A person
|
||||
*/
|
||||
export interface SCPerson extends SCPersonWithoutReferences {
|
||||
/**
|
||||
* Organization the person works for
|
||||
*/
|
||||
affiliations?: SCOrganizationWithoutReferences[];
|
||||
|
||||
/**
|
||||
* A list of homes of the person
|
||||
*/
|
||||
homeLocations?: Array<SCBuildingWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences>;
|
||||
|
||||
/**
|
||||
* Locations where the person performs her/his work
|
||||
*/
|
||||
workLocations?: SCContactPoint[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a person
|
||||
*/
|
||||
export class SCPersonMeta extends SCThingMeta {
|
||||
}
|
||||
|
||||
/**
|
||||
* A contact point
|
||||
*
|
||||
* @see http://schema.org/ContactPoint
|
||||
*/
|
||||
export interface SCContactPoint {
|
||||
/**
|
||||
* Exact place where work is performed
|
||||
*/
|
||||
areaServed?: SCRoomWithoutReferences;
|
||||
|
||||
/**
|
||||
* E-mail at the work location
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* Fax number at the work location
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* Times available for contacting at the work location
|
||||
*/
|
||||
hoursAvailable?: string;
|
||||
|
||||
/**
|
||||
* Contact number at the work location
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* URL at the work location
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gender of a person
|
||||
*/
|
||||
export type SCPersonGender =
|
||||
'male'
|
||||
| 'female'
|
||||
| 'inter'
|
||||
| 'undefined';
|
||||
77
src/core/things/PointOfInterest.ts
Normal file
77
src/core/things/PointOfInterest.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCPlaceWithoutReferences} from '../base/Place';
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Type of a point of interest
|
||||
*/
|
||||
export type SCPointOfInterestType = 'point of interest';
|
||||
|
||||
/**
|
||||
* 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: SCPointOfInterestType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A point of interest
|
||||
*/
|
||||
export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a point of interest
|
||||
*/
|
||||
type: SCPointOfInterestType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of a point of interest
|
||||
*/
|
||||
export type SCPointOfInterestCategories =
|
||||
'computer'
|
||||
| 'validator'
|
||||
| 'card charger'
|
||||
| 'printer'
|
||||
| 'disabled access';
|
||||
|
||||
/**
|
||||
* Meta data of a point of interest
|
||||
*/
|
||||
export class SCPointOfInterestMeta extends SCThingMeta {
|
||||
}
|
||||
125
src/core/things/Room.ts
Normal file
125
src/core/things/Room.ts
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCPlaceWithoutReferences} from '../base/Place';
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {SCThingThatAcceptsPaymentsWithoutReferences} from '../base/ThingThatAcceptsPayments';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Type of a room
|
||||
*/
|
||||
export type SCRoomType = 'room';
|
||||
|
||||
/**
|
||||
* Categories of a room
|
||||
*/
|
||||
export type SCRoomCategories =
|
||||
'cafe'
|
||||
| 'education'
|
||||
| 'learn'
|
||||
| 'library'
|
||||
| 'office'
|
||||
| 'restaurant'
|
||||
| 'canteen'
|
||||
| 'student canteen'
|
||||
| 'restroom'
|
||||
| 'lounge'
|
||||
| '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.
|
||||
*/
|
||||
floor?: string;
|
||||
|
||||
/**
|
||||
* The inventory of the place/room as a list of items and their quantity.
|
||||
*/
|
||||
inventory?: Array<{ key: string, value: number }>;
|
||||
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the room
|
||||
*/
|
||||
type: SCRoomType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A room
|
||||
*/
|
||||
export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the room
|
||||
*/
|
||||
type: SCRoomType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Category specific values of a room
|
||||
*/
|
||||
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific opening hours of the room
|
||||
*/
|
||||
openingHours?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCRoomMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
'education': 'Bildung',
|
||||
'learn': 'Lernen',
|
||||
'library': 'Bibliothek',
|
||||
'lounge': 'Lounge',
|
||||
'office': 'Büro',
|
||||
'restaurant': 'Restaurant',
|
||||
'restroom': 'Toilette',
|
||||
'student canteen': 'Mensa',
|
||||
'student union': 'Studentenvereinigung',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
60
src/core/things/Semester.ts
Normal file
60
src/core/things/Semester.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
|
||||
/**
|
||||
* Type of a semester
|
||||
*/
|
||||
export type SCSemesterType = 'semester';
|
||||
|
||||
/**
|
||||
* A semester without references
|
||||
*/
|
||||
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
|
||||
/**
|
||||
* The short name of the semester, using the given pattern.
|
||||
*
|
||||
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
/**
|
||||
* Type of the semester
|
||||
*/
|
||||
type: SCSemesterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A semester
|
||||
*/
|
||||
export interface SCSemester extends SCSemesterWithoutReferences {
|
||||
}
|
||||
|
||||
/**
|
||||
* Semester meta data
|
||||
*/
|
||||
export class SCSemesterMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
acronym: 'Abkürzung',
|
||||
endDate: 'Ende',
|
||||
eventsEndDate: 'Vorlesungsschluss',
|
||||
eventsStartDate: 'Vorlesungsbeginn',
|
||||
startDate: 'Beginn',
|
||||
},
|
||||
};
|
||||
}
|
||||
126
src/core/things/Setting.ts
Normal file
126
src/core/things/Setting.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import { SCTranslations } from '../types/i18n';
|
||||
|
||||
export type SCSettingType = 'setting';
|
||||
export type SCSettingCategories = string;
|
||||
|
||||
/**
|
||||
* A setting without references
|
||||
*/
|
||||
export interface SCSettingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
|
||||
/**
|
||||
* The type of input/value this setting is carrying
|
||||
*/
|
||||
input: SCSettingInputType;
|
||||
/**
|
||||
* The order number this setting should show up in its category list
|
||||
*/
|
||||
order: number;
|
||||
/**
|
||||
* Translated fields of a setting
|
||||
*/
|
||||
translations?: SCTranslations<SCSettingValueTranslatableProperties>;
|
||||
/**
|
||||
* The type of this model
|
||||
*/
|
||||
type: SCSettingType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The types of input/value a setting object can carry
|
||||
*/
|
||||
export type SCSettingInputType = SCSettingSingleChoice
|
||||
| SCSettingMultipleChoice
|
||||
| SCSettingNumber
|
||||
| SCSettingText
|
||||
| SCSettingPassword;
|
||||
|
||||
/**
|
||||
* A setting with references
|
||||
*/
|
||||
export interface SCSetting extends SCSettingWithoutReferences {
|
||||
}
|
||||
|
||||
/**
|
||||
* Input type with single choice as value
|
||||
*/
|
||||
export interface SCSettingSingleChoice {
|
||||
defaultValue: SCSettingValue;
|
||||
inputType: 'singleChoice';
|
||||
value?: SCSettingValue;
|
||||
values: SCSettingValue[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Input type with multiple choice as value
|
||||
*/
|
||||
export interface SCSettingMultipleChoice {
|
||||
defaultValue: SCSettingValue[];
|
||||
inputType: 'multipleChoice';
|
||||
value?: SCSettingValue[];
|
||||
values: SCSettingValue[];
|
||||
}
|
||||
|
||||
export type SCSettingValue = string | number | boolean;
|
||||
|
||||
/**
|
||||
* Input type with number as value
|
||||
*/
|
||||
export interface SCSettingNumber {
|
||||
defaultValue: number;
|
||||
inputType: 'number';
|
||||
value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Input type with text as value
|
||||
*/
|
||||
export interface SCSettingText {
|
||||
defaultValue: string;
|
||||
inputType: 'text';
|
||||
value?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Input type with secret text (eq. password) as value
|
||||
*/
|
||||
export interface SCSettingPassword {
|
||||
defaultValue: string;
|
||||
inputType: 'password';
|
||||
value?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a setting
|
||||
*/
|
||||
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a setting
|
||||
*/
|
||||
export class SCSettingMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
};
|
||||
}
|
||||
53
src/core/things/SportCourse.ts
Normal file
53
src/core/things/SportCourse.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCEvent, SCEventWithoutReferences} from '../base/Event';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
export type SCSportCourseType = 'sport course';
|
||||
|
||||
/**
|
||||
* A sport course without references
|
||||
*/
|
||||
export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
type: SCSportCourseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A sport course
|
||||
*/
|
||||
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
type: SCSportCourseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sport course meta data
|
||||
*/
|
||||
export class SCSportCourseMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
type: 'Sportkurs',
|
||||
},
|
||||
};
|
||||
}
|
||||
69
src/core/things/Ticket.ts
Normal file
69
src/core/things/Ticket.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
import {SCISO8601Duration} from '../types/Time';
|
||||
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
export type SCTicketType = 'ticket';
|
||||
|
||||
/**
|
||||
* A ticket without references
|
||||
*/
|
||||
export interface SCTicketWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Approximate wait time
|
||||
*/
|
||||
approxWaitingTime: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Waiting number of the ticket
|
||||
*/
|
||||
currentTicketNumber: string;
|
||||
|
||||
/**
|
||||
* Service type of the ticket
|
||||
*/
|
||||
serviceType: any;
|
||||
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
type: SCTicketType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A ticket
|
||||
*/
|
||||
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
type: SCTicketType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a ticket
|
||||
*/
|
||||
export class SCTicketMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
type: 'Ticket',
|
||||
},
|
||||
};
|
||||
}
|
||||
139
src/core/things/Tour.ts
Normal file
139
src/core/things/Tour.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
|
||||
/**
|
||||
* Type of a tour
|
||||
*/
|
||||
export type SCTourType = 'tour';
|
||||
|
||||
/**
|
||||
* A tour without references
|
||||
*/
|
||||
export interface SCTourWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Init script for the tour
|
||||
*/
|
||||
init?: string;
|
||||
|
||||
/**
|
||||
* Steps of a tour
|
||||
*/
|
||||
steps: SCTourStep[];
|
||||
|
||||
/**
|
||||
* Type of a tour
|
||||
*/
|
||||
type: SCTourType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tour
|
||||
*/
|
||||
export interface SCTour extends SCTourWithoutReferences {
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a tour
|
||||
*/
|
||||
export class SCTourMeta extends SCThingMeta {
|
||||
}
|
||||
|
||||
/**
|
||||
* A step in a tour
|
||||
*/
|
||||
export type SCTourStep =
|
||||
SCTourStepMenu
|
||||
| SCTourStepLocation
|
||||
| SCTourStepTooltip;
|
||||
|
||||
/**
|
||||
* A location of a tour step
|
||||
*/
|
||||
export interface SCTourStepLocation {
|
||||
/**
|
||||
* Location to go to
|
||||
*/
|
||||
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
|
||||
*/
|
||||
element: string | string[];
|
||||
|
||||
/**
|
||||
* Position of the tooltip
|
||||
*/
|
||||
position?: 'bottom' | 'left' | 'right' | 'top';
|
||||
|
||||
/**
|
||||
* How the step shall be resolved
|
||||
*/
|
||||
resolved?: { element: string } | { event: string } | { location: { is: string } | { match: string } } | {
|
||||
menu:
|
||||
'open-left'
|
||||
| 'open-right';
|
||||
};
|
||||
|
||||
/**
|
||||
* Text that the tooltip shall contain
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* How often it shall be retried
|
||||
*/
|
||||
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';
|
||||
}
|
||||
155
src/core/things/Video.ts
Normal file
155
src/core/things/Video.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCCreativeWork, SCCreativeWorkWithoutReferences} from '../base/CreativeWork';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCLanguage} from '../types/i18n';
|
||||
import {SCISO8601Duration} from '../types/Time';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
|
||||
/**
|
||||
* Type of a video
|
||||
*/
|
||||
export type SCVideoType = 'video';
|
||||
|
||||
/**
|
||||
* A video without references
|
||||
*/
|
||||
export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* The Duration of the Video
|
||||
*/
|
||||
duration?: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Downloadable/Streamable Files of the Video
|
||||
*/
|
||||
sources?: SCVideoSource[];
|
||||
|
||||
/**
|
||||
* URLs to a thumbnails for the Video
|
||||
*/
|
||||
thumbnails?: string[];
|
||||
|
||||
/**
|
||||
* Track Files for the Video
|
||||
*/
|
||||
tracks?: SCVideoTrack;
|
||||
|
||||
/**
|
||||
* A Transcript of the Video
|
||||
*/
|
||||
transcript?: string;
|
||||
|
||||
/**
|
||||
* Type of an Video
|
||||
*/
|
||||
type: SCVideoType;
|
||||
}
|
||||
|
||||
export interface SCVideoSource {
|
||||
/**
|
||||
* Pixel Height of the Video
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
/**
|
||||
* MIME-Type of the source File
|
||||
*/
|
||||
mimeType: SCVideoMimeType;
|
||||
|
||||
/**
|
||||
* Size of the Video File in bytes
|
||||
*/
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* URL to the Video File
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Pixel Width of the Video
|
||||
*/
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface SCVideoTrack {
|
||||
/**
|
||||
* Language of the Subtitle
|
||||
*/
|
||||
language: SCLanguage;
|
||||
|
||||
/**
|
||||
* Content Type of the Track File
|
||||
*/
|
||||
type: SCVideoTrackTypes;
|
||||
|
||||
/**
|
||||
* URL to the Track File
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A video
|
||||
*/
|
||||
export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
/**
|
||||
* Persons acting in the Video
|
||||
*/
|
||||
actors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Type of a video
|
||||
*/
|
||||
type: SCVideoType;
|
||||
}
|
||||
|
||||
export class SCVideoMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
actors: 'Darsteller',
|
||||
duration: 'Länge',
|
||||
height: 'Höhe',
|
||||
language: 'Sprache',
|
||||
size: 'Größe',
|
||||
sources: 'Quellen',
|
||||
transcript: 'Abschrift',
|
||||
type: 'Video',
|
||||
width: 'Breite',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 =
|
||||
'captions'
|
||||
| 'chapters'
|
||||
| 'description'
|
||||
| 'metadata'
|
||||
| 'subtitles';
|
||||
69
src/core/types/Guards.ts
Normal file
69
src/core/types/Guards.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingWithTranslations} from '../base/ThingWithTranslations';
|
||||
import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse';
|
||||
import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse';
|
||||
import {SCSearchResponse} from '../protocol/routes/search/SearchResponse';
|
||||
import {SCThing} from '../Thing';
|
||||
|
||||
/**
|
||||
* Type guard to check if translations exist
|
||||
*
|
||||
* @param {SCThing} thing Thing to check
|
||||
*/
|
||||
export function isThingWithTranslations(thing: SCThing): thing is SCThingWithTranslations {
|
||||
return typeof thing.translations !== 'undefined';
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a bulk response
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
*/
|
||||
export function isBulkResponse(something: any): something is SCBulkResponse {
|
||||
return typeof something.expiration === 'string'
|
||||
&& typeof something.source === 'string'
|
||||
&& typeof something.state === 'string'
|
||||
&& typeof something.type === 'string'
|
||||
&& typeof something.uid === 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a search response
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
*/
|
||||
export function isSearchResponse(something: any): something is SCSearchResponse {
|
||||
return Array.isArray(something.data)
|
||||
&& Array.isArray(something.facets)
|
||||
&& typeof something.pagination !== 'undefined'
|
||||
&& typeof something.pagination.count === 'number'
|
||||
&& typeof something.pagination.offset === 'number'
|
||||
&& typeof something.pagination.total === 'number'
|
||||
&& typeof something.stats !== 'undefined'
|
||||
&& typeof something.stats.time === 'number';
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a multi search response
|
||||
*
|
||||
*
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isMultiSearchResponse(something: any): something is SCMultiSearchResponse {
|
||||
return Object.keys(something).reduce((previousOnesAreSearchResponses, key) => {
|
||||
return previousOnesAreSearchResponses && isSearchResponse(something[key]);
|
||||
}, true);
|
||||
}
|
||||
48
src/core/types/PostalAddress.ts
Normal file
48
src/core/types/PostalAddress.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* A postal address
|
||||
*/
|
||||
export interface SCPostalAddress {
|
||||
/**
|
||||
* Country of the address
|
||||
*/
|
||||
addressCountry: string;
|
||||
|
||||
/**
|
||||
* City of the address
|
||||
*/
|
||||
addressLocality: string;
|
||||
|
||||
/**
|
||||
* State of the address
|
||||
*/
|
||||
addressRegion?: string;
|
||||
|
||||
/**
|
||||
* Zip code of the address
|
||||
*/
|
||||
postalCode: string;
|
||||
|
||||
/**
|
||||
* Optional post box number
|
||||
*/
|
||||
postOfficeBoxNumber?: string;
|
||||
|
||||
/**
|
||||
* Street of the address - with house number!
|
||||
*/
|
||||
streetAddress: string;
|
||||
}
|
||||
40
src/core/types/Time.ts
Normal file
40
src/core/types/Time.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* tslint:disable:max-line-length */
|
||||
/**
|
||||
* An ISO8601 date
|
||||
*
|
||||
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
|
||||
* @see https://gist.github.com/philipashlock/8830168
|
||||
*/
|
||||
export type SCISO8601Date = string;
|
||||
/* tslint:enable */
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
/**
|
||||
* An ISO8601 duration
|
||||
*
|
||||
* @pattern ^(R\d*\/)?P(?:\d+(?:\.\d+)?Y)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?W)?(?:\d+(?:\.\d+)?D)?(?:T(?:\d+(?:\.\d+)?H)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?S)?)?$
|
||||
* @see https://gist.github.com/philipashlock/8830168
|
||||
*/
|
||||
export type SCISO8601Duration = string;
|
||||
/* tslint:enable */
|
||||
|
||||
/**
|
||||
* An ISO8601 time
|
||||
*
|
||||
* @pattern \d{2}:\d{2}(:\d{2})?
|
||||
*/
|
||||
export type SCISO8601Time = string;
|
||||
21
src/core/types/UUID.ts
Normal file
21
src/core/types/UUID.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Universally unique identifier of the thing
|
||||
*
|
||||
* @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
|
||||
* @see http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid
|
||||
*/
|
||||
export type SCUuid = string;
|
||||
132
src/core/types/config/App.ts
Normal file
132
src/core/types/config/App.ts
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Polygon} from 'geojson';
|
||||
import {SCSetting} from '../../things/Setting';
|
||||
import {SCTranslations} from '../i18n';
|
||||
|
||||
/**
|
||||
* An app configuration menu item
|
||||
*/
|
||||
export interface SCAppConfigurationMenuItem {
|
||||
/**
|
||||
* Icon for the menu item
|
||||
*/
|
||||
icon: string;
|
||||
|
||||
/**
|
||||
* Route inside the app
|
||||
*/
|
||||
route: string;
|
||||
|
||||
/**
|
||||
* Title of the route
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Translations for the menu item
|
||||
*/
|
||||
translations: SCTranslations<{ title: string }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An app configuration menu category
|
||||
*/
|
||||
export interface SCAppConfigurationMenuCategory {
|
||||
/**
|
||||
* Icon for the menu category
|
||||
*/
|
||||
icon: string;
|
||||
|
||||
/**
|
||||
* ID of the menu category
|
||||
*/
|
||||
id:
|
||||
'main'
|
||||
| 'meta'
|
||||
| 'personal'
|
||||
| 'external';
|
||||
|
||||
/**
|
||||
* A list of items that belong to the category
|
||||
*/
|
||||
items: SCAppConfigurationMenuItem[];
|
||||
|
||||
/**
|
||||
* Name of the category
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Translations for the menu category
|
||||
*/
|
||||
translations: SCTranslations<{ name: string }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An app configuration
|
||||
*/
|
||||
export interface SCAppConfiguration {
|
||||
/**
|
||||
* Polygon that encapsulates the main campus
|
||||
*/
|
||||
campusPolygon: Polygon;
|
||||
|
||||
/**
|
||||
* A list of features to en- or disable
|
||||
*/
|
||||
features: {
|
||||
widgets: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* A URL where images are available
|
||||
*/
|
||||
imageUrl?: string;
|
||||
|
||||
/**
|
||||
* A list of available menu categories in the app
|
||||
*/
|
||||
menus: SCAppConfigurationMenuCategory[];
|
||||
|
||||
/**
|
||||
* Name for the app
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* URL to a file containing the privacy policy
|
||||
*/
|
||||
privacyPolicyUrl: string;
|
||||
|
||||
/**
|
||||
* A list of available settings in the app
|
||||
*/
|
||||
settings: SCSetting[];
|
||||
|
||||
/**
|
||||
* Map of store URLs
|
||||
*/
|
||||
storeUrl?: {
|
||||
android?: string;
|
||||
ios?: string;
|
||||
uwp?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* URL where a web instance of the app is available
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
169
src/core/types/config/Backend.ts
Normal file
169
src/core/types/config/Backend.ts
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingTypes} from '../../Thing';
|
||||
import {SCSearchSortType} from '../sorts/Abstract';
|
||||
import {SCUuid} from '../UUID';
|
||||
import {SCMonitoringConfiguration} from './Monitoring';
|
||||
|
||||
/**
|
||||
* A backend configuration
|
||||
*/
|
||||
export interface SCBackendConfiguration {
|
||||
/**
|
||||
* A list of hidden SC types
|
||||
*
|
||||
* If a type is hidden it won't show in any result unless the type is filtered for
|
||||
*/
|
||||
hiddenTypes: SCThingTypes[];
|
||||
|
||||
/**
|
||||
* Name of university
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Namespace of the university for UID generation
|
||||
*/
|
||||
namespace: SCUuid;
|
||||
|
||||
/**
|
||||
* Version string of the installed StAppsCore
|
||||
*/
|
||||
SCVersion: string;
|
||||
|
||||
/**
|
||||
* A list of sortable fields of each type
|
||||
*/
|
||||
sortableFields: SCBackendConfigurationSortableField[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Description which sort types are supported on which fields of which types
|
||||
*/
|
||||
export interface SCBackendConfigurationSortableField {
|
||||
/**
|
||||
* Field name which the sorts should be available on
|
||||
*/
|
||||
fieldName: string;
|
||||
|
||||
/**
|
||||
* A list of SC types on which this field exists
|
||||
*
|
||||
* If no type is given it is assumed it exists on every type
|
||||
*/
|
||||
onlyOnTypes?: SCThingTypes[];
|
||||
|
||||
/**
|
||||
* A list of supported sorts on this field
|
||||
*/
|
||||
sortTypes: SCSearchSortType[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Values of a field that should be boosted by the given factors
|
||||
*/
|
||||
export interface SCBackendConfigurationSearchBoostingValues {
|
||||
|
||||
/**
|
||||
* Value of the field that should be boosted by the given number
|
||||
*
|
||||
* For example `"SS 2019": 2`
|
||||
*/
|
||||
[valueOfField: string]: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A boosting configuration for one SCType
|
||||
*/
|
||||
export interface SCBackendConfigurationSearchBoosting {
|
||||
|
||||
/**
|
||||
* The factor of which the scores matching this type should be multiplied by
|
||||
*/
|
||||
factor: number;
|
||||
|
||||
/**
|
||||
* Fields of this type that should be boosted if they match a given value
|
||||
*/
|
||||
fields?: {
|
||||
/**
|
||||
* Field name which has to match a given value
|
||||
*
|
||||
* For nest fields you can use the `.` as a separator. For example `academicTerms.acronym`
|
||||
*/
|
||||
[fieldName: string]: SCBackendConfigurationSearchBoostingValues;
|
||||
};
|
||||
|
||||
/**
|
||||
* Type of things the factor should be applied to
|
||||
*/
|
||||
type: SCThingTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes which field on which type should be aggregated
|
||||
*/
|
||||
export interface SCBackendAggregationConfiguration {
|
||||
/**
|
||||
* Field name of field which values should be aggregated
|
||||
*/
|
||||
fieldName: string;
|
||||
|
||||
/**
|
||||
* A list of SC types of which the field is on
|
||||
*
|
||||
* If the type is not given is is assumed the field exists on every type
|
||||
*/
|
||||
onlyOnTypes?: SCThingTypes[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The internal backend configuration that is hidden from the app
|
||||
*/
|
||||
export interface SCBackendInternalConfiguration {
|
||||
/**
|
||||
* A list of configurations for aggregations
|
||||
*/
|
||||
aggregations: SCBackendAggregationConfiguration[];
|
||||
|
||||
/**
|
||||
* A list of configurations for search boosting
|
||||
*
|
||||
* The resulting scores of matching objects can be boosted (multiplied by a number) to change the order in the
|
||||
* set of results
|
||||
*/
|
||||
boostings: SCBackendConfigurationSearchBoosting[];
|
||||
|
||||
/**
|
||||
* Configuration of the database
|
||||
*/
|
||||
database?: {
|
||||
/**
|
||||
* A name of the database to select which one is used by the backend
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Allow additional configuration for the database
|
||||
*/
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
/**
|
||||
* Configuration for monitoring
|
||||
*/
|
||||
monitoring?: SCMonitoringConfiguration;
|
||||
}
|
||||
164
src/core/types/config/Monitoring.ts
Normal file
164
src/core/types/config/Monitoring.ts
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* An abstract action that can be executed by a failed watcher
|
||||
*
|
||||
* This is extended by actual actions.
|
||||
*/
|
||||
export interface SCMonitoringAction {
|
||||
/**
|
||||
* Message that is used by the action
|
||||
*
|
||||
* Mustache syntax is supported to evaluate the query.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* The type of the action
|
||||
*/
|
||||
type: 'log' | 'mail';
|
||||
}
|
||||
|
||||
/**
|
||||
* A log action which can be executed from a failed watcher
|
||||
*/
|
||||
export interface SCMonitoringLogAction extends SCMonitoringAction {
|
||||
/**
|
||||
* A prefix for the logged messages
|
||||
*/
|
||||
prefix: string;
|
||||
|
||||
/**
|
||||
* The type of the action
|
||||
*/
|
||||
type: 'log';
|
||||
}
|
||||
|
||||
/**
|
||||
* A mail task which can be executed from a failed watcher
|
||||
*/
|
||||
export interface SCMonitoringMailAction extends SCMonitoringAction {
|
||||
/**
|
||||
* A list of addresses to send the mails to
|
||||
*/
|
||||
recipients: string[];
|
||||
|
||||
/**
|
||||
* A subject line for all mails
|
||||
*/
|
||||
subject: string;
|
||||
|
||||
/**
|
||||
* The type of the action
|
||||
*/
|
||||
type: 'mail';
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of events to describe the execution interval of monitoring triggers
|
||||
*/
|
||||
export type SCMonitoringExecutionCalendarEvents = 'hourly' | 'daily' | 'weekly' | 'monthly';
|
||||
|
||||
/**
|
||||
* A trigger which determines the execution time of a watcher
|
||||
*/
|
||||
export interface SCMonitoringTrigger {
|
||||
/**
|
||||
* A cron like syntax to describe when this trigger should be executed
|
||||
*/
|
||||
executionTime: SCMonitoringExecutionCalendarEvents | string;
|
||||
|
||||
/**
|
||||
* A name of the trigger that explains when it executes
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A condition which is met, when the result length is higher than the minimum length
|
||||
*/
|
||||
export interface SCMonitoringMinimumLengthCondition {
|
||||
/**
|
||||
* The minimum length
|
||||
*/
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Type of the condition
|
||||
*/
|
||||
type: 'MinimumLength';
|
||||
}
|
||||
|
||||
/**
|
||||
* A condition which is met, when the result length is smaller than the maximum length
|
||||
*/
|
||||
export interface SCMonitoringMaximumLengthCondition {
|
||||
/**
|
||||
* The maximum length
|
||||
*/
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Type of the condition
|
||||
*/
|
||||
type: 'MaximumLength';
|
||||
}
|
||||
|
||||
/**
|
||||
* A watcher that evaluates a query, when triggered
|
||||
*/
|
||||
export interface SCMonitoringWatcher {
|
||||
/**
|
||||
* A list of actions that are executed, when the watcher fails
|
||||
*/
|
||||
actions: Array<SCMonitoringLogAction | SCMonitoringMailAction>;
|
||||
|
||||
/**
|
||||
* A list of conditions that have to match the result of the query
|
||||
*
|
||||
* If not all conditions are met, the watcher will fail and all actions are executed
|
||||
*/
|
||||
conditions: Array<SCMonitoringMaximumLengthCondition | SCMonitoringMinimumLengthCondition>;
|
||||
|
||||
/**
|
||||
* A name for the watcher
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Query to execute against the database
|
||||
*/
|
||||
query: any;
|
||||
|
||||
/**
|
||||
* A list of triggers
|
||||
*/
|
||||
triggers: SCMonitoringTrigger[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A complete monitoring configuration for the backend
|
||||
*/
|
||||
export interface SCMonitoringConfiguration {
|
||||
/**
|
||||
* A list of actions that are executed, when a watcher fails
|
||||
*/
|
||||
actions: Array<SCMonitoringMailAction | SCMonitoringLogAction>;
|
||||
|
||||
/**
|
||||
* A list of watches
|
||||
*/
|
||||
watchers: SCMonitoringWatcher[];
|
||||
}
|
||||
61
src/core/types/filters/Abstract.ts
Normal file
61
src/core/types/filters/Abstract.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* All available filter types
|
||||
*/
|
||||
import {SCSearchAvailabilityFilter} from './Availability';
|
||||
import {SCSearchBooleanFilter} from './Boolean';
|
||||
import {SCSearchDistanceFilter} from './Distance';
|
||||
import {SCSearchValueFilter} from './Value';
|
||||
|
||||
/**
|
||||
* Filter instruction types
|
||||
*/
|
||||
export type SCSearchFilterType =
|
||||
'availability'
|
||||
| 'boolean'
|
||||
| 'distance'
|
||||
| 'value';
|
||||
|
||||
/**
|
||||
* Structure of a filter instruction
|
||||
*/
|
||||
export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArguments> {
|
||||
/**
|
||||
* Arguments of filter
|
||||
*/
|
||||
arguments: T;
|
||||
|
||||
/**
|
||||
* Type of filter
|
||||
*/
|
||||
type: SCSearchFilterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for the filter instruction
|
||||
*/
|
||||
export interface SCSearchAbstractFilterArguments {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Available filter instructions
|
||||
*/
|
||||
export type SCSearchFilter =
|
||||
SCSearchAvailabilityFilter
|
||||
| SCSearchBooleanFilter
|
||||
| SCSearchDistanceFilter
|
||||
| SCSearchValueFilter;
|
||||
46
src/core/types/filters/Availability.ts
Normal file
46
src/core/types/filters/Availability.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsField} from '../../Classes';
|
||||
import {SCISO8601Date} from '../Time';
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
||||
|
||||
/**
|
||||
* An availability filter
|
||||
*
|
||||
* Filter for documents where it cannot be safely determined that they are not available
|
||||
*/
|
||||
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
|
||||
type: 'availability';
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for filter instruction by availability
|
||||
*/
|
||||
export interface SCAvailabilityFilterArguments extends SCSearchAbstractFilterArguments {
|
||||
/**
|
||||
* Field which marks the start of the availability
|
||||
*/
|
||||
fromField: SCThingsField;
|
||||
|
||||
/**
|
||||
* Time to check. Defaults to 'now'
|
||||
*/
|
||||
time?: SCISO8601Date | 'now';
|
||||
|
||||
/**
|
||||
* Field which marks the end of the availability
|
||||
*/
|
||||
toField: SCThingsField;
|
||||
}
|
||||
39
src/core/types/filters/Boolean.ts
Normal file
39
src/core/types/filters/Boolean.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from './Abstract';
|
||||
|
||||
/**
|
||||
* A boolean filter
|
||||
*
|
||||
* This filter can be used to combine multiple filters with boolean operations.
|
||||
*/
|
||||
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
|
||||
type: 'boolean';
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional arguments for boolean filters
|
||||
*/
|
||||
export interface SCBooleanFilterArguments extends SCSearchAbstractFilterArguments {
|
||||
/**
|
||||
* A list of filter to apply the boolean operation to
|
||||
*/
|
||||
filters: SCSearchFilter[];
|
||||
|
||||
/**
|
||||
* Boolean operation to apply to the filters
|
||||
*/
|
||||
operation: 'and' | 'not' | 'or';
|
||||
}
|
||||
46
src/core/types/filters/Distance.ts
Normal file
46
src/core/types/filters/Distance.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Position} from 'geojson';
|
||||
import {SCThingsField} from '../../Classes';
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
||||
|
||||
/**
|
||||
* A distance filter
|
||||
*
|
||||
* Filter for documents that are in the given distance of the given location
|
||||
*/
|
||||
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
|
||||
type: 'distance';
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional arguments for distance filters
|
||||
*/
|
||||
export interface SCDistanceFilterArguments extends SCSearchAbstractFilterArguments {
|
||||
/**
|
||||
* Distance in meters to filter from given location
|
||||
*/
|
||||
distance: number;
|
||||
|
||||
/**
|
||||
* Field which contains the location you want to filter
|
||||
*/
|
||||
field: SCThingsField;
|
||||
|
||||
/**
|
||||
* Position to calculate the distance to
|
||||
*/
|
||||
position: Position;
|
||||
}
|
||||
35
src/core/types/filters/Value.ts
Normal file
35
src/core/types/filters/Value.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsField} from '../../Classes';
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
||||
|
||||
/**
|
||||
* Filters for documents that match the value on the given field
|
||||
*/
|
||||
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
|
||||
type: 'value';
|
||||
}
|
||||
|
||||
export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments {
|
||||
/**
|
||||
* Field to filter for a value.
|
||||
*/
|
||||
field: SCThingsField;
|
||||
|
||||
/**
|
||||
* Value to filter. Value has to match the field exactly.
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
683
src/core/types/i18n.ts
Normal file
683
src/core/types/i18n.ts
Normal file
@@ -0,0 +1,683 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* An Language
|
||||
*/
|
||||
export interface SCLanguage {
|
||||
/**
|
||||
* The Alpha-2 Code of the Language
|
||||
*/
|
||||
code: SCLanguageCode;
|
||||
|
||||
/**
|
||||
* The Fulltext name of the Language
|
||||
*/
|
||||
name: SCLanguageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of possible languages
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/ISO_639-1
|
||||
*/
|
||||
export type SCLanguageName =
|
||||
'afar'
|
||||
| 'abkhazian'
|
||||
| 'avestan'
|
||||
| 'afrikaans'
|
||||
| 'akan'
|
||||
| 'amharic'
|
||||
| 'aragonese'
|
||||
| 'arabic'
|
||||
| 'assamese'
|
||||
| 'avaric'
|
||||
| 'aymara'
|
||||
| 'azerbaijani'
|
||||
| 'bashkir'
|
||||
| 'belarusian'
|
||||
| 'bulgarian'
|
||||
| 'bihari languages'
|
||||
| 'bislama'
|
||||
| 'bambara'
|
||||
| 'bengali'
|
||||
| 'tibetan'
|
||||
| 'breton'
|
||||
| 'bosnian'
|
||||
| 'catalan; valencian'
|
||||
| 'chechen'
|
||||
| 'chamorro'
|
||||
| 'corsican'
|
||||
| 'cree'
|
||||
| 'czech'
|
||||
| 'church slavic; old slavonic; church slavonic; old bulgarian; old church slavonic'
|
||||
| 'chuvash'
|
||||
| 'welsh'
|
||||
| 'danish'
|
||||
| 'german'
|
||||
| 'divehi; dhivehi; maldivian'
|
||||
| 'dzongkha'
|
||||
| 'ewe'
|
||||
| 'greek, modern (1453-)'
|
||||
| 'english'
|
||||
| 'esperanto'
|
||||
| 'spanish; castilian'
|
||||
| 'estonian'
|
||||
| 'basque'
|
||||
| 'persian'
|
||||
| 'fulah'
|
||||
| 'finnish'
|
||||
| 'fijian'
|
||||
| 'filipino'
|
||||
| 'faroese'
|
||||
| 'french'
|
||||
| 'western frisian'
|
||||
| 'irish'
|
||||
| 'gaelic; scottish gaelic'
|
||||
| 'galician'
|
||||
| 'guarani'
|
||||
| 'gujarati'
|
||||
| 'manx'
|
||||
| 'hausa'
|
||||
| 'hebrew'
|
||||
| 'hindi'
|
||||
| 'hiri motu'
|
||||
| 'croatian'
|
||||
| 'haitian; haitian creole'
|
||||
| 'hungarian'
|
||||
| 'armenian'
|
||||
| 'herero'
|
||||
| 'interlingua (international auxiliary language association)'
|
||||
| 'indonesian'
|
||||
| 'interlingue; occidental'
|
||||
| 'igbo'
|
||||
| 'sichuan yi; nuosu'
|
||||
| 'inupiaq'
|
||||
| 'ido'
|
||||
| 'icelandic'
|
||||
| 'italian'
|
||||
| 'inuktitut'
|
||||
| 'japanese'
|
||||
| 'javanese'
|
||||
| 'georgian'
|
||||
| 'kongo'
|
||||
| 'kikuyu; gikuyu'
|
||||
| 'kuanyama; kwanyama'
|
||||
| 'kazakh'
|
||||
| 'kalaallisut; greenlandic'
|
||||
| 'central khmer'
|
||||
| 'kannada'
|
||||
| 'korean'
|
||||
| 'kanuri'
|
||||
| 'kashmiri'
|
||||
| 'kurdish'
|
||||
| 'komi'
|
||||
| 'cornish'
|
||||
| 'kirghiz; kyrgyz'
|
||||
| 'latin'
|
||||
| 'luxembourgish; letzeburgesch'
|
||||
| 'ganda'
|
||||
| 'limburgan; limburger; limburgish'
|
||||
| 'lingala'
|
||||
| 'lao'
|
||||
| 'lithuanian'
|
||||
| 'luba-katanga'
|
||||
| 'latvian'
|
||||
| 'malagasy'
|
||||
| 'marshallese'
|
||||
| 'maori'
|
||||
| 'macedonian'
|
||||
| 'malayalam'
|
||||
| 'mongolian'
|
||||
| 'marathi'
|
||||
| 'malay'
|
||||
| 'maltese'
|
||||
| 'burmese'
|
||||
| 'nauru'
|
||||
| 'bokmål, norwegian; norwegian bokmål'
|
||||
| 'ndebele, north; north ndebele'
|
||||
| 'nepali'
|
||||
| 'ndonga'
|
||||
| 'dutch; flemish'
|
||||
| 'norwegian nynorsk; nynorsk, norwegian'
|
||||
| 'norwegian'
|
||||
| 'ndebele, south; south ndebele'
|
||||
| 'navajo; navaho'
|
||||
| 'chichewa; chewa; nyanja'
|
||||
| 'occitan (post 1500); provençal'
|
||||
| 'ojibwa'
|
||||
| 'oromo'
|
||||
| 'oriya'
|
||||
| 'ossetian; ossetic'
|
||||
| 'panjabi; punjabi'
|
||||
| 'pali'
|
||||
| 'polish'
|
||||
| 'pushto; pashto'
|
||||
| 'portuguese'
|
||||
| 'quechua'
|
||||
| 'romansh'
|
||||
| 'rundi'
|
||||
| 'romanian; moldavian; moldovan'
|
||||
| 'russian'
|
||||
| 'kinyarwanda'
|
||||
| 'sanskrit'
|
||||
| 'sardinian'
|
||||
| 'sindhi'
|
||||
| 'northern sami'
|
||||
| 'sango'
|
||||
| 'sinhala; sinhalese'
|
||||
| 'slovak'
|
||||
| 'slovenian'
|
||||
| 'samoan'
|
||||
| 'shona'
|
||||
| 'somali'
|
||||
| 'albanian'
|
||||
| 'serbian'
|
||||
| 'swati'
|
||||
| 'sotho, southern'
|
||||
| 'sundanese'
|
||||
| 'swedish'
|
||||
| 'swahili'
|
||||
| 'tamil'
|
||||
| 'telugu'
|
||||
| 'tajik'
|
||||
| 'thai'
|
||||
| 'tigrinya'
|
||||
| 'turkmen'
|
||||
| 'tagalog'
|
||||
| 'tswana'
|
||||
| 'tonga (tonga islands)'
|
||||
| 'turkish'
|
||||
| 'tsonga'
|
||||
| 'tatar'
|
||||
| 'twi'
|
||||
| 'tahitian'
|
||||
| 'uighur; uyghur'
|
||||
| 'ukrainian'
|
||||
| 'urdu'
|
||||
| 'uzbek'
|
||||
| 'venda'
|
||||
| 'vietnamese'
|
||||
| 'volapük'
|
||||
| 'walloon'
|
||||
| 'wolof'
|
||||
| 'xhosa'
|
||||
| 'yiddish'
|
||||
| 'yoruba'
|
||||
| 'zhuang; chuang'
|
||||
| 'chinese'
|
||||
| 'zulu';
|
||||
|
||||
/**
|
||||
* A List of all possible Languages as Alpha-2 Codes
|
||||
*/
|
||||
export type SCLanguageCode =
|
||||
'aa'
|
||||
| 'ab'
|
||||
| 'ae'
|
||||
| 'af'
|
||||
| 'ak'
|
||||
| 'am'
|
||||
| 'an'
|
||||
| 'ar'
|
||||
| 'as'
|
||||
| 'av'
|
||||
| 'ay'
|
||||
| 'az'
|
||||
| 'ba'
|
||||
| 'be'
|
||||
| 'bg'
|
||||
| 'bh'
|
||||
| 'bi'
|
||||
| 'bm'
|
||||
| 'bn'
|
||||
| 'bo'
|
||||
| 'br'
|
||||
| 'bs'
|
||||
| 'ca'
|
||||
| 'ce'
|
||||
| 'ch'
|
||||
| 'co'
|
||||
| 'cr'
|
||||
| 'cs'
|
||||
| 'cu'
|
||||
| 'cv'
|
||||
| 'cy'
|
||||
| 'da'
|
||||
| 'de'
|
||||
| 'dv'
|
||||
| 'dz'
|
||||
| 'ee'
|
||||
| 'el'
|
||||
| 'en'
|
||||
| 'eo'
|
||||
| 'es'
|
||||
| 'et'
|
||||
| 'eu'
|
||||
| 'fa'
|
||||
| 'ff'
|
||||
| 'fi'
|
||||
| 'fj'
|
||||
| 'fl'
|
||||
| 'fo'
|
||||
| 'fr'
|
||||
| 'fy'
|
||||
| 'ga'
|
||||
| 'gd'
|
||||
| 'gl'
|
||||
| 'gn'
|
||||
| 'gu'
|
||||
| 'gv'
|
||||
| 'ha'
|
||||
| 'he'
|
||||
| 'hi'
|
||||
| 'ho'
|
||||
| 'hr'
|
||||
| 'ht'
|
||||
| 'hu'
|
||||
| 'hy'
|
||||
| 'hz'
|
||||
| 'ia'
|
||||
| 'id'
|
||||
| 'ia'
|
||||
| 'ig'
|
||||
| 'ii'
|
||||
| 'ik'
|
||||
| 'io'
|
||||
| 'is'
|
||||
| 'it'
|
||||
| 'iu'
|
||||
| 'ja'
|
||||
| 'jv'
|
||||
| 'ka'
|
||||
| 'kg'
|
||||
| 'ki'
|
||||
| 'kj'
|
||||
| 'kk'
|
||||
| 'kl'
|
||||
| 'km'
|
||||
| 'kn'
|
||||
| 'ko'
|
||||
| 'kr'
|
||||
| 'ks'
|
||||
| 'ku'
|
||||
| 'kv'
|
||||
| 'kw'
|
||||
| 'ky'
|
||||
| 'la'
|
||||
| 'lb'
|
||||
| 'lg'
|
||||
| 'li'
|
||||
| 'ln'
|
||||
| 'lo'
|
||||
| 'lt'
|
||||
| 'lu'
|
||||
| 'lv'
|
||||
| 'mg'
|
||||
| 'mh'
|
||||
| 'mi'
|
||||
| 'mk'
|
||||
| 'ml'
|
||||
| 'mn'
|
||||
| 'mr'
|
||||
| 'ms'
|
||||
| 'mt'
|
||||
| 'my'
|
||||
| 'na'
|
||||
| 'nb'
|
||||
| 'nd'
|
||||
| 'ne'
|
||||
| 'ng'
|
||||
| 'nl'
|
||||
| 'nn'
|
||||
| 'no'
|
||||
| 'nr'
|
||||
| 'nv'
|
||||
| 'ny'
|
||||
| 'oc'
|
||||
| 'oj'
|
||||
| 'om'
|
||||
| 'or'
|
||||
| 'os'
|
||||
| 'pa'
|
||||
| 'pi'
|
||||
| 'pl'
|
||||
| 'ps'
|
||||
| 'pt'
|
||||
| 'qu'
|
||||
| 'rm'
|
||||
| 'rn'
|
||||
| 'ro'
|
||||
| 'ru'
|
||||
| 'rw'
|
||||
| 'sa'
|
||||
| 'sc'
|
||||
| 'sd'
|
||||
| 'se'
|
||||
| 'sg'
|
||||
| 'si'
|
||||
| 'sk'
|
||||
| 'sl'
|
||||
| 'sm'
|
||||
| 'sn'
|
||||
| 'so'
|
||||
| 'sq'
|
||||
| 'sr'
|
||||
| 'ss'
|
||||
| 'st'
|
||||
| 'su'
|
||||
| 'sv'
|
||||
| 'sw'
|
||||
| 'ta'
|
||||
| 'te'
|
||||
| 'tg'
|
||||
| 'th'
|
||||
| 'ti'
|
||||
| 'tk'
|
||||
| 'tl'
|
||||
| 'tn'
|
||||
| 'to'
|
||||
| 'tr'
|
||||
| 'ts'
|
||||
| 'tt'
|
||||
| 'tw'
|
||||
| 'ty'
|
||||
| 'ug'
|
||||
| 'uk'
|
||||
| 'ur'
|
||||
| 'uz'
|
||||
| 've'
|
||||
| 'vi'
|
||||
| 'vo'
|
||||
| 'wa'
|
||||
| 'wo'
|
||||
| 'xh'
|
||||
| 'yi'
|
||||
| 'yo'
|
||||
| 'za'
|
||||
| 'zh'
|
||||
| 'zu';
|
||||
|
||||
/**
|
||||
* A list of possible nationalities
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
||||
*/
|
||||
export type SCNationality =
|
||||
'Afghanistan'
|
||||
| 'Åland Islands'
|
||||
| 'Albania'
|
||||
| 'Algeria'
|
||||
| 'American Samoa'
|
||||
| 'Andorra'
|
||||
| 'Angola'
|
||||
| 'Anguilla'
|
||||
| 'Antarctica'
|
||||
| 'Antigua and Barbuda'
|
||||
| 'Argentina'
|
||||
| 'Armenia'
|
||||
| 'Aruba'
|
||||
| 'Australia'
|
||||
| 'Austria'
|
||||
| 'Azerbaijan'
|
||||
| 'Bahamas'
|
||||
| 'Bahrain'
|
||||
| 'Bangladesh'
|
||||
| 'Barbados'
|
||||
| 'Belarus'
|
||||
| 'Belgium'
|
||||
| 'Belize'
|
||||
| 'Benin'
|
||||
| 'Bermuda'
|
||||
| 'Bhutan'
|
||||
| 'Bolivia (Plurinational State of)'
|
||||
| 'Bonaire, Sint Eustatius and Saba'
|
||||
| 'Bosnia and Herzegovina'
|
||||
| 'Botswana'
|
||||
| 'Bouvet Island'
|
||||
| 'Brazil'
|
||||
| 'British Indian Ocean Territory'
|
||||
| 'Brunei Darussalam'
|
||||
| 'Bulgaria'
|
||||
| 'Burkina Faso'
|
||||
| 'Burundi'
|
||||
| 'Cambodia'
|
||||
| 'Cameroon'
|
||||
| 'Canada'
|
||||
| 'Cabo Verde'
|
||||
| 'Cayman Islands'
|
||||
| 'Central African Republic'
|
||||
| 'Chad'
|
||||
| 'Chile'
|
||||
| 'China'
|
||||
| 'Christmas Island'
|
||||
| 'Cocos (Keeling) Islands'
|
||||
| 'Colombia'
|
||||
| 'Comoros'
|
||||
| 'Congo'
|
||||
| 'Congo (Democratic Republic of the)'
|
||||
| 'Cook Islands'
|
||||
| 'Costa Rica'
|
||||
| 'Côte d\'Ivoire'
|
||||
| 'Croatia'
|
||||
| 'Cuba'
|
||||
| 'Curaçao'
|
||||
| 'Cyprus'
|
||||
| 'Czech Republic'
|
||||
| 'Denmark'
|
||||
| 'Djibouti'
|
||||
| 'Dominica'
|
||||
| 'Dominican Republic'
|
||||
| 'Ecuador'
|
||||
| 'Egypt'
|
||||
| 'El Salvador'
|
||||
| 'Equatorial Guinea'
|
||||
| 'Eritrea'
|
||||
| 'Estonia'
|
||||
| 'Ethiopia'
|
||||
| 'Falkland Islands (Malvinas)'
|
||||
| 'Faroe Islands'
|
||||
| 'Fiji'
|
||||
| 'Finland'
|
||||
| 'France'
|
||||
| 'French Guiana'
|
||||
| 'French Polynesia'
|
||||
| 'French Southern Territories'
|
||||
| 'Gabon'
|
||||
| 'Gambia'
|
||||
| 'Georgia'
|
||||
| 'Germany'
|
||||
| 'Ghana'
|
||||
| 'Gibraltar'
|
||||
| 'Greece'
|
||||
| 'Greenland'
|
||||
| 'Grenada'
|
||||
| 'Guadeloupe'
|
||||
| 'Guam'
|
||||
| 'Guatemala'
|
||||
| 'Guernsey'
|
||||
| 'Guinea'
|
||||
| 'Guinea-Bissau'
|
||||
| 'Guyana'
|
||||
| 'Haiti'
|
||||
| 'Heard Island and McDonald Islands'
|
||||
| 'Holy See'
|
||||
| 'Honduras'
|
||||
| 'Hong Kong'
|
||||
| 'Hungary'
|
||||
| 'Iceland'
|
||||
| 'India'
|
||||
| 'Indonesia'
|
||||
| 'Iran (Islamic Republic of)'
|
||||
| 'Iraq'
|
||||
| 'Ireland'
|
||||
| 'Isle of Man'
|
||||
| 'Israel'
|
||||
| 'Italy'
|
||||
| 'Jamaica'
|
||||
| 'Japan'
|
||||
| 'Jersey'
|
||||
| 'Jordan'
|
||||
| 'Kazakhstan'
|
||||
| 'Kenya'
|
||||
| 'Kiribati'
|
||||
| 'Korea (Democratic People\'s Republic of)'
|
||||
| 'Korea (Republic of)'
|
||||
| 'Kuwait'
|
||||
| 'Kyrgyzstan'
|
||||
| 'Lao People\'s Democratic Republic'
|
||||
| 'Latvia'
|
||||
| 'Lebanon'
|
||||
| 'Lesotho'
|
||||
| 'Liberia'
|
||||
| 'Libya'
|
||||
| 'Liechtenstein'
|
||||
| 'Lithuania'
|
||||
| 'Luxembourg'
|
||||
| 'Macao'
|
||||
| 'Macedonia (the former Yugoslav Republic of)'
|
||||
| 'Madagascar'
|
||||
| 'Malawi'
|
||||
| 'Malaysia'
|
||||
| 'Maldives'
|
||||
| 'Mali'
|
||||
| 'Malta'
|
||||
| 'Marshall Islands'
|
||||
| 'Martinique'
|
||||
| 'Mauritania'
|
||||
| 'Mauritius'
|
||||
| 'Mayotte'
|
||||
| 'Mexico'
|
||||
| 'Micronesia (Federated States of)'
|
||||
| 'Moldova (Republic of)'
|
||||
| 'Monaco'
|
||||
| 'Mongolia'
|
||||
| 'Montenegro'
|
||||
| 'Montserrat'
|
||||
| 'Morocco'
|
||||
| 'Mozambique'
|
||||
| 'Myanmar'
|
||||
| 'Namibia'
|
||||
| 'Nauru'
|
||||
| 'Nepal'
|
||||
| 'Netherlands'
|
||||
| 'New Caledonia'
|
||||
| 'New Zealand'
|
||||
| 'Nicaragua'
|
||||
| 'Niger'
|
||||
| 'Nigeria'
|
||||
| 'Niue'
|
||||
| 'Norfolk Island'
|
||||
| 'Northern Mariana Islands'
|
||||
| 'Norway'
|
||||
| 'Oman'
|
||||
| 'Pakistan'
|
||||
| 'Palau'
|
||||
| 'Palestine, State of'
|
||||
| 'Panama'
|
||||
| 'Papua New Guinea'
|
||||
| 'Paraguay'
|
||||
| 'Peru'
|
||||
| 'Philippines'
|
||||
| 'Pitcairn'
|
||||
| 'Poland'
|
||||
| 'Portugal'
|
||||
| 'Puerto Rico'
|
||||
| 'Qatar'
|
||||
| 'Réunion'
|
||||
| 'Romania'
|
||||
| 'Russian Federation'
|
||||
| 'Rwanda'
|
||||
| 'Saint Barthélemy'
|
||||
| 'Saint Helena, Ascension and Tristan da Cunha'
|
||||
| 'Saint Kitts and Nevis'
|
||||
| 'Saint Lucia'
|
||||
| 'Saint Martin (French part)'
|
||||
| 'Saint Pierre and Miquelon'
|
||||
| 'Saint Vincent and the Grenadines'
|
||||
| 'Samoa'
|
||||
| 'San Marino'
|
||||
| 'Sao Tome and Principe'
|
||||
| 'Saudi Arabia'
|
||||
| 'Senegal'
|
||||
| 'Serbia'
|
||||
| 'Seychelles'
|
||||
| 'Sierra Leone'
|
||||
| 'Singapore'
|
||||
| 'Sint Maarten (Dutch part)'
|
||||
| 'Slovakia'
|
||||
| 'Slovenia'
|
||||
| 'Solomon Islands'
|
||||
| 'Somalia'
|
||||
| 'South Africa'
|
||||
| 'South Georgia and the South Sandwich Islands'
|
||||
| 'South Sudan'
|
||||
| 'Spain'
|
||||
| 'Sri Lanka'
|
||||
| 'Sudan'
|
||||
| 'Suriname'
|
||||
| 'Svalbard and Jan Mayen'
|
||||
| 'Swaziland'
|
||||
| 'Sweden'
|
||||
| 'Switzerland'
|
||||
| 'Syrian Arab Republic'
|
||||
| 'Taiwan, Province of China'
|
||||
| 'Tajikistan'
|
||||
| 'Tanzania, United Republic of'
|
||||
| 'Thailand'
|
||||
| 'Timor-Leste'
|
||||
| 'Togo'
|
||||
| 'Tokelau'
|
||||
| 'Tonga'
|
||||
| 'Trinidad and Tobago'
|
||||
| 'Tunisia'
|
||||
| 'Turkey'
|
||||
| 'Turkmenistan'
|
||||
| 'Turks and Caicos Islands'
|
||||
| 'Tuvalu'
|
||||
| 'Uganda'
|
||||
| 'Ukraine'
|
||||
| 'United Arab Emirates'
|
||||
| 'United Kingdom of Great Britain and Northern Ireland'
|
||||
| 'United States of America'
|
||||
| 'United States Minor Outlying Islands'
|
||||
| 'Uruguay'
|
||||
| 'Uzbekistan'
|
||||
| 'Vanuatu'
|
||||
| 'Venezuela (Bolivarian Republic of)'
|
||||
| 'Viet Nam'
|
||||
| 'Virgin Islands (British)'
|
||||
| 'Virgin Islands (U.S.)'
|
||||
| 'Wallis and Futuna'
|
||||
| 'Western Sahara'
|
||||
| 'Yemen'
|
||||
| 'Zambia'
|
||||
| 'Zimbabwe';
|
||||
|
||||
/**
|
||||
* Translations for specific languages
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
|
||||
*/
|
||||
export interface SCTranslations<T> {
|
||||
/**
|
||||
* German translations
|
||||
*/
|
||||
de?: T;
|
||||
|
||||
/**
|
||||
* English translations
|
||||
*/
|
||||
en?: T;
|
||||
}
|
||||
815
src/core/types/namespaces.ts
Normal file
815
src/core/types/namespaces.ts
Normal file
@@ -0,0 +1,815 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* The license plate of a university e.g. the UID of the university
|
||||
*/
|
||||
export type SCLicensePlate = 'ac-kf' |
|
||||
'ac-fk' |
|
||||
'ac-fh' |
|
||||
'ac-hm' |
|
||||
'ac-th' |
|
||||
'dn-fh' |
|
||||
'aa-fh' |
|
||||
'sig-f2' |
|
||||
'su-ah' |
|
||||
'rd-vf' |
|
||||
'am-f2' |
|
||||
'am-fh' |
|
||||
'an-fh' |
|
||||
'ik-fh' |
|
||||
'ab-fh' |
|
||||
'asl-vf' |
|
||||
'a-hm' |
|
||||
'a-u' |
|
||||
'a-fh' |
|
||||
'hef-fh' |
|
||||
'hg-hs' |
|
||||
'su-if' |
|
||||
'cw-ih' |
|
||||
'tbb-dh' |
|
||||
'eu-vf' |
|
||||
'los-pf' |
|
||||
'esw-pf' |
|
||||
'ba-u' |
|
||||
'bt-kh' |
|
||||
'bt-u' |
|
||||
'gap-kh' |
|
||||
'wr-vf' |
|
||||
'pb-f2' |
|
||||
'b-ah' |
|
||||
'b-am' |
|
||||
'b-fs' |
|
||||
'b-ab' |
|
||||
'b-pf' |
|
||||
'b-tf' |
|
||||
'b-mu' |
|
||||
'b-dk' |
|
||||
'b-p2' |
|
||||
'b-bs' |
|
||||
'b-eh' |
|
||||
'b-hw' |
|
||||
'b-es' |
|
||||
'b-em' |
|
||||
'b-ec' |
|
||||
'b-ef' |
|
||||
'b-vf' |
|
||||
'b-gb' |
|
||||
'b-hs' |
|
||||
'b-pk' |
|
||||
'b-mh' |
|
||||
'b-ft' |
|
||||
'b-p3' |
|
||||
'b-fb' |
|
||||
'b-wt' |
|
||||
'b-u2' |
|
||||
'b-u' |
|
||||
'b-v2' |
|
||||
'b-fw' |
|
||||
'b-p4' |
|
||||
'b-ih' |
|
||||
'b-kf' |
|
||||
'b-mf' |
|
||||
'b-dh' |
|
||||
'b-pu' |
|
||||
'b-ph' |
|
||||
'b-qh' |
|
||||
'b-ot' |
|
||||
'b-fh' |
|
||||
'b-su' |
|
||||
'b-tk' |
|
||||
'b-tc' |
|
||||
'b-hk' |
|
||||
'b-wb' |
|
||||
'b-fp' |
|
||||
'b-v3' |
|
||||
'b-fu' |
|
||||
'b-h3' |
|
||||
'b-hm' |
|
||||
'b-kh' |
|
||||
'b-h4' |
|
||||
'b-f3' |
|
||||
'b-f5' |
|
||||
'b-f2' |
|
||||
'b-tu' |
|
||||
'ber-vf' |
|
||||
'bbg-fh' |
|
||||
'bbg-hs' |
|
||||
'w-k2' |
|
||||
'bi-kh' |
|
||||
'bc-fh' |
|
||||
'bi-du' |
|
||||
'bi-fm' |
|
||||
'pb-f4' |
|
||||
'bi-u' |
|
||||
'bi-fh' |
|
||||
'bi-vf' |
|
||||
'wm-hs' |
|
||||
'mz-fh' |
|
||||
'tr-f2' |
|
||||
'bo-eb' |
|
||||
'bo-fh' |
|
||||
'bo-f1' |
|
||||
'bo-fg' |
|
||||
'bo-hm' |
|
||||
'bo-f3' |
|
||||
'bo-kf' |
|
||||
'bo-u' |
|
||||
'bn-sg' |
|
||||
'bn-pf' |
|
||||
'bn-vf' |
|
||||
'bn-fh' |
|
||||
'bn-u' |
|
||||
'bot-fh' |
|
||||
'brb-vf' |
|
||||
'brb-fh' |
|
||||
'bs-fh' |
|
||||
'bs-hk' |
|
||||
'bs-tu' |
|
||||
'hb-ah' |
|
||||
'hb-hi' |
|
||||
'hb-fh' |
|
||||
'hb-iu' |
|
||||
'hb-hk' |
|
||||
'hb-u' |
|
||||
'hb-vf' |
|
||||
'hb-h' |
|
||||
'ka-pu' |
|
||||
'bm-eu' |
|
||||
'bm-fb' |
|
||||
'std-hs' |
|
||||
'std-fh' |
|
||||
'cw-fh' |
|
||||
'cw-hs' |
|
||||
'ce-pf' |
|
||||
'c-tu' |
|
||||
'c-th' |
|
||||
'gs-tu' |
|
||||
'co-fh' |
|
||||
'co-hs' |
|
||||
'co-f2' |
|
||||
'cb-fh' |
|
||||
'cb-tu' |
|
||||
'da-kf' |
|
||||
'da-vf' |
|
||||
'da-fh' |
|
||||
'da-pf' |
|
||||
'da-tu' |
|
||||
'da-v2' |
|
||||
'deg-fh' |
|
||||
'de-fh' |
|
||||
'dt-fl' |
|
||||
'lip-h2' |
|
||||
'lip-hm' |
|
||||
'dt-hm' |
|
||||
'da-v3' |
|
||||
'dh-fh' |
|
||||
'do-fh' |
|
||||
'do-mh' |
|
||||
'do-is' |
|
||||
'do-pf' |
|
||||
'do-u' |
|
||||
'do-hm' |
|
||||
'do-vf' |
|
||||
'dd-ec' |
|
||||
'dd-fh' |
|
||||
'dd-hs' |
|
||||
'dd-ak' |
|
||||
'dd-ph' |
|
||||
'dd-pf' |
|
||||
'dd-pu' |
|
||||
'dd-hl' |
|
||||
'dd-ht' |
|
||||
'dd-hk' |
|
||||
'dd-ma' |
|
||||
'dd-hm' |
|
||||
'dd-p2' |
|
||||
'dd-p3' |
|
||||
'dd-tu' |
|
||||
'dd-hv' |
|
||||
'd-iu' |
|
||||
'du-hm' |
|
||||
'du-pf' |
|
||||
'du-ug' |
|
||||
'du-vf' |
|
||||
'du-u' |
|
||||
'd-am' |
|
||||
'd-eb' |
|
||||
'd-ff' |
|
||||
'd-pf' |
|
||||
'd-fh' |
|
||||
'd-vf' |
|
||||
'd-hk' |
|
||||
'd-hm' |
|
||||
'd-u' |
|
||||
'bar-fh' |
|
||||
'ew-fh' |
|
||||
'eck-fh' |
|
||||
'ld-vf' |
|
||||
'ei-u' |
|
||||
'pi-f2' |
|
||||
'ol-f2' |
|
||||
'hvl-hs' |
|
||||
'hvl-fh' |
|
||||
'emd-fh' |
|
||||
'ed-pf' |
|
||||
'ef-fh' |
|
||||
'ef-mh' |
|
||||
'ef-pf' |
|
||||
'ef-kh' |
|
||||
'ef-u' |
|
||||
'ef-ph' |
|
||||
'er-u' |
|
||||
'e-fh' |
|
||||
'e-p2' |
|
||||
'e-pf' |
|
||||
'e-uk' |
|
||||
'e-u' |
|
||||
'e-ug' |
|
||||
'e-hm' |
|
||||
'es-ft' |
|
||||
'es-fs' |
|
||||
'fl-fh' |
|
||||
'fl-ph' |
|
||||
'fl-u' |
|
||||
'f-hb' |
|
||||
'f-ms' |
|
||||
'f-u' |
|
||||
'f-v2' |
|
||||
'f-fh' |
|
||||
'f-hk' |
|
||||
'f-hm' |
|
||||
'f-kh' |
|
||||
'f-pf' |
|
||||
'f-vf' |
|
||||
'ff-eu' |
|
||||
'fg-u' |
|
||||
'fr-fh' |
|
||||
'fr-kf' |
|
||||
'fr-u' |
|
||||
'fr-hm' |
|
||||
'fr-ph' |
|
||||
'fb-fh' |
|
||||
'hal-kh' |
|
||||
'fn-dh' |
|
||||
'fn-u' |
|
||||
'fd-fh' |
|
||||
'fd-kh' |
|
||||
'ffb-vf' |
|
||||
'vs-fh' |
|
||||
'wi-f2' |
|
||||
'ul-f2' |
|
||||
'ge-f3' |
|
||||
'ge-fh' |
|
||||
'ge-f2' |
|
||||
'ge-vf' |
|
||||
'g-pf' |
|
||||
'ger-u' |
|
||||
'gi-ft' |
|
||||
'gi-fh' |
|
||||
'gi-vf' |
|
||||
'gi-u' |
|
||||
'gp-fh' |
|
||||
'zi-hw' |
|
||||
'gth-vf' |
|
||||
'g-hs' |
|
||||
'goe-fh' |
|
||||
'goe-u' |
|
||||
'goe-pf' |
|
||||
'gw-u' |
|
||||
'nb-u' |
|
||||
'gw-u2' |
|
||||
'gw-u1' |
|
||||
'hgw-u' |
|
||||
'gue-fh' |
|
||||
'gue-vf' |
|
||||
'pb-f3' |
|
||||
'gt-pf' |
|
||||
'ww-vf' |
|
||||
'ha-ug' |
|
||||
'ha-fh' |
|
||||
'ha-f2' |
|
||||
'ha-vf' |
|
||||
'hbs-fh' |
|
||||
'hbs-vf' |
|
||||
'hal-eh' |
|
||||
'hal-hk' |
|
||||
'hal-ph' |
|
||||
'hal-u' |
|
||||
'hal-u2' |
|
||||
'koet-ph' |
|
||||
'hal-uw' |
|
||||
'hh-am' |
|
||||
'hh-bs' |
|
||||
'hh-pf' |
|
||||
'hh-bc' |
|
||||
'hh-ef' |
|
||||
'hh-fh' |
|
||||
'hh-hu' |
|
||||
'hh-ub' |
|
||||
'hh-ff' |
|
||||
'hh-vf' |
|
||||
'hh-fi' |
|
||||
'hh-ba' |
|
||||
'hh-ib' |
|
||||
'hh-mf' |
|
||||
'hh-ms' |
|
||||
'hh-hf' |
|
||||
'hh-u' |
|
||||
'hh-hs' |
|
||||
'hh-uk' |
|
||||
'hh-fs' |
|
||||
'hh-hk' |
|
||||
'hh-hm' |
|
||||
'hh-tu' |
|
||||
'hm-hs' |
|
||||
'ham-f2' |
|
||||
'ham-fh' |
|
||||
'h-fg' |
|
||||
'h-fh' |
|
||||
'h-hm' |
|
||||
'h-vf' |
|
||||
'h-la' |
|
||||
'h-u' |
|
||||
'h-fb' |
|
||||
'h-kf' |
|
||||
'h-mh' |
|
||||
'h-f3' |
|
||||
'h-pf' |
|
||||
'h-ti' |
|
||||
'hei-fh' |
|
||||
'hd-hm' |
|
||||
'hd-ph' |
|
||||
'hd-kh' |
|
||||
'hd-u' |
|
||||
'hd-fh' |
|
||||
'hdh-dh' |
|
||||
'hn-dh' |
|
||||
'hn-bs' |
|
||||
'hn-fh' |
|
||||
'hn-f2' |
|
||||
'su-f3' |
|
||||
'su-k2' |
|
||||
'he-hk' |
|
||||
'sta-v2' |
|
||||
'hi-fg' |
|
||||
'hi-fs' |
|
||||
'hi-fh' |
|
||||
'hi-v2' |
|
||||
'hi-vf' |
|
||||
'hi-u' |
|
||||
'hi-v3' |
|
||||
'ho-fh' |
|
||||
'ho-f2' |
|
||||
'ho-vf' |
|
||||
's-u2' |
|
||||
'ww-fh' |
|
||||
'hol-fh' |
|
||||
'fds-dh' |
|
||||
'hx-fh' |
|
||||
'lip-h3' |
|
||||
'hx-ug' |
|
||||
'tr-f3' |
|
||||
'mz-f5' |
|
||||
'wi-f5' |
|
||||
'wi-f4' |
|
||||
'rued-pf' |
|
||||
'ik-tu' |
|
||||
'il-th' |
|
||||
'in-fh' |
|
||||
'in-u' |
|
||||
'mk-ts' |
|
||||
'mk-fh' |
|
||||
'rv-pf' |
|
||||
'j-fh' |
|
||||
'j-u' |
|
||||
'kl-fh' |
|
||||
'kl-u' |
|
||||
'wes-fh' |
|
||||
'ka-dh' |
|
||||
'ka-fh' |
|
||||
'ka-pf' |
|
||||
'ka-u' |
|
||||
'ka-hk' |
|
||||
'ka-hg' |
|
||||
'ka-hm' |
|
||||
'ka-ph' |
|
||||
'ks-cv' |
|
||||
'ks-pf' |
|
||||
'ks-fh' |
|
||||
'ks-ms' |
|
||||
'ks-u3' |
|
||||
'ks-ug' |
|
||||
'ks-vf' |
|
||||
'ks-u2' |
|
||||
'og-vf' |
|
||||
'ke-fh' |
|
||||
'ki-u' |
|
||||
'ki-fh' |
|
||||
'ki-f2' |
|
||||
'ki-f6' |
|
||||
'ki-hk' |
|
||||
'ki-f3' |
|
||||
'ki-f4' |
|
||||
'ki-f5' |
|
||||
'ki-ph' |
|
||||
'kle-fh' |
|
||||
'ko-fh' |
|
||||
'ko-u3' |
|
||||
'ko-u' |
|
||||
'ko-vf' |
|
||||
'k-iu' |
|
||||
'k-cb' |
|
||||
'k-fm' |
|
||||
'k-fp' |
|
||||
'k-kf' |
|
||||
'k-mf' |
|
||||
'k-p2' |
|
||||
'k-u' |
|
||||
'k-fb' |
|
||||
'k-u2' |
|
||||
'k-fh' |
|
||||
'k-vf' |
|
||||
'k-hk' |
|
||||
'k-hm' |
|
||||
'k-pf' |
|
||||
'k-v2' |
|
||||
'k-f2' |
|
||||
'kw-fh' |
|
||||
'kn-fh' |
|
||||
'kn-f2' |
|
||||
'kn-u' |
|
||||
'koet-fh' |
|
||||
'koet-th' |
|
||||
'koet-u' |
|
||||
'kr-fh' |
|
||||
'og-fw' |
|
||||
'ld-u' |
|
||||
'la-fh' |
|
||||
'da-v4' |
|
||||
'ler-fh' |
|
||||
'l-fb' |
|
||||
'l-f2' |
|
||||
'l-kh' |
|
||||
'l-h3' |
|
||||
'l-hh' |
|
||||
'l-hm' |
|
||||
'l-h2' |
|
||||
'l-ph' |
|
||||
'l-hs' |
|
||||
'l-ht' |
|
||||
'l-th' |
|
||||
'l-u' |
|
||||
'mer-th' |
|
||||
'lev-pf' |
|
||||
'lev-fh' |
|
||||
'fg-fh' |
|
||||
'lip-f2' |
|
||||
'lip-h1' |
|
||||
'lip-fh' |
|
||||
'so-f2' |
|
||||
'loe-dh' |
|
||||
'hl-fh' |
|
||||
'hl-vf' |
|
||||
'hl-f3' |
|
||||
'hl-uk' |
|
||||
'hl-u' |
|
||||
'hl-f2' |
|
||||
'hl-hm' |
|
||||
'lb-v2' |
|
||||
'lb-fh' |
|
||||
'lb-ph' |
|
||||
'lb-p2' |
|
||||
'lb-vf' |
|
||||
'lu-fh' |
|
||||
'lu-kf' |
|
||||
'lg-u' |
|
||||
'lg-fh' |
|
||||
'md-f2' |
|
||||
'md-fh' |
|
||||
'md-tu' |
|
||||
'md-f3' |
|
||||
'md-mh' |
|
||||
'md-ph' |
|
||||
'md-u' |
|
||||
'mz-f4' |
|
||||
'mz-u2' |
|
||||
'mz-vf' |
|
||||
'mz-f3' |
|
||||
'mz-f2' |
|
||||
'mz-u' |
|
||||
'mz-kf' |
|
||||
'ma-dh' |
|
||||
'ma-fg' |
|
||||
'ma-ft' |
|
||||
'ma-ba' |
|
||||
'ma-v3' |
|
||||
'ma-v2' |
|
||||
'ma-hm' |
|
||||
'ma-fs' |
|
||||
'ma-u' |
|
||||
'mr-eh' |
|
||||
'mr-fh' |
|
||||
'mr-u' |
|
||||
're-pf' |
|
||||
'myk-vf' |
|
||||
'mgn-vf' |
|
||||
'mei-fh' |
|
||||
'mei-fv' |
|
||||
'mei-f2' |
|
||||
'sk-hs' |
|
||||
'hal-fh' |
|
||||
'hsk-fh' |
|
||||
'me-fh' |
|
||||
'rt-hs' |
|
||||
'mi-fh' |
|
||||
'c-fh' |
|
||||
'mw-ht' |
|
||||
'hc-ih' |
|
||||
'mtw-ht' |
|
||||
'mg-fh' |
|
||||
'z-fh' |
|
||||
'mos-dh' |
|
||||
'mh-fh' |
|
||||
'm-am' |
|
||||
'm-b2' |
|
||||
'm-bw' |
|
||||
'm-ea' |
|
||||
'm-vf' |
|
||||
'm-as' |
|
||||
'm-mf' |
|
||||
'm-hk' |
|
||||
'm-hs' |
|
||||
'm-fh' |
|
||||
'm-kf' |
|
||||
'm-hm' |
|
||||
'm-kh' |
|
||||
'm-hp' |
|
||||
'm-fp' |
|
||||
'm-tu' |
|
||||
'm-u' |
|
||||
'gap-ks' |
|
||||
'm-u2' |
|
||||
'm-t2' |
|
||||
'ms-ph' |
|
||||
'ms-kf' |
|
||||
'ms-u' |
|
||||
'ms-fh' |
|
||||
'ms-vf' |
|
||||
'ms-hk' |
|
||||
'ms-hm' |
|
||||
'ms-kh' |
|
||||
'ms-v2' |
|
||||
'nmb-kh' |
|
||||
'nb-fh' |
|
||||
'm-ah' |
|
||||
'm-k3' |
|
||||
'ne-eu' |
|
||||
'ne-hs' |
|
||||
'ne-pf' |
|
||||
'nu-fh' |
|
||||
'h-f2' |
|
||||
'ndh-fh' |
|
||||
'coe-vf' |
|
||||
'n-kf' |
|
||||
'n-hm' |
|
||||
'n-hk' |
|
||||
'n-k1' |
|
||||
'n-k2' |
|
||||
'n-k3' |
|
||||
'n-fh' |
|
||||
'n-u' |
|
||||
'nt-fh' |
|
||||
'nt-f3' |
|
||||
'gp-f2' |
|
||||
'gr-kh' |
|
||||
'hg-kh' |
|
||||
'wi-eb' |
|
||||
'of-hk' |
|
||||
'fr-f2' |
|
||||
'ol-fh' |
|
||||
'ol-pf' |
|
||||
'ol-u' |
|
||||
'os-f2' |
|
||||
'os-fh' |
|
||||
'os-f3' |
|
||||
'os-u' |
|
||||
'os-kf' |
|
||||
'ver-fh' |
|
||||
'pb-fh' |
|
||||
'pb-kf' |
|
||||
'pb-kh' |
|
||||
'pb-ug' |
|
||||
'pb-f1' |
|
||||
'pb-u2' |
|
||||
'pa-u' |
|
||||
'pf-fg' |
|
||||
'pf-fh' |
|
||||
'ps-fh' |
|
||||
'pl-fh' |
|
||||
'p-bs' |
|
||||
'p-f2' |
|
||||
'p-sh' |
|
||||
'p-pf' |
|
||||
'p-u' |
|
||||
'p-fh' |
|
||||
'p-hf' |
|
||||
'brb-f2' |
|
||||
'dd-f2' |
|
||||
'rv-fh' |
|
||||
'rv-dh' |
|
||||
'r-kh' |
|
||||
'r-u' |
|
||||
'r-fh' |
|
||||
'rd-v2' |
|
||||
'ko-f2' |
|
||||
'rd-bf' |
|
||||
'rd-fh' |
|
||||
'rt-fh' |
|
||||
'rt-ts' |
|
||||
'rt-ft' |
|
||||
'su-f2' |
|
||||
'st-mh' |
|
||||
'bc-f2' |
|
||||
'rie-fh' |
|
||||
'shg-vf' |
|
||||
'ro-fh' |
|
||||
'ros-hm' |
|
||||
'ros-im' |
|
||||
'hro-hu' |
|
||||
'hro-u' |
|
||||
'hro-hm' |
|
||||
'rof-vf' |
|
||||
'nol-fh' |
|
||||
'tue-fh' |
|
||||
'wi-f3' |
|
||||
'sb-f2' |
|
||||
'sb-hm' |
|
||||
'sb-hs' |
|
||||
'sb-vf' |
|
||||
'sb-hk' |
|
||||
'sb-fh' |
|
||||
'sb-kf' |
|
||||
'sb-u' |
|
||||
'sz-fh' |
|
||||
'sm-fh' |
|
||||
'aa-fg' |
|
||||
'aa-ph' |
|
||||
'sha-ht' |
|
||||
'sha-kh' |
|
||||
'sad-pf' |
|
||||
'ru-fh' |
|
||||
'wue-f2' |
|
||||
'lds-bc' |
|
||||
'sn-hm' |
|
||||
'hd-vf' |
|
||||
'sfb-fh' |
|
||||
'si-pf' |
|
||||
'si-ug' |
|
||||
'sig-fh' |
|
||||
'so-fh' |
|
||||
'so-vf' |
|
||||
'so-ug' |
|
||||
'sp-u' |
|
||||
'su-fh' |
|
||||
'su-kh' |
|
||||
'sta-vf' |
|
||||
'st-fh' |
|
||||
'sdl-fh' |
|
||||
'hst-fh' |
|
||||
'hst-f2' |
|
||||
'sr-fh' |
|
||||
'og-fh' |
|
||||
's-dp' |
|
||||
's-dh' |
|
||||
's-f2' |
|
||||
's-im' |
|
||||
's-kf' |
|
||||
's-u' |
|
||||
's-va' |
|
||||
's-wh' |
|
||||
's-hk' |
|
||||
's-fh' |
|
||||
's-fb' |
|
||||
's-hm' |
|
||||
's-mf' |
|
||||
's-f3' |
|
||||
's-th' |
|
||||
'ue-fh' |
|
||||
'k-v3' |
|
||||
'k-f3' |
|
||||
'tr-fh' |
|
||||
'tr-kh' |
|
||||
'tr-u' |
|
||||
'an-f2' |
|
||||
'tut-hm' |
|
||||
'tue-u' |
|
||||
'tut-f3' |
|
||||
'ul-fh' |
|
||||
'ul-f4' |
|
||||
'ul-u' |
|
||||
'myk-kh' |
|
||||
'vec-fh' |
|
||||
'vec-u' |
|
||||
'vec-kf' |
|
||||
'bo-f2' |
|
||||
'vs-vf' |
|
||||
'vs-dh' |
|
||||
'vs-f2' |
|
||||
'ros-hs' |
|
||||
'ro-vf' |
|
||||
'pi-fh' |
|
||||
'fs-fh' |
|
||||
'we-hm' |
|
||||
'we-u' |
|
||||
'we-vf' |
|
||||
'we-th' |
|
||||
'kn-ph' |
|
||||
'rv-ph' |
|
||||
'wsf-pf' |
|
||||
'wr-fh' |
|
||||
'wr-v2' |
|
||||
'qlb-vf' |
|
||||
'ldk-fh' |
|
||||
'wi-bs' |
|
||||
'wi-v1' |
|
||||
'wi-fh' |
|
||||
'wi-vf' |
|
||||
'kw-th' |
|
||||
'whv-fh' |
|
||||
'hwi-fh' |
|
||||
'wis-th' |
|
||||
'wis-fh' |
|
||||
'en-u' |
|
||||
'wf-fh' |
|
||||
'wob-fh' |
|
||||
'wo-fh' |
|
||||
'w-hm' |
|
||||
'w-kh' |
|
||||
'w-ug' |
|
||||
'w-vf' |
|
||||
'wue-hm' |
|
||||
'wue-u' |
|
||||
'wue-fh' |
|
||||
'wue-f3' |
|
||||
'zi-ht' |
|
||||
'zi-ih' |
|
||||
'zi-th' |
|
||||
'zw-fh' |
|
||||
'z-t3' |
|
||||
'z-t2' |
|
||||
'z-pf' |
|
||||
'z-hs' |
|
||||
'z-ph' |
|
||||
'z-th' |
|
||||
'z-tu' |
|
||||
'z-ht' |
|
||||
'rc-hs' |
|
||||
'z-p2';
|
||||
|
||||
/* tslint:disable:variable-name */
|
||||
/**
|
||||
* Namespaces for universities for UUID generation
|
||||
*/
|
||||
export const SCNamespaces: { [id in SCLicensePlate]?: string } = {
|
||||
/* tslint:enable:variable-name */
|
||||
/**
|
||||
* Namespace for Hochschule Aschaffenburg
|
||||
*/
|
||||
'ab-fh': 'b28746bb-e95e-4d4d-bf21-1c0a3bb7e83e',
|
||||
/**
|
||||
* Namespace for Technische Universität Berlin
|
||||
*/
|
||||
'b-tu': '909a8cbc-8520-456c-b474-ef1525f14209',
|
||||
/**
|
||||
* Namespace for Goethe-Universität Frankfurt am Main
|
||||
*/
|
||||
'f-u': 'fa256ea6-942d-4ead-96da-5d7678e9e965',
|
||||
/**
|
||||
* Namespace for Hochschule Fulda
|
||||
*/
|
||||
'fd-fh': 'f1aa9ac0-ed3d-493b-987c-f98aeeba154b',
|
||||
/**
|
||||
* Namespace for Technische Hochschule Mittelhessen
|
||||
*/
|
||||
'gi-fh': 'f599f1d1-5b76-4654-a394-d37680d75e22',
|
||||
/**
|
||||
* Namespace for Justus-Liebig-Universität Gießen
|
||||
*/
|
||||
'gi-u': '9884e6f2-cbbb-4341-8d30-5ba3f1514927',
|
||||
/**
|
||||
* Namespace for Universität Kassel
|
||||
*/
|
||||
'ks-ug': '277fe8f6-dbc9-4ec2-9f87-d30e0dc347af',
|
||||
};
|
||||
63
src/core/types/sorts/Abstract.ts
Normal file
63
src/core/types/sorts/Abstract.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsField} from '../../Classes';
|
||||
import {SCDistanceSort} from './Distance';
|
||||
import {SCDucetSort} from './Ducet';
|
||||
import {SCPriceSort} from './Price';
|
||||
|
||||
/**
|
||||
* Abstract sort instruction
|
||||
*/
|
||||
export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
|
||||
/**
|
||||
* Map of arguments for the sort instruction
|
||||
*/
|
||||
arguments: T;
|
||||
|
||||
/**
|
||||
* Direction of the sort instruction: `asc`ending or `desc`ending.
|
||||
*/
|
||||
order: 'asc' | 'desc';
|
||||
|
||||
/**
|
||||
* Type of the sort instruction
|
||||
*/
|
||||
type: SCSearchSortType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map of arguments for the sort instruction
|
||||
*/
|
||||
export interface SCSearchAbstractSortArguments {
|
||||
/**
|
||||
* Index signature for additional arguments
|
||||
*/
|
||||
[key: string]: any;
|
||||
|
||||
/**
|
||||
* Field to sort by
|
||||
*/
|
||||
field: SCThingsField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of a sort instruction
|
||||
*/
|
||||
export type SCSearchSortType = 'distance' | 'price' | 'ducet';
|
||||
|
||||
/**
|
||||
* A sort instruction
|
||||
*/
|
||||
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort;
|
||||
33
src/core/types/sorts/Distance.ts
Normal file
33
src/core/types/sorts/Distance.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Position} from 'geojson';
|
||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
|
||||
/**
|
||||
* Sort instruction to sort by distance
|
||||
*/
|
||||
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
|
||||
type: 'distance';
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional arguments for sort instruction to sort by distance
|
||||
*/
|
||||
export interface SCDistanceSortArguments extends SCSearchAbstractSortArguments {
|
||||
/**
|
||||
* Position to calculate distances to
|
||||
*/
|
||||
position: Position;
|
||||
}
|
||||
22
src/core/types/sorts/Ducet.ts
Normal file
22
src/core/types/sorts/Ducet.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
|
||||
/**
|
||||
* Sort instruction for ducet sort
|
||||
*/
|
||||
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
||||
type: 'ducet';
|
||||
}
|
||||
33
src/core/types/sorts/Price.ts
Normal file
33
src/core/types/sorts/Price.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCSportCoursePriceGroup} from '../../things/DateSeries';
|
||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
|
||||
/**
|
||||
* Sort instruction to sort by price
|
||||
*/
|
||||
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
|
||||
type: 'price';
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional arguments for sort instruction to sort by price
|
||||
*/
|
||||
export interface SCPriceSortArguments extends SCSearchAbstractSortArguments {
|
||||
/**
|
||||
* University role to sort price for
|
||||
*/
|
||||
universityRole: keyof SCSportCoursePriceGroup;
|
||||
}
|
||||
Reference in New Issue
Block a user