mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 03:32:52 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a84d12f26 | ||
|
|
b621a12689 | ||
|
|
6ffa4efbaf | ||
|
|
e41169a9c7 | ||
|
|
46194b177b | ||
|
|
ff1f554e0b | ||
|
|
9c424b0f96 | ||
|
|
55b5248660 | ||
|
|
961103c4e8 | ||
|
|
771c417db8 | ||
|
|
f847a2aa0c | ||
|
|
78b64bae08 | ||
|
|
e3ea846470 | ||
|
|
3f10129356 | ||
|
|
68c5fcacbb | ||
|
|
56d43bb59a | ||
|
|
2ad314eda6 | ||
|
|
f2a86fb6bd | ||
|
|
198f48add4 | ||
|
|
5e29203e3d | ||
|
|
ca72c20bd0 | ||
|
|
da0507ee34 | ||
|
|
1a73208c6f | ||
|
|
1d6a2b7841 | ||
|
|
e3d3d022c7 | ||
|
|
bff6079f60 | ||
|
|
bac09ffebc | ||
|
|
1c5a931e09 | ||
|
|
e8da621558 | ||
|
|
6f12fbda94 | ||
|
|
cf83692e71 | ||
|
|
27417e80e1 | ||
|
|
bab675b806 | ||
|
|
d3790adbd8 | ||
|
|
d8aa023b28 |
@@ -50,6 +50,21 @@ test:
|
||||
- report
|
||||
- coverage
|
||||
|
||||
package:
|
||||
dependencies:
|
||||
- build
|
||||
tags:
|
||||
- secrecy
|
||||
stage: deploy
|
||||
script:
|
||||
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
|
||||
- npm publish
|
||||
only:
|
||||
- /^v[0-9]+.[0-9]+.[0-9]+$/
|
||||
artifacts:
|
||||
paths:
|
||||
- lib
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
|
||||
34
CHANGELOG.md
34
CHANGELOG.md
@@ -1,3 +1,37 @@
|
||||
# [0.20.0](https://gitlab.com/openstapps/core/compare/v0.19.0...v0.20.0) (2019-06-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2a))
|
||||
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64ba))
|
||||
|
||||
|
||||
|
||||
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507e)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
|
||||
|
||||
|
||||
# [0.18.0](https://gitlab.com/openstapps/core/compare/v0.17.0...v0.18.0) (2019-05-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790ad))
|
||||
|
||||
|
||||
|
||||
# [0.17.0](https://gitlab.com/openstapps/core/compare/v0.16.0...v0.17.0) (2019-04-16)
|
||||
|
||||
|
||||
|
||||
# [0.16.0](https://gitlab.com/openstapps/core/compare/v0.15.0...v0.16.0) (2019-04-15)
|
||||
|
||||
|
||||
|
||||
18
README.md
18
README.md
@@ -29,3 +29,21 @@ To generate a documentation for the routes use the following command.
|
||||
```shell
|
||||
node --require ts-node/register src/cli.ts routes PATH/TO/ROUTES.md
|
||||
```
|
||||
|
||||
### Annotations
|
||||
|
||||
Annotations are used to add additional informations to fields, which are used to autogenerate mappings from the core objects.
|
||||
External dependencies can not be covered by the annotations. Documentation about some of the annotations can be found in: [typedoc](https://typedoc.org/guides/doccomments/)
|
||||
|
||||
| annotation | description | parameters |
|
||||
|-------------------|-------------------------------------------|---------------|
|
||||
| `@aggregatable` | used for generating of aggregations of the field if the core schema is used to put data into a database/key-value store | |
|
||||
| `@float` | number field is interpreted as float | |
|
||||
| `@indexable` | marks the type as indexable if the core schema is used to put data into a database/key-value store| |
|
||||
| `@integer` | number field is interpreted as integer | |
|
||||
| `@keyword` | string field is interpreted as keyword | |
|
||||
| `@sortable` | field is sortable if the core schema is used to put data into a database/key-value store | sort method to be used: ducet, price, distance |
|
||||
| `@text` | string field is interpreted as text | |
|
||||
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |
|
||||
|
||||
|
||||
|
||||
726
package-lock.json
generated
726
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openstapps/core",
|
||||
"version": "0.17.0",
|
||||
"version": "0.21.0",
|
||||
"description": "StAppsCore - Generalized model of data",
|
||||
"keywords": [
|
||||
"Model",
|
||||
@@ -20,10 +20,13 @@
|
||||
"compile": "rimraf lib && tsc",
|
||||
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
||||
"pack": "openstapps-core-tools pack",
|
||||
"postversion": "npm run changelog",
|
||||
"prepublishOnly": "npm ci && npm run build",
|
||||
"preversion": "npm run prepublishOnly",
|
||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
|
||||
"test": "nyc mocha --require ts-node/register --ui mocha-typescript test/*.spec.ts",
|
||||
"tslint": "tslint 'src/**/*.ts'"
|
||||
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
|
||||
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
||||
},
|
||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"contributors": [
|
||||
@@ -39,29 +42,33 @@
|
||||
"dependencies": {
|
||||
"@types/geojson": "1.0.6",
|
||||
"@types/json-patch": "0.0.30",
|
||||
"@types/node": "10.14.8",
|
||||
"fast-clone": "1.5.13",
|
||||
"http-status-codes": "1.3.2",
|
||||
"json-patch": "0.7.0",
|
||||
"jsonschema": "1.2.4",
|
||||
"ts-optchain": "0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/configuration": "0.12.0",
|
||||
"@krlwlfrt/async-pool": "0.1.0",
|
||||
"@openstapps/configuration": "0.18.0",
|
||||
"@openstapps/core-tools": "0.6.0",
|
||||
"@openstapps/logger": "0.0.5",
|
||||
"@openstapps/logger": "0.2.1",
|
||||
"@types/chai": "4.1.7",
|
||||
"@types/node": "10.14.4",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"async-pool-native": "0.1.0",
|
||||
"chai": "4.2.0",
|
||||
"commander": "2.20.0",
|
||||
"conventional-changelog-cli": "2.0.12",
|
||||
"mocha": "6.1.3",
|
||||
"conditional-type-checks": "1.0.1",
|
||||
"conventional-changelog-cli": "2.0.21",
|
||||
"mocha": "6.1.4",
|
||||
"mocha-typescript": "1.1.17",
|
||||
"nyc": "14.0.0",
|
||||
"nyc": "14.1.1",
|
||||
"rimraf": "2.6.3",
|
||||
"ts-node": "8.1.0",
|
||||
"tslint": "5.15.0",
|
||||
"source-map-support": "0.5.12",
|
||||
"ts-node": "8.2.0",
|
||||
"tslint": "5.17.0",
|
||||
"typedoc": "0.14.2",
|
||||
"typescript": "3.4.3"
|
||||
"typescript": "3.5.1"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
@@ -69,11 +76,12 @@
|
||||
"lines": 95,
|
||||
"statements": 95,
|
||||
"functions": 95,
|
||||
"branches": 95,
|
||||
"branches": 85,
|
||||
"include": [
|
||||
"src/core/Route.ts",
|
||||
"src/core/Thing.ts",
|
||||
"src/core/Translator.ts"
|
||||
"src/core/Translator.ts",
|
||||
"src/core/types/Guards.ts"
|
||||
],
|
||||
"exclude": [],
|
||||
"extension": [
|
||||
@@ -84,5 +92,13 @@
|
||||
"text-summary"
|
||||
],
|
||||
"all": true
|
||||
},
|
||||
"openstappsConfiguration": {
|
||||
"hasCli": false,
|
||||
"ignoreCiEntries": [
|
||||
"build"
|
||||
],
|
||||
"standardBuild": false,
|
||||
"standardDocumentation": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/Room';
|
||||
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/Semester';
|
||||
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/Setting';
|
||||
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/SportCourse';
|
||||
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/StudyModule';
|
||||
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/Ticket';
|
||||
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/ToDo';
|
||||
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/Tour';
|
||||
@@ -41,7 +42,7 @@ import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/Video';
|
||||
/**
|
||||
* A map of things, from type to meta data
|
||||
*/
|
||||
export const SCClasses: { [K in SCThingType]: any } = {
|
||||
export const SCClasses: { [K in SCThingType]: object } = {
|
||||
/* tslint:enable */
|
||||
'academic event': SCAcademicEventMeta,
|
||||
'article': SCArticleMeta,
|
||||
@@ -62,6 +63,7 @@ export const SCClasses: { [K in SCThingType]: any } = {
|
||||
'semester': SCSemesterMeta,
|
||||
'setting': SCSettingMeta,
|
||||
'sport course': SCSportCourseMeta,
|
||||
'study module': SCStudyModuleMeta,
|
||||
'ticket': SCTicketMeta,
|
||||
'todo': SCToDoMeta,
|
||||
'tour': SCTourMeta,
|
||||
@@ -87,6 +89,7 @@ export type SCThingsWithoutDiff =
|
||||
| SCSemester
|
||||
| SCSetting
|
||||
| SCSportCourse
|
||||
| SCStudyModule
|
||||
| SCTicket
|
||||
| SCToDo
|
||||
| SCTour
|
||||
@@ -127,11 +130,12 @@ export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
|
||||
THING extends SCSemester ? SCSemesterWithoutReferences :
|
||||
THING extends SCSetting ? SCSettingWithoutReferences :
|
||||
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
|
||||
THING extends SCTicket ? SCTicketWithoutReferences :
|
||||
THING extends SCToDo ? SCToDoWithoutReferences :
|
||||
THING extends SCTour ? SCTourWithoutReferences :
|
||||
THING extends SCVideo ? SCVideoWithoutReferences :
|
||||
never;
|
||||
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
|
||||
THING extends SCTicket ? SCTicketWithoutReferences :
|
||||
THING extends SCToDo ? SCToDoWithoutReferences :
|
||||
THING extends SCTour ? SCTourWithoutReferences :
|
||||
THING extends SCVideo ? SCVideoWithoutReferences :
|
||||
never;
|
||||
|
||||
/**
|
||||
* Thing for a thing without references
|
||||
@@ -156,8 +160,9 @@ export type SCAssociatedThing<THING extends SCThings> =
|
||||
THING extends SCSemesterWithoutReferences ? SCSemester :
|
||||
THING extends SCSettingWithoutReferences ? SCSetting :
|
||||
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
|
||||
THING extends SCTicketWithoutReferences ? SCTicket :
|
||||
THING extends SCToDoWithoutReferences ? SCToDo :
|
||||
THING extends SCTourWithoutReferences ? SCTour :
|
||||
THING extends SCVideoWithoutReferences ? SCVideo :
|
||||
never;
|
||||
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
|
||||
THING extends SCTicketWithoutReferences ? SCTicket :
|
||||
THING extends SCToDoWithoutReferences ? SCToDo :
|
||||
THING extends SCTourWithoutReferences ? SCTour :
|
||||
THING extends SCVideoWithoutReferences ? SCVideo :
|
||||
never;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -48,7 +48,8 @@ export enum SCRouteHttpVerbs {
|
||||
/**
|
||||
* The constructor of an error response
|
||||
*/
|
||||
export type SCErrorResponseConstructor = new (...args: any) => SCErrorResponse;
|
||||
// tslint:disable-next-line:no-any
|
||||
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
|
||||
|
||||
/**
|
||||
* A description of a route
|
||||
@@ -94,19 +95,41 @@ export interface SCRoute {
|
||||
* An abstract route
|
||||
*/
|
||||
export abstract class SCAbstractRoute implements SCRoute {
|
||||
/**
|
||||
* @see SCRoute.errorNames
|
||||
*/
|
||||
errorNames: SCErrorResponseConstructor[] = [];
|
||||
/**
|
||||
* @see SCRoute.method
|
||||
*/
|
||||
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
|
||||
/**
|
||||
* @see SCRoute.obligatoryParameters
|
||||
*/
|
||||
obligatoryParameters?: SCMap<string>;
|
||||
/**
|
||||
* @see SCRoute.requestBodyName
|
||||
*/
|
||||
requestBodyName = 'any';
|
||||
/**
|
||||
* @see SCRoute.responseBodyName
|
||||
*/
|
||||
responseBodyName = 'any';
|
||||
/**
|
||||
* @see SCRoute.statusCodeSuccess
|
||||
*/
|
||||
statusCodeSuccess = 200;
|
||||
/**
|
||||
* @see SCRoute.urlFragment
|
||||
*/
|
||||
urlFragment = '/';
|
||||
|
||||
public getUrlFragment(parameters?: SCMap<string>): string {
|
||||
if (typeof parameters === 'undefined') {
|
||||
parameters = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "compiled" URL fragment
|
||||
*
|
||||
* @param parameters Parameters to compile URL fragment with
|
||||
*/
|
||||
public getUrlFragment(parameters: SCMap<string> = {}): string {
|
||||
let obligatoryParameters: string[] = [];
|
||||
|
||||
if (typeof this.obligatoryParameters === 'object') {
|
||||
@@ -126,14 +149,13 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
|
||||
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('/');
|
||||
})
|
||||
.join('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
* 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 {SCOrganization} from './things/Organization';
|
||||
import {SCPerson} from './things/Person';
|
||||
import {SCOrganizationWithoutReferences} from './things/Organization';
|
||||
import {SCPersonWithoutReferences} from './things/Person';
|
||||
import {SCMetaTranslations, SCTranslations} from './types/i18n';
|
||||
import {SCISO8601Date} from './types/Time';
|
||||
import {SCUuid} from './types/UUID';
|
||||
@@ -41,6 +41,7 @@ export enum SCThingType {
|
||||
Semester = 'semester',
|
||||
Setting = 'setting',
|
||||
SportCourse = 'sport course',
|
||||
StudyModule = 'study module',
|
||||
Ticket = 'ticket',
|
||||
ToDo = 'todo',
|
||||
Tour = 'tour',
|
||||
@@ -48,33 +49,36 @@ export enum SCThingType {
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing
|
||||
* A thing without references
|
||||
*/
|
||||
export interface SCThing {
|
||||
export interface SCThingWithoutReferences {
|
||||
/**
|
||||
* Alternate names of the thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
/**
|
||||
* Description of the thing
|
||||
*
|
||||
* @minLength 1
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Image of the thing
|
||||
* URL of an image of the thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
/**
|
||||
* Name of the thing
|
||||
*
|
||||
* @minLength 1
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin: SCThingRemoteOrigin | SCThingUserOrigin;
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
@@ -83,6 +87,9 @@ export interface SCThing {
|
||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||
/**
|
||||
* Type of the thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
*/
|
||||
type: SCThingType;
|
||||
/**
|
||||
@@ -95,6 +102,16 @@ export interface SCThing {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing
|
||||
*/
|
||||
export interface SCThing extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin: SCThingRemoteOrigin | SCThingUserOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible types of an origin
|
||||
*/
|
||||
@@ -112,7 +129,7 @@ export interface SCThingOrigin {
|
||||
*
|
||||
* e.g. restaurant of a dish
|
||||
*/
|
||||
maintainer?: SCPerson | SCOrganization;
|
||||
maintainer?: SCPersonWithoutReferences | SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* When the thing was modified last in the origin
|
||||
@@ -136,6 +153,8 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
|
||||
|
||||
/**
|
||||
* Name of the origin
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
@@ -149,7 +168,7 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
|
||||
*
|
||||
* e.g. an organizer for an event
|
||||
*/
|
||||
responsibleEntity?: SCPerson | SCOrganization;
|
||||
responsibleEntity?: SCPersonWithoutReferences | SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Type of the origin
|
||||
@@ -193,10 +212,14 @@ export interface SCThingUserOrigin extends SCThingOrigin {
|
||||
export interface SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the description of the thing
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Translation of the name of the thing
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
@@ -211,6 +234,8 @@ export interface SCThingTranslatableProperties {
|
||||
export interface SCThingTranslatablePropertyOrigin {
|
||||
/**
|
||||
* Translation of the name of the origin
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
@@ -255,7 +280,7 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
type: 'Ding',
|
||||
},
|
||||
@@ -264,15 +289,18 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
},
|
||||
};
|
||||
|
||||
// tslint:disable:static-this
|
||||
/**
|
||||
* Function to retrieve typed singleton instance
|
||||
*/
|
||||
public static getInstance<T extends SCThingMeta>(): T {
|
||||
if (!this._instance.has(this.name)) {
|
||||
this._instance.set(this.name, new this());
|
||||
if (!SCThingMeta._instance.has(this.name)) {
|
||||
SCThingMeta._instance.set(this.name, new this());
|
||||
}
|
||||
return this._instance.get(this.name) as T;
|
||||
|
||||
return SCThingMeta._instance.get(this.name) as T;
|
||||
}
|
||||
|
||||
protected constructor() {}
|
||||
protected constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,78 +12,88 @@
|
||||
* 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 {SCClasses, SCThingsField} from './Classes';
|
||||
import {SCClasses} from './Classes';
|
||||
import {SCThing, SCThingType} from './Thing';
|
||||
|
||||
import {isThing} from './types/Guards';
|
||||
import {SCTranslations} from './types/i18n';
|
||||
|
||||
import clone = require('fast-clone');
|
||||
import {Defined, OCType} from 'ts-optchain';
|
||||
|
||||
// tslint:disable:no-any
|
||||
const standardCacheSize = 200;
|
||||
|
||||
/**
|
||||
* SCThingTranslator class
|
||||
*/
|
||||
export class SCThingTranslator {
|
||||
/**
|
||||
* Property representing the translators base language.
|
||||
* This means every translation is given for this language.
|
||||
*/
|
||||
private baseLanguage: keyof SCTranslations<SCThing>;
|
||||
|
||||
/**
|
||||
* Property representing the translators target language
|
||||
*/
|
||||
private language: keyof SCTranslations<SCThing>;
|
||||
private _language: keyof SCTranslations<SCThing>;
|
||||
|
||||
/**
|
||||
* Property provinding a mapping from a SCThingType to its known own meta class.
|
||||
* Property representing the translators base language
|
||||
* This means every translation is given for this language
|
||||
*/
|
||||
private metaClasses: typeof SCClasses;
|
||||
private readonly cache: LRUCache<SCThing>;
|
||||
|
||||
/**
|
||||
* Property providing a mapping from a SCThingType to its known own meta class
|
||||
*/
|
||||
private readonly metaClasses: typeof SCClasses;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @example
|
||||
* // returns translator instance for german
|
||||
* new SCThingTranslator('de');
|
||||
*/
|
||||
constructor(language: keyof SCTranslations<SCThing>, baseLanguage?: keyof SCTranslations<SCThing>) {
|
||||
this.baseLanguage = baseLanguage ? baseLanguage : 'en';
|
||||
this.language = language;
|
||||
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = standardCacheSize) {
|
||||
this.cache = new LRUCache(cacheCapacity);
|
||||
this._language = language;
|
||||
this.metaClasses = SCClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for language property
|
||||
*/
|
||||
get language(): keyof SCTranslations<SCThing> {
|
||||
return this._language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for language property. Also flushes translation cache
|
||||
*
|
||||
* @param language The language the translator instance will use from now on
|
||||
*/
|
||||
set language(language: keyof SCTranslations<SCThing>) {
|
||||
if (language !== this._language) {
|
||||
this.cache.flush();
|
||||
}
|
||||
this._language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field value translation recursively
|
||||
*
|
||||
* @param firstObject Top level object that gets passed through the recursion
|
||||
* @param data The intermediate object / primitive returned by the Proxys get() method
|
||||
* @param keyPath The keypath that (in the end) leads to the translatable property (when added to firstObject)
|
||||
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
|
||||
*/
|
||||
private deeptranslate<T, K extends SCThing>(firstObject: K, data?: T, keyPath?: string): OCType<T> {
|
||||
// tslint:disable-next-line:prefer-function-over-method
|
||||
private deeptranslate<T>(data?: T): OCType<T> {
|
||||
const proxy = new Proxy(
|
||||
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
|
||||
{
|
||||
get: (target, key) => {
|
||||
const obj: any = target();
|
||||
const extendedKeyPath = [keyPath, key.toString()].filter((e) => e != null).join('.');
|
||||
let possiblePrimitive = obj[key];
|
||||
// check if obj[key] is an array that contains primitive type (arrays in SCThings are not mixing types)
|
||||
if (obj[key] instanceof Array && obj[key].length) {
|
||||
possiblePrimitive = obj[key][0];
|
||||
}
|
||||
if (typeof possiblePrimitive === 'string' ||
|
||||
typeof possiblePrimitive === 'number' ||
|
||||
typeof possiblePrimitive === 'boolean') {
|
||||
// returns final translation for primitive data types
|
||||
return this.deeptranslate(firstObject,
|
||||
this.getFieldValueTranslation(firstObject, extendedKeyPath),
|
||||
extendedKeyPath);
|
||||
}
|
||||
// recursion to get more calls to the Proxy handler 'get()' (key path not complete)
|
||||
return this.deeptranslate(firstObject, obj[key], extendedKeyPath);
|
||||
|
||||
return this.deeptranslate(obj[key]);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
@@ -98,154 +108,75 @@ export class SCThingTranslator {
|
||||
language: keyof SCTranslations<T>): object | undefined {
|
||||
const fieldTranslations = {};
|
||||
const metaClass = this.getMetaClassInstance(thingType);
|
||||
if (metaClass === undefined) {
|
||||
if (typeof metaClass === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Assigns every property in fieldTranslations to the known base language translation
|
||||
if (metaClass.fieldTranslations[this.baseLanguage] !== undefined) {
|
||||
Object.keys(metaClass.fieldTranslations[this.baseLanguage]).forEach((key) => {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations[this.baseLanguage][key];
|
||||
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
|
||||
Object.keys(metaClass.fieldTranslations.en)
|
||||
.forEach((key) => {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
|
||||
});
|
||||
}
|
||||
|
||||
// Assigns every property in fieldTranslations to the known translation in given language
|
||||
if (metaClass.fieldTranslations[language] !== undefined) {
|
||||
Object.keys(metaClass.fieldTranslations[language]).forEach((key) => {
|
||||
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
|
||||
Object.keys(metaClass.fieldTranslations[language])
|
||||
.forEach((key) => {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
|
||||
});
|
||||
}
|
||||
|
||||
return fieldTranslations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta class needed for translations given a SCThingType
|
||||
*
|
||||
* @param thingType
|
||||
* @param thingType Type of the thing
|
||||
* @returns An instance of the metaclass
|
||||
*/
|
||||
private getMetaClassInstance(thingType: SCThingType): any {
|
||||
if (thingType in this.metaClasses) {
|
||||
return new (this.metaClasses as any)[thingType]();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property value at a certain (key) path of an object.
|
||||
* @example
|
||||
* // returns value of dish.offers[0].inPlace.categories[1]
|
||||
* const dish: SCDish = {...};
|
||||
* this.valueFromPath(dish, 'offers[0].inPlace.categories[1]');
|
||||
* @param path Key path to evaluate
|
||||
* @param obj Object to evaluate the key path upon
|
||||
* @param separator Key path seperation element. Defaults to '.'
|
||||
* @returns Property value at at key path
|
||||
* Applies known field value translations of the given SCThings meta class to an instance
|
||||
* Translated values overwrite current values inplace (destructive)
|
||||
*
|
||||
* @param language The language the thing is translated to
|
||||
* @param thing The thing that will be translated
|
||||
* @returns The thing with translated meta field values
|
||||
*/
|
||||
private valueFromPath<T extends SCThing>(path: string, obj: T, separator = '.') {
|
||||
path = path.replace(/\[/g, '.');
|
||||
path = path.replace(/\]/g, '.');
|
||||
path = path.replace(/\.\./g, '.');
|
||||
path = path.replace(/\.$/, '');
|
||||
const properties = path.split(separator);
|
||||
return properties.reduce((prev: any, curr: any) => prev && prev[curr], obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field value translation
|
||||
* @example
|
||||
* // returns translation of the property (if available) in the language defined when creating the translator object
|
||||
* const dish: SCDish = {...};
|
||||
* translator.translate(dish, 'offers[0].inPlace.categories[1]');
|
||||
* @param thing SCThing to get value translation for
|
||||
* @param field Field to get value translation for (keypath allowed)
|
||||
* @returns Translated value(s) or value(s) itself
|
||||
*/
|
||||
public getFieldValueTranslation<T extends SCThing>(thing: T,
|
||||
field: SCThingsField): string | string[] {
|
||||
let translationPath = 'translations.' + this.language + '.' + field;
|
||||
const regexTrimProperties = /.*(?:(\..*)(\[\d+\])|(\.[^\d]*$)|(\..*)(\.[\d]*$))/;
|
||||
|
||||
const pathMatch = field.match(regexTrimProperties);
|
||||
|
||||
// when translation is given in thing
|
||||
let translation = this.valueFromPath(translationPath, thing);
|
||||
if (translation) {
|
||||
return translation;
|
||||
} else if (pathMatch && pathMatch[1] && pathMatch[2] || pathMatch && pathMatch[4] && pathMatch[5]) {
|
||||
// accessing iteratable of nested thing
|
||||
const keyPath = (pathMatch[1] ? pathMatch[1] : pathMatch[4]) + (pathMatch[2] ? pathMatch[2] : pathMatch[5]);
|
||||
const redactedField = field.replace(keyPath, '');
|
||||
|
||||
// when translation is given in nested thing
|
||||
translationPath = `${redactedField}.translations.${this.language}${keyPath}`;
|
||||
translation = this.valueFromPath(translationPath, thing);
|
||||
if (translation) {
|
||||
return translation;
|
||||
}
|
||||
|
||||
// when translation is given in nested meta thing via iterateable index
|
||||
const nestedType = this.valueFromPath(field.replace(keyPath, '.type'), thing) as SCThingType;
|
||||
translationPath = `fieldValueTranslations.${this.language}${keyPath}`;
|
||||
translation = this.valueFromPath(translationPath.replace(
|
||||
/\[(?=[^\[]*$).*|(?=[\d+]*$).*/, '[' + this.valueFromPath(field, thing) + ']'),
|
||||
this.getMetaClassInstance(nestedType));
|
||||
if (translation) {
|
||||
return translation;
|
||||
}
|
||||
|
||||
} else if (pathMatch && pathMatch[3]) {
|
||||
// accessing meta or instance of nested thing primitive value depth > 0
|
||||
const keyPath = pathMatch[3];
|
||||
const redactedField = field.replace(pathMatch[3], '');
|
||||
|
||||
// when translation is given in nested thing
|
||||
translationPath = `${redactedField}.translations.${this.language}${keyPath}`;
|
||||
if (this.valueFromPath(translationPath, thing)) {
|
||||
return this.valueFromPath(translationPath, thing);
|
||||
}
|
||||
|
||||
// when translation is given in nested meta thing
|
||||
const nestedType = this.valueFromPath(field.replace(keyPath, '.type'), thing) as SCThingType;
|
||||
translationPath = `fieldValueTranslations.${this.language}${keyPath}`;
|
||||
translation = this.valueFromPath(translationPath, this.getMetaClassInstance(nestedType));
|
||||
if (translation instanceof Object) { // lookup translated keys in meta thing property
|
||||
const translations: string[] = [];
|
||||
this.valueFromPath(field, thing).forEach((key: string) => {
|
||||
translationPath = `fieldValueTranslations.${this.language}${keyPath}.${key}`;
|
||||
translations.push(this.valueFromPath(translationPath, this.getMetaClassInstance(nestedType)));
|
||||
});
|
||||
return translations;
|
||||
}
|
||||
if (!translation) { // translation not given, return as is
|
||||
return this.valueFromPath(field, thing) as string;
|
||||
}
|
||||
return translation;
|
||||
private replaceAvailableMetaFieldValueTranslations(instance: any,
|
||||
language: keyof SCTranslations<any>): any {
|
||||
const metaClass = this.getMetaClassInstance(instance.type);
|
||||
if (typeof metaClass === 'undefined') {
|
||||
return instance;
|
||||
}
|
||||
// accessing meta thing primitive value depth = 0
|
||||
translationPath = `fieldValueTranslations.${this.language}.${field}`;
|
||||
translation = this.valueFromPath(translationPath, this.getMetaClassInstance(thing.type));
|
||||
if (translation) {
|
||||
if (translation instanceof Object) { // lookup translated keys in meta thing property
|
||||
const translations: string[] = [];
|
||||
this.valueFromPath(field, thing).forEach((key: string) => {
|
||||
translationPath = `fieldValueTranslations.${this.language}.${field}.${key}`;
|
||||
translations.push(this.valueFromPath(translationPath, this.getMetaClassInstance(thing.type)));
|
||||
});
|
||||
return translations;
|
||||
}
|
||||
return translation;
|
||||
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
|
||||
Object.keys(metaClass.fieldValueTranslations[language])
|
||||
.forEach((key) => {
|
||||
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
|
||||
// Assigns known translations of subproperties to property in given language (e.g. categories)
|
||||
Object.keys((instance as any)[key])
|
||||
.forEach((subKey) => {
|
||||
(instance as any)[key][subKey] =
|
||||
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
|
||||
});
|
||||
} else {
|
||||
// Assigns property to known translation of fieldValueTranslations in given language
|
||||
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// accessing meta thing primitive via iteratable index value depth = 0
|
||||
translation = this.valueFromPath(translationPath.replace(
|
||||
/\[(?=[^\[]*$).*|(?=[\d+]*$).*/, '[' + this.valueFromPath(field, thing) + ']'),
|
||||
this.getMetaClassInstance(thing.type));
|
||||
if (translation) {
|
||||
return translation;
|
||||
}
|
||||
// last resort: return as is
|
||||
return this.valueFromPath(field, thing) as string;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,43 +192,167 @@ export class SCThingTranslator {
|
||||
* @param data Top level object that gets passed through the recursion
|
||||
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
|
||||
*/
|
||||
public translate<T extends SCThing>(data?: T): OCType<T> {
|
||||
public translate<T extends SCThing>(data: T): OCType<T> {
|
||||
return new Proxy(
|
||||
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
|
||||
{
|
||||
get: (target, key) => {
|
||||
const obj: any = target();
|
||||
let translatable = obj[key];
|
||||
if (obj[key] instanceof Array && obj[key].length) {
|
||||
translatable = obj[key][0];
|
||||
if (typeof obj[key][0] === 'object' && !obj[key][0].origin) {
|
||||
translatable = obj[key][0][Object.keys(obj[key][0])[0]];
|
||||
}
|
||||
const objTranslatedFromCache = this.cache.get(data);
|
||||
if (typeof objTranslatedFromCache !== 'undefined') {
|
||||
return this.deeptranslate((objTranslatedFromCache as any)[key]);
|
||||
}
|
||||
if (typeof translatable === 'string') {
|
||||
// retrieve final translation
|
||||
return this.deeptranslate(data!, this.getFieldValueTranslation(data!, key.toString()), key.toString());
|
||||
}
|
||||
// recursion to get more calls to the Proxy handler 'get()' (key path not complete)
|
||||
return this.deeptranslate(data!, obj[key], key.toString());
|
||||
const objTranslated = this.translateWholeThingDestructively(clone(obj));
|
||||
this.cache.putObject(objTranslated);
|
||||
|
||||
return this.deeptranslate(objTranslated[key]);
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing.
|
||||
* All the values will be set to the known translations of the property/key name.
|
||||
* Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing
|
||||
* All the values will be set to the known translations of the property/key name
|
||||
* @example
|
||||
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
||||
* @param language The language the object is translated to
|
||||
* @param thingType
|
||||
* @param thingType Type of the thing
|
||||
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
||||
*/
|
||||
public translatedPropertyNames<T extends SCThing>(thing: T,
|
||||
language?: keyof SCTranslations<T>): T | undefined {
|
||||
const targetLanguage = (language) ? language : this.language;
|
||||
// return {...{}, ...this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T};
|
||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||
|
||||
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively translates the given object in-place
|
||||
* Translated values overwrite current values (destructive)
|
||||
*
|
||||
* @param language The language the thing is translated to
|
||||
* @param thing The thing that will be translated
|
||||
* @returns The thing translated
|
||||
*/
|
||||
public translateWholeThingDestructively(instance: any,
|
||||
language?: keyof SCTranslations<any>): any {
|
||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||
let nextInstance = instance;
|
||||
// Recursively call this function on all nested SCThings, arrays and objects
|
||||
Object.keys(nextInstance)
|
||||
.forEach((key) => {
|
||||
if (
|
||||
isThing((nextInstance as any)[key]) ||
|
||||
nextInstance[key] instanceof Array ||
|
||||
nextInstance[key] instanceof Object) {
|
||||
nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage);
|
||||
}
|
||||
});
|
||||
|
||||
// Spread variable translations given by the connector into thing
|
||||
if (typeof nextInstance.translations !== 'undefined') {
|
||||
if (typeof nextInstance.translations![targetLanguage] !== 'undefined') {
|
||||
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as typeof instance;
|
||||
}
|
||||
}
|
||||
// Spread known translations from meta classes into (partly) translated thing
|
||||
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
|
||||
|
||||
return nextInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* LRUCache class
|
||||
* Small last recently used cache intended to get used by SCThingTranslator
|
||||
*/
|
||||
class LRUCache<T> {
|
||||
/**
|
||||
* Map property that manages cached content
|
||||
*/
|
||||
private readonly entries: Map<string, T> = new Map<string, T>();
|
||||
|
||||
/**
|
||||
* Property representing cache maximum capacity
|
||||
*/
|
||||
private readonly maxEntries: number;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* // returns LRUCache instance with a maximum capacity of 500
|
||||
* new LRUCache(500);
|
||||
*/
|
||||
constructor(maxEntries: number) {
|
||||
this.maxEntries = maxEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes cache / removes all entries
|
||||
*/
|
||||
public flush() {
|
||||
this.entries.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content from cache by key
|
||||
*/
|
||||
public get(somethingOrKey: string): T | undefined;
|
||||
|
||||
/**
|
||||
* Get content from cache by another objects uid
|
||||
*/
|
||||
public get<U extends SCThing>(something: U): T | undefined;
|
||||
|
||||
/**
|
||||
* Get content from cache by key or by another objects uid
|
||||
*
|
||||
* @param somethingOrKey The key which maps to the cached content or an object for which content has been cached
|
||||
* @returns If available the content connected to the key or somethingOrKey.uid property
|
||||
*/
|
||||
public get<U extends SCThing>(somethingOrKey: string | U): T | undefined {
|
||||
let key: string;
|
||||
if (typeof somethingOrKey === 'string') {
|
||||
key = somethingOrKey;
|
||||
} else if (isThing(somethingOrKey)) {
|
||||
key = somethingOrKey.uid;
|
||||
} else {
|
||||
throw new Error(`Passed argument ${somethingOrKey} cannot be key in LRUCache`);
|
||||
}
|
||||
|
||||
const entry = this.entries.get(key);
|
||||
if (typeof entry !== 'undefined') {
|
||||
// LRU behavior
|
||||
this.entries.delete(key);
|
||||
this.entries.set(key, entry);
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Place content in cache by key
|
||||
*
|
||||
* @param key The key for which content should be cached
|
||||
* @param content The content that should be cached
|
||||
*/
|
||||
public put(key: string, content: T) {
|
||||
if (this.entries.size >= this.maxEntries) {
|
||||
// LRU behavior
|
||||
const keyToDelete = this.entries.keys()
|
||||
.next().value;
|
||||
this.entries.delete(keyToDelete);
|
||||
}
|
||||
this.entries.set(key, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place content in cache by another objects uid
|
||||
*
|
||||
* @param something The object that should be cached under something.uid
|
||||
*/
|
||||
public putObject<U extends SCThing>(something: U) {
|
||||
this.put(something.uid, (something as any) as T);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,51 +12,64 @@
|
||||
* 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 {SCThingMeta} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* An academic degree without references
|
||||
*/
|
||||
export interface SCAcademicDegreeWithoutReferences extends SCThing {
|
||||
export interface SCAcademicDegreeWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* The achievable academic degree
|
||||
*/
|
||||
academicDegree: SCGermanAcademicDegree;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* The achievable academic degree with academic field specification
|
||||
* (eg. Master of Science)
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
academicDegreewithField: string;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* The achievable academic degree with academic field specification
|
||||
* shorted (eg. M.Sc.).
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
academicDegreewithFieldShort: string;
|
||||
}
|
||||
|
||||
export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences {
|
||||
/**
|
||||
* An academic degree
|
||||
*/
|
||||
export interface SCAcademicDegree
|
||||
extends SCAcademicDegreeWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic degrees
|
||||
*/
|
||||
export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
|
||||
export class SCAcademicDegreeMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
academicDegree: 'Hochschulgrad',
|
||||
academicDegreewithField: 'Abschlussbezeichnungen',
|
||||
academicDegreewithFieldShort: 'Abschlussbezeichnungen (kurz)',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
academicDegree: 'academic degree',
|
||||
academicDegreewithField: 'acedemic degree and discipline',
|
||||
academicDegreewithFieldShort: 'acedemic degree and discipline (short)',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -65,7 +78,7 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
academicDegree: {
|
||||
'bachelor': 'Bachelor',
|
||||
'diploma': 'Diplom',
|
||||
@@ -78,7 +91,7 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati
|
||||
},
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -86,11 +99,12 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati
|
||||
/**
|
||||
* Types of (german) academic degrees
|
||||
*/
|
||||
export type SCGermanAcademicDegree = 'bachelor' |
|
||||
'diploma' |
|
||||
'doctor' |
|
||||
'licentiate' |
|
||||
'magister' |
|
||||
'master' |
|
||||
'master pupil' |
|
||||
'state examination' ;
|
||||
export type SCGermanAcademicDegree =
|
||||
'bachelor'
|
||||
| 'diploma'
|
||||
| 'doctor'
|
||||
| 'licentiate'
|
||||
| 'magister'
|
||||
| 'master'
|
||||
| 'master pupil'
|
||||
| 'state examination' ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,16 +12,20 @@
|
||||
* 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 {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* An academic term without references
|
||||
*/
|
||||
export interface SCAcademicTermWithoutReferences extends SCThing {
|
||||
export interface SCAcademicTermWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Short name of the academic term, using the given pattern
|
||||
*
|
||||
* @aggregatable
|
||||
* @keyword
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
@@ -46,31 +50,50 @@ export interface SCAcademicTermWithoutReferences extends SCThing {
|
||||
startDate: SCISO8601Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* An academic term
|
||||
*/
|
||||
export interface SCAcademicTerm
|
||||
extends SCAcademicTermWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic terms
|
||||
*/
|
||||
export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
export class SCAcademicTermWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
acronym: 'Akronym',
|
||||
endDate: 'Enddatum',
|
||||
eventsEndDate: 'Enddatum der Veranstaltungen',
|
||||
eventsStartDate: 'Startdatum der Veranstaltungen',
|
||||
startDate: 'Startdatum',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
acronym: 'acronym',
|
||||
endDate: 'end date',
|
||||
eventsEndDate: 'end date of events',
|
||||
eventsStartDate: 'start date of events',
|
||||
startDate: 'start date',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
@@ -20,13 +20,16 @@ import {SCISO8601Date} from '../types/Time';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './ThingThatCanBeOffered';
|
||||
|
||||
/**
|
||||
* A creative work without references
|
||||
*/
|
||||
export interface SCCreativeWorkWithoutReferences extends SCThing {
|
||||
export interface SCCreativeWorkWithoutReferences
|
||||
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* Date the creative work was published
|
||||
*/
|
||||
@@ -39,6 +42,9 @@ export interface SCCreativeWorkWithoutReferences extends SCThing {
|
||||
|
||||
/**
|
||||
* Keywords of the creative work
|
||||
*
|
||||
* @aggregatable
|
||||
* @keyword
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
@@ -51,7 +57,8 @@ export interface SCCreativeWorkWithoutReferences extends SCThing {
|
||||
/**
|
||||
* A creative work
|
||||
*/
|
||||
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
export interface SCCreativeWork
|
||||
extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
@@ -75,6 +82,8 @@ export interface SCCreativeWorkTranslatableProperties
|
||||
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Translation of the keywords of the creative work
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
keywords?: string[];
|
||||
}
|
||||
@@ -82,28 +91,43 @@ export interface SCCreativeWorkTranslatableProperties
|
||||
/**
|
||||
* Meta information about creative works
|
||||
*/
|
||||
export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
|
||||
export class SCCreativeWorkMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
|
||||
authors: 'Authoren',
|
||||
datePublished: 'Veröffentlichungsdatum',
|
||||
inLanguages: 'verfügbare Übersetzungen',
|
||||
keywords: 'Schlagwörter',
|
||||
publishers: 'Verleger',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
|
||||
authors: 'authors',
|
||||
datePublished: 'release date',
|
||||
inLanguages: 'available Languages',
|
||||
keywords: 'keywords',
|
||||
publishers: 'publishers',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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 {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCCatalogWithoutReferences} from '../things/Catalog';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCSemesterWithoutReferences} from '../things/Semester';
|
||||
@@ -22,11 +22,14 @@ import {SCCreativeWorkWithoutReferences} from './CreativeWork';
|
||||
/**
|
||||
* An event without references
|
||||
*/
|
||||
export interface SCEventWithoutReferences extends SCThing {
|
||||
export interface SCEventWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Maximum number of participants of the event
|
||||
*
|
||||
* A maximum number of people that can participate in the event.
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
maximumParticipants?: number;
|
||||
|
||||
@@ -34,6 +37,8 @@ export interface SCEventWithoutReferences extends SCThing {
|
||||
* Remaining attendee capacity of the event
|
||||
*
|
||||
* This number represents the remaining open spots.
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
remainingAttendeeCapacity?: number;
|
||||
}
|
||||
@@ -41,7 +46,8 @@ export interface SCEventWithoutReferences extends SCThing {
|
||||
/**
|
||||
* An event
|
||||
*/
|
||||
export interface SCEvent extends SCEventWithoutReferences {
|
||||
export interface SCEvent
|
||||
extends SCEventWithoutReferences, SCThing {
|
||||
/**
|
||||
* Academic terms that an event belongs to, e.g. semester(s).
|
||||
*/
|
||||
@@ -73,28 +79,43 @@ export interface SCEvent extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Meta information about events
|
||||
*/
|
||||
export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
export class SCEventMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
academicTerms: 'Semester',
|
||||
catalogs: 'Verzeichnis',
|
||||
creativeWorks: 'begleitende Werke',
|
||||
maximumParticipants: 'maximale Anzahl an Teilnehmern',
|
||||
organizers: 'Origanisatoren',
|
||||
performers: 'Vortragende',
|
||||
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
academicTerms: 'academic terms',
|
||||
catalogs: 'catalogs',
|
||||
creativeWorks: 'related material',
|
||||
maximumParticipants: 'maximum participants',
|
||||
organizers: 'organizers',
|
||||
performers: 'performers',
|
||||
remainingAttendeeCapacity: 'remaining attendee capacity',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCGeoInformation} from '../types/GeoInformation';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCPostalAddress} from '../types/PostalAddress';
|
||||
@@ -20,7 +20,8 @@ import {SCPostalAddress} from '../types/PostalAddress';
|
||||
/**
|
||||
* A place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferences extends SCThing {
|
||||
export interface SCPlaceWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Address of the place
|
||||
*/
|
||||
@@ -36,7 +37,9 @@ export interface SCPlaceWithoutReferences extends SCThing {
|
||||
|
||||
/**
|
||||
* Opening hours of the place
|
||||
*
|
||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||
* @keyword
|
||||
*/
|
||||
openingHours?: string;
|
||||
|
||||
@@ -44,38 +47,62 @@ export interface SCPlaceWithoutReferences extends SCThing {
|
||||
* Translated fields of a place
|
||||
*/
|
||||
translations?: SCTranslations<SCPlaceWithoutReferencesTranslatableProperties>;
|
||||
|
||||
}
|
||||
|
||||
export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* A place
|
||||
*/
|
||||
export interface SCPlace
|
||||
extends SCPlaceWithoutReferences, SCThing {
|
||||
/**
|
||||
* Translated fields of a place
|
||||
*/
|
||||
translations?: SCTranslations<SCPlaceWithoutReferencesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferencesTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Address of a place
|
||||
*/
|
||||
address?: SCPostalAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about creative works
|
||||
*/
|
||||
export class SCPlaceWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> {
|
||||
export class SCPlaceWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
address: 'Adresse',
|
||||
geo: 'Geoinformation',
|
||||
openingHours: 'Öffnungszeiten',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
address: 'address',
|
||||
geo: 'geographic information',
|
||||
openingHours: 'opening hours',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* Copyright (C) 2019 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.
|
||||
@@ -12,24 +12,27 @@
|
||||
* 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, SCThingUserOrigin} from '../Thing';
|
||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from '../Thing';
|
||||
|
||||
/**
|
||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||
*/
|
||||
export interface SCSaveableThingWithoutReferences extends SCThing {
|
||||
export interface SCSaveableThingWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||
*/
|
||||
export interface SCSaveableThing<T extends SCThingWithoutReferences>
|
||||
extends SCSaveableThingWithoutReferences, SCThing {
|
||||
/**
|
||||
* The contained data
|
||||
*/
|
||||
data: T;
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
origin: SCThingUserOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||
*/
|
||||
export interface SCSaveableThing<T extends SCThing> extends SCSaveableThingWithoutReferences {
|
||||
/**
|
||||
* The contained data
|
||||
*/
|
||||
data: T;
|
||||
}
|
||||
|
||||
@@ -19,22 +19,26 @@ import {SCInPlace} from '../types/Places';
|
||||
/**
|
||||
* A thing that is or happens in a place
|
||||
*/
|
||||
export interface SCThingInPlace extends SCThing, SCInPlace {}
|
||||
export interface SCThingInPlace
|
||||
extends SCThing, SCInPlace {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about thing in a place
|
||||
*/
|
||||
export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
|
||||
export class SCThingInPlaceMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
inPlace: 'Ort',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
inPlace: 'location',
|
||||
},
|
||||
};
|
||||
@@ -42,12 +46,12 @@ export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,53 +12,69 @@
|
||||
* 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 {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Types of payment that are accepted at a place.
|
||||
*/
|
||||
export type SCThingThatAcceptsPaymentsAcceptedPayments =
|
||||
'Cash'
|
||||
| 'Credit'
|
||||
| 'Cafeteria Card';
|
||||
'cash'
|
||||
| 'credit'
|
||||
| 'cafeteria card';
|
||||
|
||||
/**
|
||||
* A place without references that accepts payments
|
||||
* A thing without references that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThing {
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Accepted payments of the place
|
||||
*/
|
||||
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPayments
|
||||
extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta extends SCThingMeta implements
|
||||
SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> {
|
||||
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
paymentsAccepted: 'Bezahlmethoden',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
paymentsAccepted: 'accepted payment methods',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
paymentsAccepted: {
|
||||
'cafeteria card': 'Mensakarte',
|
||||
'cash': 'Bar',
|
||||
'credit': 'Kreditkarte',
|
||||
},
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
* 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 {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCInPlace} from '../types/Places';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
@@ -25,6 +25,9 @@ import {SCISO8601Date} from '../types/Time';
|
||||
export interface SCPriceGroup {
|
||||
/**
|
||||
* Default price of the thing
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
default: number;
|
||||
}
|
||||
@@ -32,19 +35,29 @@ export interface SCPriceGroup {
|
||||
/**
|
||||
* Price distinctions for academic context
|
||||
*/
|
||||
export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
export interface SCAcademicPriceGroup
|
||||
extends SCPriceGroup {
|
||||
/**
|
||||
* Price for employees
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
employee?: number;
|
||||
|
||||
/**
|
||||
* Price for guests
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
guest?: number;
|
||||
|
||||
/**
|
||||
* Price for students
|
||||
*
|
||||
* @sortable price
|
||||
* @float
|
||||
*/
|
||||
student?: number;
|
||||
}
|
||||
@@ -52,7 +65,8 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
/**
|
||||
* A thing without references that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedWithoutReferences extends SCThing {
|
||||
export interface SCThingThatCanBeOfferedWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Translations of a thing that can be offered
|
||||
*/
|
||||
@@ -63,11 +77,16 @@ export interface SCThingThatCanBeOfferedWithoutReferences extends SCThing {
|
||||
* A thing that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
|
||||
extends SCThing {
|
||||
extends SCThing, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* List of offers for that thing
|
||||
*/
|
||||
offers?: Array<SCThingThatCanBeOfferedOffer<T>>;
|
||||
|
||||
/**
|
||||
* Translations of a thing that can be offered
|
||||
*/
|
||||
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,6 +127,8 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Availability of an offer
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
'offers[].availability'?: string;
|
||||
}
|
||||
@@ -127,3 +148,55 @@ export type SCThingThatCanBeOfferedAvailability =
|
||||
| 'out of stock'
|
||||
| 'online only'
|
||||
| 'limited availability';
|
||||
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
|
||||
SCMetaTranslations<SCThingThatCanBeOffered<T>> {
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*/
|
||||
protected static _instance = new Map<string, unknown>();
|
||||
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
offers: 'Angebote',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
offers: 'offers',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
// tslint:disable:static-this
|
||||
/**
|
||||
* Function to retrieve typed singleton instance (including generics)
|
||||
*/
|
||||
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
|
||||
if (!SCThingThatCanBeOfferedMeta._instance.has(this.name)) {
|
||||
SCThingThatCanBeOfferedMeta._instance.set(this.name, new SCThingThatCanBeOfferedMeta<T>());
|
||||
}
|
||||
|
||||
return SCThingThatCanBeOfferedMeta._instance
|
||||
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
|
||||
}
|
||||
protected constructor() {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCMap} from '../types/Map';
|
||||
|
||||
@@ -20,13 +20,15 @@ import {SCMap} from '../types/Map';
|
||||
* A thing without references with categories
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
||||
* `T` should be a string literal union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
||||
*/
|
||||
export interface SCThingWithCategoriesWithoutReferences<T,
|
||||
U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThing {
|
||||
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Categories of a thing with categories
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
*/
|
||||
categories: T[];
|
||||
|
||||
@@ -43,10 +45,22 @@ export interface SCThingWithCategoriesWithoutReferences<T,
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing with categories
|
||||
*/
|
||||
export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThing, SCThingWithCategoriesWithoutReferences<T, U> {
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a thing with categories
|
||||
*/
|
||||
export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
|
||||
export interface SCThingWithCategoriesTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* translations of the categories of a thing with categories
|
||||
*/
|
||||
@@ -61,67 +75,92 @@ export interface SCThingWithCategoriesTranslatableProperties extends SCThingTran
|
||||
export interface SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific alternate names of a thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
|
||||
/**
|
||||
* Category specific description of a thing
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Category specific image of a thing
|
||||
* URL of a category specific image of a thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Category specific name of a thing
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Category specific URL of a thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
* It intentionally does not extend the SCThingMeta implementation to be able to include generics.
|
||||
*/
|
||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U> implements
|
||||
SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||
|
||||
protected static _instance: SCThingMeta;
|
||||
/**
|
||||
* Instance
|
||||
*/
|
||||
protected static _instance = new Map<string, unknown>();
|
||||
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
categories: 'Kategorien',
|
||||
categorySpecificValues: 'besondere Kategorien',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
categories: 'categories',
|
||||
categorySpecificValues: 'category with specific values',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
// tslint:disable:static-this
|
||||
/**
|
||||
* Function to retrieve typed singleton instance (including generics)
|
||||
*/
|
||||
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
|
||||
return this._instance || (this._instance = new this<T, U>());
|
||||
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
|
||||
SCThingWithCategoriesWithoutReferencesMeta._instance
|
||||
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
|
||||
}
|
||||
|
||||
return SCThingWithCategoriesWithoutReferencesMeta._instance
|
||||
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
|
||||
}
|
||||
|
||||
protected constructor() {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <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>;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
|
||||
@@ -12,7 +12,16 @@
|
||||
* 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 {
|
||||
BAD_GATEWAY,
|
||||
BAD_REQUEST, CONFLICT, INTERNAL_SERVER_ERROR,
|
||||
METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, NOT_FOUND,
|
||||
REQUEST_TOO_LONG,
|
||||
TOO_MANY_REQUESTS,
|
||||
UNSUPPORTED_MEDIA_TYPE,
|
||||
} from 'http-status-codes';
|
||||
import {ValidationError} from 'jsonschema';
|
||||
import {SCPluginMetaData} from '../routes/plugin/PluginRegisterRequest';
|
||||
|
||||
/**
|
||||
* A generic error that can be returned by the backend if somethings fails during the processing of a request
|
||||
@@ -23,7 +32,7 @@ export interface SCErrorResponse extends Error {
|
||||
/**
|
||||
* Additional data that describes the error
|
||||
*/
|
||||
additionalData?: any;
|
||||
additionalData?: unknown;
|
||||
|
||||
/**
|
||||
* HTTP status code to return this error with
|
||||
@@ -48,7 +57,7 @@ export abstract class SCError implements SCErrorResponse {
|
||||
* @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) {
|
||||
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
|
||||
// generate stacktrace if needed
|
||||
if (stack) {
|
||||
this.stack = (new Error()).stack;
|
||||
@@ -72,7 +81,7 @@ export class SCValidationErrorResponse extends SCError {
|
||||
* @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);
|
||||
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
|
||||
this.additionalData = errors;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +96,7 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('UnsupportedMediaTypeError', 'Unsupported media type', 415, stack);
|
||||
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +110,7 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||
* @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);
|
||||
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +120,11 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCRequestBodyTooLargeErrorResponse
|
||||
*
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('RequestBodyTooLargeError', 'The request body is too large.', 413, stack);
|
||||
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +138,12 @@ export class SCTooManyRequestsErrorResponse extends SCError {
|
||||
* @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);
|
||||
super(
|
||||
'TooManyRequestsError',
|
||||
'Too many requests. You can not submit more than 5 queries an once',
|
||||
TOO_MANY_REQUESTS,
|
||||
stack,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +157,7 @@ export class SCNotFoundErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('NotFoundError', 'Resource not found', 404, stack);
|
||||
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +173,7 @@ export class SCParametersNotAcceptable extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('ParametersNotAcceptable', message, 406, stack);
|
||||
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,13 +184,23 @@ export class SCParametersNotAcceptable extends SCError {
|
||||
*/
|
||||
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a PluginAlreadyRegisteredError
|
||||
* Meta data of a registered plugin, which is in a conflict with the plugin we want to register.
|
||||
* If the stack is disabled this is not set for security reasons
|
||||
*/
|
||||
additionalData?: SCPluginMetaData;
|
||||
|
||||
/**
|
||||
* Create a SCPluginAlreadyRegisteredError
|
||||
*
|
||||
* @param message contains potential differences in other parameters outside of the name
|
||||
* @param message Provide further information why an already registered plugin matches the one we want to register
|
||||
* @param plugin Provides meta data of a registered plugin, which is in a conflict with the plugin we want to register
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('PluginRegisteringFailedError', message, 409, stack);
|
||||
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
|
||||
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
|
||||
if (stack) {
|
||||
this.additionalData = plugin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,26 +215,7 @@ export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('PluginRegisteringFailedError', message, 500, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned whenever there is a plugin request that is supposed to register a route, that is already
|
||||
* registered
|
||||
* This usually indicates that two **different** plugins use the same route.
|
||||
*/
|
||||
export class SCPluginRouteAlreadyRegisteredErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a PluginRouteAlreadyRegisteredError
|
||||
*
|
||||
* @param registeredName The name by the plugin that has already registered the route previously
|
||||
* @param registeredUrl The URL by the plugin that has already registered the route previously
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(registeredName: string, registeredUrl: string, stack?: boolean) {
|
||||
super('PluginRouteAlreadyRegisteredError',
|
||||
`Already registered by "${registeredName}" under URL "${registeredUrl}".`, 409, stack);
|
||||
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +230,7 @@ export class SCSyntaxErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('SyntaxError', message, 400, stack);
|
||||
super('SyntaxError', message, BAD_REQUEST, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,11 +247,11 @@ export class SCInternalServerErrorResponse extends SCError {
|
||||
* Create a SCInternalServerErrorResponse
|
||||
*
|
||||
* @param err Internal server error
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
* @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);
|
||||
constructor(err?: Error, stack = false) {
|
||||
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
|
||||
|
||||
if (stack) {
|
||||
this.additionalData = err;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {
|
||||
SCInternalServerErrorResponse,
|
||||
@@ -47,7 +48,7 @@ export class SCIndexRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCIndexRequest';
|
||||
this.responseBodyName = 'SCIndexResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -21,7 +21,13 @@ import {SCBackendConfiguration} from '../../../types/config/Backend';
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCIndexResponse {
|
||||
/**
|
||||
* @see SCAppConfiguration
|
||||
*/
|
||||
app: SCAppConfiguration;
|
||||
|
||||
/**
|
||||
* @see SCBackendConfiguration
|
||||
*/
|
||||
backend: SCBackendConfiguration;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {SCThings} from '../../../../Classes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
||||
import {
|
||||
@@ -53,7 +54,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
||||
};
|
||||
this.requestBodyName = 'SCThingUpdateRequest';
|
||||
this.responseBodyName = 'SCThingUpdateResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/:TYPE/:UID';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {SCUuid} from '../../../types/UUID';
|
||||
import {
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
|
||||
/**
|
||||
* Request to check the availability of books
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
|
||||
@@ -80,7 +82,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/bookAvailability';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -16,6 +16,7 @@ import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/
|
||||
|
||||
/**
|
||||
* List of availabilities of a book
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {SCThingType} from '../../../Thing';
|
||||
import {SCISO8601Date} from '../../../types/Time';
|
||||
@@ -78,7 +79,7 @@ export class SCBulkRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCBulkRequest';
|
||||
this.responseBodyName = 'SCBulkResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/bulk';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {CREATED} from 'http-status-codes';
|
||||
import {SCThings} from '../../../../Classes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
||||
import {
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
|
||||
/**
|
||||
* Request to add a thing to a bulk
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export type SCBulkAddRequest = SCThings;
|
||||
@@ -51,7 +53,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
|
||||
};
|
||||
this.requestBodyName = 'SCBulkAddRequest';
|
||||
this.responseBodyName = 'SCBulkAddResponse';
|
||||
this.statusCodeSuccess = 201;
|
||||
this.statusCodeSuccess = CREATED;
|
||||
this.urlFragment = '/bulk/:UID';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
/**
|
||||
* Response to a request to add a thing to a bulk
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkAddResponse {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {NO_CONTENT} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
||||
import {
|
||||
SCInternalServerErrorResponse,
|
||||
@@ -25,6 +26,7 @@ import {
|
||||
|
||||
/**
|
||||
* Request to change the bulk state to done (close the bulk process)
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkDoneRequest {
|
||||
@@ -51,7 +53,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
|
||||
};
|
||||
this.requestBodyName = 'SCBulkDoneRequest';
|
||||
this.responseBodyName = 'SCBulkDoneResponse';
|
||||
this.statusCodeSuccess = 204;
|
||||
this.statusCodeSuccess = NO_CONTENT;
|
||||
this.urlFragment = '/bulk/:UID/done';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
/**
|
||||
* Response to a request to change the state of a bulk to done
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkDoneResponse {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {NO_CONTENT} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {SCMessage} from '../../../things/Message';
|
||||
import {
|
||||
@@ -52,7 +53,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCFeedbackRequest';
|
||||
this.responseBodyName = 'SCFeedbackResponse';
|
||||
this.statusCodeSuccess = 204;
|
||||
this.statusCodeSuccess = NO_CONTENT;
|
||||
this.urlFragment = '/feedback';
|
||||
}
|
||||
}
|
||||
@@ -74,7 +75,7 @@ export interface SCFeedbackRequestMetaData {
|
||||
/**
|
||||
* Scope/app state at feedback invocation
|
||||
*/
|
||||
scope: any;
|
||||
scope: unknown;
|
||||
|
||||
/**
|
||||
* Whether or not the feedback is sendable
|
||||
@@ -84,7 +85,7 @@ export interface SCFeedbackRequestMetaData {
|
||||
/**
|
||||
* App state that feedback was invoked from
|
||||
*/
|
||||
state: any;
|
||||
state: unknown;
|
||||
|
||||
/**
|
||||
* User agent
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {Schema} from 'jsonschema';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {
|
||||
@@ -19,7 +20,6 @@ import {
|
||||
SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable,
|
||||
SCPluginAlreadyRegisteredErrorResponse,
|
||||
SCPluginRegisteringFailedErrorResponse,
|
||||
SCPluginRouteAlreadyRegisteredErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
} from '../../errors/ErrorResponse';
|
||||
@@ -29,40 +29,27 @@ import {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export type SCPluginRegisterRequest = AddPlugin | RemovePlugin;
|
||||
interface AddPlugin {
|
||||
export type SCPluginRegisterRequest = SCPluginAdd | SCPluginRemove;
|
||||
|
||||
/**
|
||||
* Plugin request for adding a plugin registration to the backend
|
||||
*/
|
||||
export interface SCPluginAdd {
|
||||
/**
|
||||
* The desired action, so whether the plugin should be added or removed
|
||||
*/
|
||||
action: 'add';
|
||||
|
||||
/**
|
||||
* The address of the plugin
|
||||
* Plugin information needed for its registration
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* The name of the plugin
|
||||
* Just for debugging purposes, to more easily identify conflicts.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* How the requests of the plugin looks like, a JSON schema for validation
|
||||
*/
|
||||
pluginRequestSchema: Schema;
|
||||
|
||||
/**
|
||||
* How the responses of the plugin looks like, a JSON schema for validation
|
||||
*/
|
||||
pluginResponseSchema: Schema;
|
||||
|
||||
/**
|
||||
* The desired route, for example /feedback.
|
||||
*/
|
||||
route: string;
|
||||
plugin: SCPluginMetaData;
|
||||
}
|
||||
interface RemovePlugin {
|
||||
|
||||
/**
|
||||
* Plugin request for removing a plugin registration from the backend
|
||||
*/
|
||||
export interface SCPluginRemove {
|
||||
/**
|
||||
* The desired action, so whether the plugin should be added or removed
|
||||
*/
|
||||
@@ -74,6 +61,36 @@ interface RemovePlugin {
|
||||
route: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin meta data - contains needed information for a plugin registration
|
||||
*/
|
||||
export interface SCPluginMetaData {
|
||||
/**
|
||||
* The address of the plugin, to which the backend routes the requests
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* The name of the plugin (for debugging purposes, to more easily identify conflicts)
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* How the requests of the plugin looks like, a JSON schema for validation
|
||||
*/
|
||||
requestSchema: Schema;
|
||||
|
||||
/**
|
||||
* How the responses of the plugin looks like, a JSON schema for validation
|
||||
*/
|
||||
responseSchema: Schema;
|
||||
|
||||
/**
|
||||
* The desired route, for example /feedback.
|
||||
*/
|
||||
route: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route to register plugins
|
||||
*/
|
||||
@@ -85,16 +102,14 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
||||
SCMethodNotAllowedErrorResponse,
|
||||
SCParametersNotAcceptable,
|
||||
SCPluginAlreadyRegisteredErrorResponse,
|
||||
SCPluginRouteAlreadyRegisteredErrorResponse,
|
||||
SCPluginRegisteringFailedErrorResponse,
|
||||
SCPluginRouteAlreadyRegisteredErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
];
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/plugin/register';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {SCMap} from '../../../types/Map';
|
||||
import {
|
||||
@@ -54,7 +55,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCMultiSearchRequest';
|
||||
this.responseBodyName = 'SCMultiSearchResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/search/multi';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {OK} from 'http-status-codes';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {SCSearchContext} from '../../../types/config/Backend';
|
||||
import {SCSearchFilter} from '../../../types/filters/Abstract';
|
||||
@@ -85,7 +86,7 @@ export class SCSearchRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCSearchRequest';
|
||||
this.responseBodyName = 'SCSearchResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/search';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -27,15 +28,19 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
*/
|
||||
export interface SCAcademicEventWithoutReferences
|
||||
extends SCEventWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Majors of the academic event that this event belongs to
|
||||
*
|
||||
* @aggregatable
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Original unmapped category from the source of the academic event
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
originalCategory?: string;
|
||||
|
||||
@@ -54,8 +59,11 @@ export interface SCAcademicEventWithoutReferences
|
||||
* An academic event
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences {
|
||||
export interface SCAcademicEvent
|
||||
extends SCEvent, SCAcademicEventWithoutReferences,
|
||||
SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
*/
|
||||
@@ -75,6 +83,7 @@ export type SCAcademicEventCategories =
|
||||
| 'seminar'
|
||||
| 'integrated course'
|
||||
| 'written exam'
|
||||
| 'oral exam'
|
||||
| 'tutorial'
|
||||
| 'project'
|
||||
| 'colloquium'
|
||||
@@ -92,11 +101,15 @@ export interface SCAcademicEventTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* Translations of the majors of the academic event that this event belongs to
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Translation of the original unmapped category from the source of the academic event
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
originalCategory?: string;
|
||||
}
|
||||
@@ -104,37 +117,67 @@ export interface SCAcademicEventTranslatableProperties
|
||||
/**
|
||||
* Meta information about academic events
|
||||
*/
|
||||
export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicEvent> {
|
||||
export class SCAcademicEventMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCAcademicEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCEventMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
majors: 'Hauptfächer',
|
||||
originalCategory: 'ursprüngliche Kategorie',
|
||||
},
|
||||
en: {
|
||||
... SCEventMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
majors: 'majors',
|
||||
originalCategory: 'original category',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'colloquium': 'Kolloquium',
|
||||
'course': 'Kurs',
|
||||
'excursion': 'Exkursion',
|
||||
'integrated course': '',
|
||||
'introductory class': 'Einführungsveranstaltung',
|
||||
'lecture': 'Vorlesung',
|
||||
'oral exam': 'mündliche Prüfung',
|
||||
'practicum': 'Praktikum',
|
||||
'practicum introduction': 'Einführungspraktikum',
|
||||
'project': 'Projekt',
|
||||
'seminar': 'Seminar',
|
||||
'special': 'Sonderveranstalltung',
|
||||
'tutorial': 'Tutorium',
|
||||
'written exam': 'Schriftilche Prüfung',
|
||||
},
|
||||
type: 'akademische Veranstaltung',
|
||||
},
|
||||
en: {
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.AcademicEvent,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from '../base/CreativeWork';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -32,10 +33,11 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
*/
|
||||
export interface SCArticleWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Article itself as markdown
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
articleBody: string;
|
||||
|
||||
@@ -54,8 +56,11 @@ export interface SCArticleWithoutReferences
|
||||
* An article
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences {
|
||||
export interface SCArticle
|
||||
extends SCCreativeWork, SCArticleWithoutReferences,
|
||||
SCThingWithCategories<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
@@ -79,6 +84,8 @@ export interface SCArticleTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of the article itself as markdown
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
articleBody?: string[];
|
||||
}
|
||||
@@ -86,37 +93,55 @@ export interface SCArticleTranslatableProperties
|
||||
/**
|
||||
* Meta information about an article
|
||||
*/
|
||||
export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCArticle> {
|
||||
export class SCArticleMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCArticle> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
articleBody: 'Artikelinhalt',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
articleBody: 'article body',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'unipedia': 'Unipedia',
|
||||
},
|
||||
type: 'Artikel',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Article,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -26,19 +26,26 @@ import {SCPersonWithoutReferences} from './Person';
|
||||
/**
|
||||
* A book without references
|
||||
*/
|
||||
export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
export interface SCBookWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* Edition of a book
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
bookEdition?: string;
|
||||
|
||||
/**
|
||||
* ISBN of a book
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
isbn: string;
|
||||
|
||||
/**
|
||||
* Number of pages of a book
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
numberOfPages?: number;
|
||||
|
||||
@@ -57,8 +64,10 @@ export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences
|
||||
* A book
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCBook extends SCCreativeWork, SCBookWithoutReferences {
|
||||
export interface SCBook
|
||||
extends SCCreativeWork, SCBookWithoutReferences {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
@@ -82,6 +91,8 @@ export interface SCBookTranslatableFields
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of an edition of a book
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
bookEdition?: string;
|
||||
}
|
||||
@@ -95,23 +106,33 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
bookEdition: 'Buchausgabe',
|
||||
isbn: 'ISBN',
|
||||
numberOfPages: 'Seitenzahl',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
bookEdition: 'book edition',
|
||||
isbn: 'ISBN',
|
||||
numberOfPages: 'number of pages',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'Buch',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Book,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,11 +13,13 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCPlace,
|
||||
SCPlaceWithoutReferences,
|
||||
SCPlaceWithoutReferencesMeta,
|
||||
SCPlaceWithoutReferencesTranslatableProperties,
|
||||
} from '../base/Place';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -37,16 +39,20 @@ export type SCBuildingCategories =
|
||||
| 'restroom';
|
||||
|
||||
export interface SCBuildingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Categories of a building
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
*/
|
||||
categories: SCBuildingCategories[];
|
||||
|
||||
/**
|
||||
* List of floor names of the place
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
floors?: string[];
|
||||
|
||||
@@ -65,8 +71,11 @@ export interface SCBuildingWithoutReferences
|
||||
* A building
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCBuilding extends SCBuildingWithoutReferences {
|
||||
export interface SCBuilding
|
||||
extends SCBuildingWithoutReferences, SCPlace,
|
||||
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a building
|
||||
*/
|
||||
@@ -79,39 +88,57 @@ export interface SCBuilding extends SCBuildingWithoutReferences {
|
||||
}
|
||||
|
||||
export interface SCBuildingTranslatableProperties
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* @see SCBuilding.floors
|
||||
*/
|
||||
floors?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SCBuilding> {
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCBuildingMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCBuilding> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldTranslations.de,
|
||||
floors: 'Etagen',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldTranslations.en,
|
||||
floors: 'floors',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
@@ -125,9 +152,13 @@ export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
type: 'Gebäude',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Building,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,23 +14,26 @@
|
||||
*/
|
||||
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A catalog without references
|
||||
*/
|
||||
export interface SCCatalogWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
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.
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
level: number;
|
||||
|
||||
@@ -43,9 +46,12 @@ export interface SCCatalogWithoutReferences
|
||||
/**
|
||||
* A catalog
|
||||
*
|
||||
* @validatable
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCatalog extends SCCatalogWithoutReferences {
|
||||
export interface SCCatalog
|
||||
extends SCCatalogWithoutReferences, SCThing,
|
||||
SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Academic term that a catalog belongs to (e.g. semester)
|
||||
*/
|
||||
@@ -61,42 +67,67 @@ export interface SCCatalog extends SCCatalogWithoutReferences {
|
||||
*/
|
||||
superCatalogs?: SCCatalogWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a catalog
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a catalog
|
||||
*/
|
||||
type: SCThingType.Catalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Catalog meta data
|
||||
*/
|
||||
export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
|
||||
/**
|
||||
* Catalog meta data
|
||||
*/
|
||||
export class SCCatalogMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
academicTerm: 'Semester',
|
||||
level: 'Ebene',
|
||||
superCatalog: 'übergeordnetes Verzeichniss',
|
||||
superCatalogs: 'übergeordnete Verzeichnisse',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
academicTerm: 'academic term',
|
||||
level: 'level',
|
||||
superCatalog: 'parent catalog',
|
||||
superCatalogs: 'parent catalogs',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'university events': 'Universitätsveranstaltung',
|
||||
},
|
||||
type: 'Verzeichnis',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Catalog,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -12,23 +12,24 @@
|
||||
* 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 {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree';
|
||||
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from '../base/AcademicDegree';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCDateSeriesWithoutReferences} from './DateSeries';
|
||||
import {SCOrganization} from './Organization';
|
||||
import {SCOrganizationWithoutReferences} from './Organization';
|
||||
|
||||
/**
|
||||
* A course of studies without references
|
||||
*/
|
||||
export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
export interface SCCourseOfStudiesWithoutReferences
|
||||
extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The main language in which the course of studies
|
||||
* is beeing offered
|
||||
@@ -37,6 +38,8 @@ export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree,
|
||||
|
||||
/**
|
||||
* Actual major of the course of studies (eg. physics)
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
major: string;
|
||||
|
||||
@@ -65,19 +68,20 @@ export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree,
|
||||
* A course of studies
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
export interface SCCourseOfStudies
|
||||
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
|
||||
/**
|
||||
* The department that manages the course of studies
|
||||
*/
|
||||
department: SCOrganization;
|
||||
department: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* The secretary that administers requests and
|
||||
* questions concerning the course of studies
|
||||
*/
|
||||
secretary: SCOrganization;
|
||||
secretary: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Dates at which the course of studies is planned to start
|
||||
@@ -85,7 +89,7 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences,
|
||||
startDates?: SCDateSeriesWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
* Translated fields of a course of studies
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
|
||||
|
||||
@@ -95,23 +99,49 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences,
|
||||
type: SCThingType.CourseOfStudies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a course of studies
|
||||
*/
|
||||
export interface SCCourseOfStudiesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a course of studies
|
||||
*/
|
||||
export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslations<SCCourseOfStudies> {
|
||||
export class SCCourseOfStudiesMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCCourseOfStudies> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCAcademicDegreeMeta.getInstance().fieldTranslations.de,
|
||||
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
|
||||
.fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
department: 'Fachbereich',
|
||||
mainLanguage: 'Unterrichtssprache',
|
||||
major: 'Studienfach',
|
||||
mode: 'Studiengangsart',
|
||||
secretary: 'Sekretariat',
|
||||
startDates: 'Startdatum',
|
||||
timeMode: 'Zeitmodell',
|
||||
},
|
||||
en: {
|
||||
...SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
|
||||
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
|
||||
.fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
department: 'department',
|
||||
mainLanguage: 'main language',
|
||||
major: 'major',
|
||||
mode: 'mode',
|
||||
secretary: 'secretary',
|
||||
startDates: 'start dates',
|
||||
timeMode: 'time mode',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -123,7 +153,11 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
|
||||
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
|
||||
modes: {
|
||||
combination: 'Kombinationsstudiengang',
|
||||
dual: 'Dualer Studiengang',
|
||||
'double-degree': 'Doppelstudium',
|
||||
dual: 'duales Studium',
|
||||
standard: 'Studium',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'Vollzeitstudiengang',
|
||||
parttime: 'Teilzeitstudiengang',
|
||||
},
|
||||
@@ -131,11 +165,16 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
|
||||
},
|
||||
en: {
|
||||
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
|
||||
academicDegree: 'Hochschulabschluss',
|
||||
department: 'Fachbereich',
|
||||
major: 'Studienfach',
|
||||
modes: 'Studiengangsarten',
|
||||
secretary: 'Sekretariat',
|
||||
modes: {
|
||||
combination: 'combination course of studies',
|
||||
'double-degree': 'double degree course of studies',
|
||||
dual: 'dual course of studies',
|
||||
standard: 'course of studies',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'full-time',
|
||||
parttime: 'part-time',
|
||||
},
|
||||
type: SCThingType.CourseOfStudies,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date, SCISO8601Duration} from '../types/Time';
|
||||
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
|
||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
import {SCSportCourseWithoutReferences} from './SportCourse';
|
||||
@@ -29,9 +30,12 @@ import {SCSportCourseWithoutReferences} from './SportCourse';
|
||||
/**
|
||||
* Price groups for sport courses
|
||||
*/
|
||||
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
export interface SCSportCoursePriceGroup
|
||||
extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* Price for alumnis
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
alumni?: number;
|
||||
}
|
||||
@@ -39,7 +43,8 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* A date without references
|
||||
*/
|
||||
export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
export interface SCDateSeriesWithoutReferences
|
||||
extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* Dates of the date series that are initially planned to be held
|
||||
*/
|
||||
@@ -57,6 +62,8 @@ export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWi
|
||||
|
||||
/**
|
||||
* Frequency of the date series
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
frequency: string;
|
||||
|
||||
@@ -75,10 +82,12 @@ export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWi
|
||||
* A date series
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDateSeries extends SCDateSeriesWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
export interface SCDateSeries
|
||||
extends SCDateSeriesWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
/**
|
||||
* Event to which the date series belongs
|
||||
*/
|
||||
@@ -104,16 +113,36 @@ export interface SCDateSeries extends SCDateSeriesWithoutReferences,
|
||||
/**
|
||||
* Meta information about a date series
|
||||
*/
|
||||
export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<SCDateSeries> {
|
||||
export class SCDateSeriesMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDateSeries> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
event: 'Event',
|
||||
exceptions: 'Ausnahmen',
|
||||
frequency: 'Frequenz',
|
||||
performers: 'Vortragende',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldTranslations.en,
|
||||
dates: 'dates',
|
||||
duration: 'duration',
|
||||
event: 'event',
|
||||
exceptions: 'exceptions',
|
||||
frequency: 'frequency',
|
||||
performers: 'performers',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -122,14 +151,17 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
frequency: 'Wiederholung',
|
||||
type: 'Wiederholungreihe',
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'Terminserie',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.DateSeries,
|
||||
},
|
||||
};
|
||||
@@ -140,5 +172,8 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
*/
|
||||
export interface SCDateSeriesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* @see SCDateSeriesWithoutReferences.frequency
|
||||
*/
|
||||
frequency?: string;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,14 +14,15 @@
|
||||
*/
|
||||
import * as jsonpatch from 'json-patch';
|
||||
import {SCThingsWithoutDiff} from '../Classes';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* A diff without references
|
||||
*/
|
||||
export interface SCDiffWithoutReferences extends SCThing {
|
||||
export interface SCDiffWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Action of the diff
|
||||
*/
|
||||
@@ -47,8 +48,10 @@ export interface SCDiffWithoutReferences extends SCThing {
|
||||
* A diff
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDiff extends SCDiffWithoutReferences {
|
||||
export interface SCDiff
|
||||
extends SCDiffWithoutReferences, SCThing {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
@@ -63,32 +66,43 @@ export interface SCDiff extends SCDiffWithoutReferences {
|
||||
/**
|
||||
* Meta information about a diff
|
||||
*/
|
||||
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
|
||||
export class SCDiffMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDiff> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
action: 'Aktion',
|
||||
changes: 'Änderungen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
object: 'Objekt',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
action: 'action',
|
||||
changes: 'changes',
|
||||
dateCreated: 'date created',
|
||||
object: 'object',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
action: {
|
||||
'changed': 'geändert',
|
||||
'removed': 'gelöscht',
|
||||
},
|
||||
type: 'Unterschied',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Diff,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -26,19 +27,26 @@ import {
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
|
||||
|
||||
/**
|
||||
* A dish without references
|
||||
*/
|
||||
export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
export interface SCDishWithoutReferences
|
||||
extends SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
additives?: string[];
|
||||
|
||||
/**
|
||||
* Category of the dish
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
*/
|
||||
categories: SCDishCategories[];
|
||||
|
||||
@@ -67,9 +75,11 @@ export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutR
|
||||
* A dish
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDish extends SCDishWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
export interface SCDish
|
||||
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCThingWithCategories<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
|
||||
*/
|
||||
@@ -99,12 +109,16 @@ export interface SCDishTranslatableProperties
|
||||
*/
|
||||
export interface SCDishCharacteristic {
|
||||
/**
|
||||
* URL to the image of the characteristic
|
||||
* URL of an image of the characteristic
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Name of the characteristic
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
@@ -128,36 +142,50 @@ export type SCDishCategories =
|
||||
export interface SCNutritionInformation {
|
||||
/**
|
||||
* Number of calories contained (in kcal)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
calories?: number;
|
||||
|
||||
/**
|
||||
* Content of carbohydrates (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
carbohydrateContent?: number;
|
||||
|
||||
/**
|
||||
* Content of fat (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
fatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of proteins (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
proteinContent?: number;
|
||||
|
||||
/**
|
||||
* Content of salt (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
saltContent?: number;
|
||||
|
||||
/**
|
||||
* Content of saturated fat (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
saturatedFatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of sugar (in grams)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
sugarContent?: number;
|
||||
}
|
||||
@@ -165,18 +193,36 @@ export interface SCNutritionInformation {
|
||||
/**
|
||||
* Meta information about a dish
|
||||
*/
|
||||
export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish> {
|
||||
export class SCDishMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDish> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
additives: 'Zusatzstoffe',
|
||||
characteristics: 'Merkmale',
|
||||
dishAddOns: 'Beilagen',
|
||||
nutrition: 'Nährwertangaben',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.en,
|
||||
additives: 'additives',
|
||||
characteristics: 'characteristics',
|
||||
dishAddOns: 'side dishes',
|
||||
nutrition: 'nutrition information',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -185,8 +231,12 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.de,
|
||||
categories: {
|
||||
appetizer: 'Vorspeise',
|
||||
dessert: 'Nachtisch',
|
||||
@@ -198,8 +248,12 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
|
||||
type: 'Essen',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Dish,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -40,16 +40,19 @@ export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences
|
||||
/**
|
||||
* A favorite without references
|
||||
*/
|
||||
export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences {
|
||||
|
||||
export interface SCFavoriteWithoutReferences
|
||||
extends SCSaveableThingWithoutReferences {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* A favorite
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCFavorite extends SCSaveableThing<SCFavoriteDataTypes> {
|
||||
export interface SCFavorite
|
||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
@@ -59,5 +62,6 @@ export interface SCFavorite extends SCSaveableThing<SCFavoriteDataTypes> {
|
||||
/**
|
||||
* Meta information about a favorite
|
||||
*/
|
||||
export class SCFavoriteMeta extends SCThingMeta {
|
||||
export class SCFavoriteMeta
|
||||
extends SCThingMeta {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,9 +12,10 @@
|
||||
* 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-next-line:no-implicit-dependencies
|
||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingType} from '../Thing';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from './Room';
|
||||
@@ -22,16 +23,19 @@ import {SCRoomWithoutReferences} from './Room';
|
||||
/**
|
||||
* A floor without references
|
||||
*/
|
||||
export interface SCFloorWithoutReferences extends SCThing {
|
||||
export interface SCFloorWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
floorName: string;
|
||||
|
||||
/**
|
||||
* Floor plan
|
||||
*/
|
||||
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
|
||||
plan: SCFloorFeatureCollectionWithPlaces<LineString>;
|
||||
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
@@ -48,8 +52,10 @@ export interface SCFloorWithoutReferences extends SCThing {
|
||||
* A floor
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
export interface SCFloor
|
||||
extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
@@ -64,19 +70,19 @@ export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* A feature collection
|
||||
*/
|
||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
|
||||
extends FeatureCollection<T, P> {
|
||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
|
||||
extends FeatureCollection<T> {
|
||||
/**
|
||||
* Features of the collection
|
||||
*/
|
||||
features: Array<SCFloorFeatureWithPlace<T, P>>;
|
||||
features: Array<SCFloorFeatureWithPlace<T>>;
|
||||
}
|
||||
|
||||
/***
|
||||
* A feature with a place
|
||||
*/
|
||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
|
||||
extends Feature<T, P> {
|
||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
|
||||
extends Feature<T> {
|
||||
/**
|
||||
* The place of the feature
|
||||
*/
|
||||
@@ -86,9 +92,12 @@ export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
|
||||
/**
|
||||
* Translatable properties of a floor
|
||||
*/
|
||||
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
|
||||
export interface SCFloorTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the floor name
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
floorName?: string;
|
||||
}
|
||||
@@ -96,29 +105,39 @@ export interface SCFloorTranslatableProperties extends SCThingTranslatableProper
|
||||
/**
|
||||
* Meta information about floors
|
||||
*/
|
||||
export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFloor> {
|
||||
export class SCFloorMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCFloor> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
plan: 'Grundriss',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
floorName: 'floor name',
|
||||
plan: 'plan',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'Etage',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Floor,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -26,7 +26,8 @@ import {SCISO8601Date} from '../types/Time';
|
||||
/**
|
||||
* A message without references
|
||||
*/
|
||||
export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
export interface SCMessageWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* Audience of the message
|
||||
*/
|
||||
@@ -39,8 +40,10 @@ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferen
|
||||
|
||||
/**
|
||||
* Message itself
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
message: string;
|
||||
messageBody: string;
|
||||
|
||||
/**
|
||||
* Translated fields of a message
|
||||
@@ -57,8 +60,10 @@ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferen
|
||||
* A message
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
export interface SCMessage
|
||||
extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
@@ -85,36 +90,55 @@ export interface SCMessageTranslatableProperties
|
||||
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Message itself
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
message?: string;
|
||||
messageBody?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about messages
|
||||
*/
|
||||
export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
|
||||
export class SCMessageMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCMessage> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
audiences: 'Zielgruppen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
messageBody: 'Nachrichteninhalt',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
audiences: 'audiences',
|
||||
dateCreated: 'date created',
|
||||
messageBody: 'message body',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
audiences: {
|
||||
'employees': 'Angestellte',
|
||||
'guests': 'Gäste',
|
||||
'students': 'Studenten',
|
||||
},
|
||||
type: 'Nachricht',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,13 +12,15 @@
|
||||
* 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, SCThingType} from '../Thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* An organization without references
|
||||
*/
|
||||
export interface SCOrganizationWithoutReferences extends SCThing {
|
||||
export interface SCOrganizationWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
@@ -29,8 +31,10 @@ export interface SCOrganizationWithoutReferences extends SCThing {
|
||||
* An organization
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
export interface SCOrganization
|
||||
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
@@ -40,5 +44,31 @@ export interface SCOrganization extends SCOrganizationWithoutReferences, SCThing
|
||||
/**
|
||||
* Meta information about an organization
|
||||
*/
|
||||
export class SCOrganizationMeta extends SCThingMeta {
|
||||
export class SCOrganizationMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.de,
|
||||
type: 'Einrichtung',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.en,
|
||||
type: SCThingType.Organization,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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, SCThingType} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations, SCNationality} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
import {SCBuildingWithoutReferences} from './Building';
|
||||
@@ -23,9 +23,12 @@ import {SCRoomWithoutReferences} from './Room';
|
||||
/**
|
||||
* A person without references
|
||||
*/
|
||||
export interface SCPersonWithoutReferences extends SCThing {
|
||||
export interface SCPersonWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Additional first names of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
additionalName?: string;
|
||||
|
||||
@@ -38,16 +41,22 @@ export interface SCPersonWithoutReferences extends SCThing {
|
||||
* The private email address of the person.
|
||||
*
|
||||
* @TJS-format email
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* The family name of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
familyName: string;
|
||||
|
||||
/**
|
||||
* The private fax number of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
@@ -58,26 +67,36 @@ export interface SCPersonWithoutReferences extends SCThing {
|
||||
|
||||
/**
|
||||
* The first name of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
givenName: string;
|
||||
|
||||
/**
|
||||
* Honorific prefix of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
honorificPrefix?: string;
|
||||
|
||||
/**
|
||||
* Honorific suffix of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
honorificSuffix?: string;
|
||||
|
||||
/**
|
||||
* Titles of jobs that the person has.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
jobTitles?: string[];
|
||||
|
||||
/**
|
||||
* The complete name of the person combining all the parts of the name into one.
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
@@ -88,6 +107,8 @@ export interface SCPersonWithoutReferences extends SCThing {
|
||||
|
||||
/**
|
||||
* The private telephone number of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
@@ -101,8 +122,10 @@ export interface SCPersonWithoutReferences extends SCThing {
|
||||
* A person
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPerson extends SCPersonWithoutReferences {
|
||||
export interface SCPerson
|
||||
extends SCPersonWithoutReferences, SCThing {
|
||||
/**
|
||||
* Organization the person works for
|
||||
*/
|
||||
@@ -129,29 +152,67 @@ export interface SCPerson extends SCPersonWithoutReferences {
|
||||
/**
|
||||
* Meta information about a person
|
||||
*/
|
||||
export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPerson> {
|
||||
export class SCPersonMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPerson> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
additionalName: 'Zusatzname',
|
||||
affiliations: 'Zugehörigkeiten',
|
||||
birthDate: 'Geburtsdatum',
|
||||
email: 'E-Mail',
|
||||
familyName: 'Nachname',
|
||||
faxNumber: 'Faxnummer',
|
||||
gender: 'Geschlecht',
|
||||
givenName: 'Vorname',
|
||||
homeLocations: 'Heimatstandorte',
|
||||
honorificPrefix: 'Ehrentitel',
|
||||
honorificSuffix: 'Ehrentitel (Suffix)',
|
||||
jobTitles: 'Berufsbezeichnungen',
|
||||
nationality: 'Staatsangehörigkeit',
|
||||
telephone: 'Telefonnummer',
|
||||
workLocations: 'Arbeitsorte',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
additionalName: 'additional name',
|
||||
affiliations: 'affiliations',
|
||||
birthDate: 'birth date',
|
||||
email: 'email',
|
||||
familyName: 'family name',
|
||||
faxNumber: 'fax',
|
||||
gender: 'gender',
|
||||
givenName: 'given name',
|
||||
homeLocations: 'home locations',
|
||||
honorificPrefix: 'honorific title',
|
||||
honorificSuffix: 'honorific title (suffix)',
|
||||
jobTitles: 'job titles',
|
||||
nationality: 'nationality',
|
||||
telephone: 'telephone',
|
||||
workLocations: 'work locations',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
gender: {
|
||||
'female': 'weiblich',
|
||||
'inter': 'divers',
|
||||
'male': 'männlich',
|
||||
'undefined': 'undefiniert',
|
||||
},
|
||||
type: 'Person',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
type: SCThingType.Person,
|
||||
},
|
||||
};
|
||||
@@ -170,26 +231,36 @@ export interface SCContactPoint {
|
||||
|
||||
/**
|
||||
* E-mail at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* Fax number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* Times available for contacting at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
hoursAvailable?: string;
|
||||
|
||||
/**
|
||||
* Contact number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* URL at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,9 +12,10 @@
|
||||
* 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, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -27,8 +28,7 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
* A point of interest without references
|
||||
*/
|
||||
export interface SCPointOfInterestWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
@@ -45,8 +45,11 @@ export interface SCPointOfInterestWithoutReferences
|
||||
* A point of interest
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace {
|
||||
export interface SCPointOfInterest
|
||||
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
||||
SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
*/
|
||||
@@ -71,39 +74,66 @@ export type SCPointOfInterestCategories =
|
||||
/**
|
||||
* Meta information about points of interest
|
||||
*/
|
||||
export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations<SCPointOfInterest> {
|
||||
export class SCPointOfInterestMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPointOfInterest> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
},
|
||||
en: {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'card charger': 'Kartenaufwerter',
|
||||
'computer': 'Computer',
|
||||
'disabled access': 'barrierefreier Zugang',
|
||||
'printer': 'Drucker',
|
||||
'validator': 'Validierer',
|
||||
},
|
||||
type: 'Sonderziel',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.PointOfInterest,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -12,13 +12,15 @@
|
||||
* 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, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
||||
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCThingThatAcceptsPayments,
|
||||
SCThingThatAcceptsPaymentsWithoutReferences,
|
||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta,
|
||||
} from '../base/ThingThatAcceptsPayments';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -55,8 +57,10 @@ export interface SCRoomWithoutReferences
|
||||
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
||||
/**
|
||||
* The name of the floor in which the room is in.
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
floor?: string;
|
||||
floorName?: string;
|
||||
|
||||
/**
|
||||
* The inventory of the place/room as a list of items and their quantity.
|
||||
@@ -80,8 +84,11 @@ export interface SCRoomWithoutReferences
|
||||
* A room
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace {
|
||||
export interface SCRoom
|
||||
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
|
||||
SCThingWithCategories<SCRoomCategories, SCRoomSpecificValues> {
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
@@ -98,9 +105,12 @@ export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Category specific values of a room
|
||||
*/
|
||||
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
|
||||
export interface SCRoomSpecificValues
|
||||
extends SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific opening hours of the room
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
openingHours?: string;
|
||||
}
|
||||
@@ -108,37 +118,64 @@ export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValue
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom> {
|
||||
export class SCRoomMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCRoom> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.de,
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldTranslations.de,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCRoomCategories,
|
||||
SCRoomSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
inventory: 'Bestand',
|
||||
},
|
||||
en: {
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.en,
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldTranslations.en,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCRoomCategories,
|
||||
SCRoomSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
floorName: 'floor name',
|
||||
inventory: 'inventory',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldValueTranslations.de,
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldValueTranslations.de,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCRoomCategories,
|
||||
SCRoomSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
@@ -157,11 +194,18 @@ export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom
|
||||
type: 'Raum',
|
||||
},
|
||||
en: {
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldValueTranslations.en,
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
||||
SCPlaceWithoutReferencesMeta
|
||||
>().fieldValueTranslations.en,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCRoomCategories,
|
||||
SCRoomSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Room,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,18 +12,24 @@
|
||||
* 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, SCAcademicTermWithoutReferencesMeta} from '../base/AcademicTerm';
|
||||
import {
|
||||
SCAcademicTerm,
|
||||
SCAcademicTermWithoutReferences,
|
||||
SCAcademicTermWithoutReferencesMeta,
|
||||
} from '../base/AcademicTerm';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A semester without references
|
||||
*/
|
||||
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
|
||||
export interface SCSemesterWithoutReferences
|
||||
extends SCAcademicTermWithoutReferences {
|
||||
/**
|
||||
* The short name of the semester, using the given pattern.
|
||||
*
|
||||
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
|
||||
* @keyword
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
@@ -37,8 +43,10 @@ export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutRefere
|
||||
* A semester
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSemester extends SCSemesterWithoutReferences {
|
||||
export interface SCSemester
|
||||
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||
/**
|
||||
* Type of the semester
|
||||
*/
|
||||
@@ -48,13 +56,17 @@ export interface SCSemester extends SCSemesterWithoutReferences {
|
||||
/**
|
||||
* Meta information about a semester
|
||||
*/
|
||||
export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
|
||||
export class SCSemesterMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCSemester> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
||||
SCAcademicTermWithoutReferencesMeta
|
||||
>().fieldTranslations.de,
|
||||
acronym: 'Abkürzung',
|
||||
endDate: 'Ende',
|
||||
eventsEndDate: 'Vorlesungsschluss',
|
||||
@@ -62,20 +74,31 @@ export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
startDate: 'Beginn',
|
||||
},
|
||||
en: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
||||
SCAcademicTermWithoutReferencesMeta
|
||||
>().fieldTranslations.en,
|
||||
acronym: 'acronym',
|
||||
endDate: 'end date',
|
||||
eventsEndDate: 'semester ending',
|
||||
eventsStartDate: 'semester beginning',
|
||||
startDate: 'start date',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
||||
SCAcademicTermWithoutReferencesMeta
|
||||
>().fieldValueTranslations.de,
|
||||
type: 'Semester',
|
||||
},
|
||||
en: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
||||
SCAcademicTermWithoutReferencesMeta
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Semester,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,28 +13,36 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
|
||||
export type SCSettingCategories = string;
|
||||
|
||||
/**
|
||||
* A setting without references
|
||||
*/
|
||||
export interface SCSettingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
|
||||
/**
|
||||
* The type of input/value this setting is carrying
|
||||
* Categories of a setting
|
||||
*/
|
||||
input: SCSettingInputType;
|
||||
categories: SCSettingCategories[];
|
||||
/**
|
||||
* The default value of a setting
|
||||
*/
|
||||
defaultValue: SCSettingValue | SCSettingValues;
|
||||
/**
|
||||
* The input type of this setting
|
||||
*/
|
||||
inputType: SCSettingInputType;
|
||||
/**
|
||||
* The order number this setting should show up in its category list
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
order: number;
|
||||
/**
|
||||
@@ -45,82 +53,75 @@ export interface SCSettingWithoutReferences
|
||||
* The type of this model
|
||||
*/
|
||||
type: SCThingType.Setting;
|
||||
/**
|
||||
* The key of a value of a setting
|
||||
*/
|
||||
value?: SCSettingValue | SCSettingValues;
|
||||
/**
|
||||
* The possible values of a setting
|
||||
*/
|
||||
values?: SCSettingValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of categories for settings
|
||||
*/
|
||||
export type SCSettingCategories =
|
||||
'profile'
|
||||
| 'privacy'
|
||||
| 'credentials'
|
||||
| 'others';
|
||||
|
||||
/**
|
||||
* The types of input/value a setting object can carry
|
||||
*/
|
||||
export enum SCSettingInputType {
|
||||
SingleChoice = 'single choice',
|
||||
MultipleChoice = 'multiple choice',
|
||||
Number = 'number',
|
||||
Text = 'text',
|
||||
Password = 'password',
|
||||
}
|
||||
|
||||
/**
|
||||
* A setting with references
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSetting
|
||||
extends SCSettingWithoutReferences, SCThing,
|
||||
SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a setting
|
||||
*/
|
||||
translations?: SCTranslations<SCSettingValueTranslatableProperties>;
|
||||
/**
|
||||
* The type of this model
|
||||
*/
|
||||
type: SCThingType.Setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* The types of input/value a setting object can carry
|
||||
* The type a value of a setting can have
|
||||
*/
|
||||
export type SCSettingInputType = SCSettingSingleChoice
|
||||
| SCSettingMultipleChoice
|
||||
| SCSettingNumber
|
||||
| SCSettingText
|
||||
| SCSettingPassword;
|
||||
|
||||
/**
|
||||
* A setting with references
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSetting extends SCSettingWithoutReferences {
|
||||
/**
|
||||
* The type of this model
|
||||
*/
|
||||
type: SCThingType.Setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* The type of multiple values a setting can have
|
||||
*/
|
||||
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;
|
||||
}
|
||||
export type SCSettingValues = SCSettingValue[];
|
||||
|
||||
/**
|
||||
* Translatable properties of a setting
|
||||
*/
|
||||
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* The translations of the possible values of a setting
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
values?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,31 +133,58 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
defaultValue: 'Standard Wert',
|
||||
inputType: 'Eingabetyp',
|
||||
order: 'Position',
|
||||
value: 'Wert',
|
||||
values: 'Werte',
|
||||
},
|
||||
en: {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
defaultValue: 'default value',
|
||||
inputType: 'input type',
|
||||
order: 'position',
|
||||
value: 'value',
|
||||
values: 'values',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
credentials: 'Anmeldedaten',
|
||||
others: 'Andere',
|
||||
privacy: 'Privatsphäre',
|
||||
profile: 'Profil',
|
||||
},
|
||||
inputType: {
|
||||
'multiple choice': 'mehrfach Auswahl',
|
||||
number: 'Zahl',
|
||||
password: 'Passwort',
|
||||
'single choice': 'einfache Auswahl',
|
||||
text: 'Text',
|
||||
},
|
||||
type: 'Einstellung',
|
||||
},
|
||||
en: {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Setting,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,7 +19,8 @@ import {SCMetaTranslations} from '../types/i18n';
|
||||
/**
|
||||
* A sport course without references
|
||||
*/
|
||||
export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
|
||||
export interface SCSportCourseWithoutReferences
|
||||
extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
@@ -30,8 +31,10 @@ export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences
|
||||
* A sport course
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
export interface SCSportCourse
|
||||
extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
@@ -41,33 +44,31 @@ export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Meta information about a sport course
|
||||
*/
|
||||
export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations<SCSportCourse> {
|
||||
export class SCSportCourseMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCSportCourse> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
... SCEventMeta.getInstance().fieldTranslations.de,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
... SCEventMeta.getInstance().fieldTranslations.en,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
||||
type: 'Sportkurs',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
||||
type: SCThingType.SportCourse,
|
||||
},
|
||||
};
|
||||
|
||||
203
src/core/things/StudyModule.ts
Normal file
203
src/core/things/StudyModule.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCMap} from '../types/Map';
|
||||
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
|
||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
||||
import {SCOrganizationWithoutReferences} from './Organization';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
|
||||
/**
|
||||
* A study module without references
|
||||
*/
|
||||
export interface SCStudyModuleWithoutReferences
|
||||
extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
|
||||
/**
|
||||
* ECTS points (European Credit Transfer System)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
ects: number;
|
||||
|
||||
/**
|
||||
* The language in which the study module is offered
|
||||
*/
|
||||
language: SCLanguage;
|
||||
|
||||
/**
|
||||
* Majors that this study module is meant for
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
majors: string[];
|
||||
|
||||
/**
|
||||
* Represents the modules necessity for each given major (of the major property)
|
||||
*/
|
||||
necessity: SCMap<SCStudyModuleNecessity>;
|
||||
|
||||
/**
|
||||
* Translated fields of a study module
|
||||
*/
|
||||
translations?: SCTranslations<SCStudyModuleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the study module
|
||||
*/
|
||||
type: SCThingType.StudyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* A study module
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCStudyModule
|
||||
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Academic events that make up a study module
|
||||
*/
|
||||
academicEvents: SCAcademicEventWithoutReferences[];
|
||||
|
||||
/**
|
||||
* The faculty that manages and curates the study module
|
||||
*/
|
||||
faculty: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Study modules needed for each others fulfillment
|
||||
*/
|
||||
partnerModules?: SCStudyModuleWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Study modules required beforehand
|
||||
*/
|
||||
requiredModules?: SCStudyModuleWithoutReferences[];
|
||||
|
||||
/**
|
||||
* The secretary that administers requests and
|
||||
* questions concerning the study module by eg. students
|
||||
*/
|
||||
secretary: SCOrganizationWithoutReferences | SCPersonWithoutReferences;
|
||||
|
||||
/**
|
||||
* Translated fields of a study module
|
||||
*/
|
||||
translations?: SCTranslations<SCStudyModuleTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the study module
|
||||
*/
|
||||
type: SCThingType.StudyModule;
|
||||
}
|
||||
|
||||
export interface SCStudyModuleTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Translations of the majors that this study module is meant for
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
|
||||
/**
|
||||
* Translations of the modules necessity for each given major (of the major property)
|
||||
*/
|
||||
necessity: SCMap<SCStudyModuleNecessity>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a modules necessity (in a major) as it may be required, optional or
|
||||
* is in a pool of n optional modules were m out of them have to be taken/completed.
|
||||
* Hence the elective option.
|
||||
*/
|
||||
export enum SCStudyModuleNecessity {
|
||||
Required = 'required',
|
||||
Elective = 'elective',
|
||||
Optional = 'optional',
|
||||
}
|
||||
|
||||
/**
|
||||
* Study module meta data
|
||||
*/
|
||||
export class SCStudyModuleMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCStudyModule> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
academicEvents: 'Veranstaltungen',
|
||||
ects: 'ECTS-Punkte',
|
||||
faculty: 'Fachbereich',
|
||||
language: 'Unterrichtssprache',
|
||||
majors: 'Fachrichtungen',
|
||||
necessity: 'Erforderlichkeit',
|
||||
partnerModules: 'Partnermodule',
|
||||
requiredModules: 'Benötigte Module',
|
||||
secretary: 'Sekretariat',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.en,
|
||||
academicEvents: 'academic events',
|
||||
ects: 'ECTS points',
|
||||
faculty: 'faculty',
|
||||
language: 'teaching language',
|
||||
majors: 'majors',
|
||||
necessity: 'necessity',
|
||||
partnerModules: 'partner modules',
|
||||
requiredModules: 'required modules',
|
||||
secretary: 'secretary',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.de,
|
||||
necessity: {
|
||||
'elective': 'Wahlfach',
|
||||
'optional': 'optional',
|
||||
'required': 'benötigt',
|
||||
},
|
||||
type: 'Studiengangmodul',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.StudyModule,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,14 +13,15 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
import {SCISO8601Duration} from '../types/Time';
|
||||
|
||||
/**
|
||||
* A ticket without references
|
||||
*/
|
||||
export interface SCTicketWithoutReferences extends SCThing {
|
||||
export interface SCTicketWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Approximate wait time
|
||||
*/
|
||||
@@ -28,13 +29,15 @@ export interface SCTicketWithoutReferences extends SCThing {
|
||||
|
||||
/**
|
||||
* Waiting number of the ticket
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
currentTicketNumber: string;
|
||||
|
||||
/**
|
||||
* Service type of the ticket
|
||||
*/
|
||||
serviceType: any;
|
||||
serviceType: string;
|
||||
|
||||
/**
|
||||
* Type of a ticket
|
||||
@@ -46,8 +49,10 @@ export interface SCTicketWithoutReferences extends SCThing {
|
||||
* A ticket
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
export interface SCTicket
|
||||
extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
@@ -57,29 +62,41 @@ export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Meta information about a ticket
|
||||
*/
|
||||
export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTicket> {
|
||||
export class SCTicketMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCTicket> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
approxWaitingTime: 'ungefähre Wartezeit',
|
||||
currentTicketNumber: 'aktuelle Ticketnummer',
|
||||
serviceType: 'Service Kategorie',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
approxWaitingTime: 'approximate waiting time',
|
||||
currentTicketNumber: 'current ticket number',
|
||||
serviceType: 'type of service',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'Ticket',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Ticket,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
@@ -50,8 +53,19 @@ export interface SCToDoWithoutReferences
|
||||
* A "to do"
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCToDo extends SCToDoWithoutReferences {
|
||||
export interface SCToDo
|
||||
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the "to do"
|
||||
*/
|
||||
type: SCThingType.ToDo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,27 +86,37 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
string,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
done: 'Erledigt',
|
||||
dueDate: 'Fälligkeitsdatum',
|
||||
priority: 'Priorität',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
||||
string,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
done: 'done',
|
||||
dueDate: 'due date',
|
||||
priority: 'priority',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
type: 'ToDo',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
type: SCThingType.ToDo,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,25 +12,32 @@
|
||||
* 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, SCThingType} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A tour without references
|
||||
*/
|
||||
export interface SCTourWithoutReferences extends SCThing {
|
||||
export interface SCTourWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Init script for the tour
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
init?: string;
|
||||
|
||||
/**
|
||||
* Steps of a tour
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
steps: SCTourStep[];
|
||||
|
||||
/**
|
||||
* Type of a tour
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
type: SCThingType.Tour;
|
||||
}
|
||||
@@ -39,8 +46,10 @@ export interface SCTourWithoutReferences extends SCThing {
|
||||
* A tour
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCTour extends SCTourWithoutReferences {
|
||||
export interface SCTour
|
||||
extends SCTourWithoutReferences, SCThing {
|
||||
/**
|
||||
* Type of a tour
|
||||
*/
|
||||
@@ -50,7 +59,38 @@ export interface SCTour extends SCTourWithoutReferences {
|
||||
/**
|
||||
* Meta information about a tour
|
||||
*/
|
||||
export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour> {
|
||||
export class SCTourMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCTour> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
init: 'Initiales Skript',
|
||||
steps: 'Schritte',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
init: 'initial script',
|
||||
steps: 'steps',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
type: 'Tour',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
type: SCThingType.Tour,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,6 +107,8 @@ export type SCTourStep =
|
||||
export interface SCTourStepLocation {
|
||||
/**
|
||||
* Location to go to
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
location: string;
|
||||
|
||||
@@ -87,6 +129,8 @@ export interface SCTourStepTooltip {
|
||||
|
||||
/**
|
||||
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
element: string | string[];
|
||||
|
||||
@@ -102,11 +146,15 @@ export interface SCTourStepTooltip {
|
||||
|
||||
/**
|
||||
* Text that the tooltip shall contain
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* How often it shall be retried
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
tries?: number;
|
||||
|
||||
@@ -142,6 +190,8 @@ export interface SCTourStepMenu {
|
||||
export interface SCTourResolvedElement {
|
||||
/**
|
||||
* Element name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
element: string;
|
||||
}
|
||||
@@ -152,6 +202,8 @@ export interface SCTourResolvedElement {
|
||||
export interface SCTourResolvedEvent {
|
||||
/**
|
||||
* Event name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
event: string;
|
||||
}
|
||||
@@ -172,6 +224,8 @@ export interface SCTourResolvedLocation {
|
||||
export interface SCTourResolvedLocationTypeIs {
|
||||
/**
|
||||
* Specific location name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
is: string;
|
||||
}
|
||||
@@ -182,6 +236,8 @@ export interface SCTourResolvedLocationTypeIs {
|
||||
export interface SCTourResolvedLocationTypeMatch {
|
||||
/**
|
||||
* Regex location name
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
match: string;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -21,7 +21,8 @@ import {SCPersonWithoutReferences} from './Person';
|
||||
/**
|
||||
* A video without references
|
||||
*/
|
||||
export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
export interface SCVideoWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* The Duration of the Video
|
||||
*/
|
||||
@@ -34,6 +35,8 @@ export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReference
|
||||
|
||||
/**
|
||||
* URLs to a thumbnails for the Video
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
thumbnails?: string[];
|
||||
|
||||
@@ -44,6 +47,8 @@ export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReference
|
||||
|
||||
/**
|
||||
* A Transcript of the Video
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
transcript?: string;
|
||||
|
||||
@@ -56,6 +61,8 @@ export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReference
|
||||
export interface SCVideoSource {
|
||||
/**
|
||||
* Pixel Height of the Video
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
@@ -66,16 +73,22 @@ export interface SCVideoSource {
|
||||
|
||||
/**
|
||||
* Size of the Video File in bytes
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* URL to the Video File
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Pixel Width of the Video
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
width?: number;
|
||||
}
|
||||
@@ -93,6 +106,8 @@ export interface SCVideoTrack {
|
||||
|
||||
/**
|
||||
* URL to the Track File
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
@@ -101,8 +116,10 @@ export interface SCVideoTrack {
|
||||
* A video
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
export interface SCVideo
|
||||
extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
/**
|
||||
* Persons acting in the Video
|
||||
*/
|
||||
@@ -117,29 +134,47 @@ export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
/**
|
||||
* Meta information about a video
|
||||
*/
|
||||
export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVideo> {
|
||||
export class SCVideoMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCVideo> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
actors: 'Darsteller',
|
||||
duration: 'Dauer',
|
||||
sources: 'Quellen',
|
||||
thumbnails: 'Vorschaubilder',
|
||||
tracks: 'Spuren',
|
||||
transcript: 'Transkript',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
actors: 'actors',
|
||||
duration: 'duration',
|
||||
sources: 'sources',
|
||||
thumbnails: 'thumbnails',
|
||||
tracks: 'tracks',
|
||||
transcript: 'transcript',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'Video',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.Video,
|
||||
},
|
||||
};
|
||||
@@ -159,7 +194,7 @@ export type SCVideoMimeType =
|
||||
* Video Track Types
|
||||
*/
|
||||
export type SCVideoTrackTypes =
|
||||
'captions'
|
||||
'closed captions'
|
||||
| 'chapters'
|
||||
| 'description'
|
||||
| 'metadata'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 StApps
|
||||
* Copyright (C) 2019 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.
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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-next-line:no-implicit-dependencies
|
||||
import {Point, Polygon} from 'geojson';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,72 +1,114 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 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
|
||||
* unknown 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, SCThingType} from '../Thing';
|
||||
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCTranslations} from './i18n';
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a SCThing
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isThing(something: any): something is SCThing {
|
||||
return (
|
||||
typeof something === 'object'
|
||||
&& typeof something.type === 'string'
|
||||
&& Object.values(SCThingType).indexOf(something.type) >= 0
|
||||
);
|
||||
export function isThing(something: unknown): something is SCThing {
|
||||
if (typeof something !== 'object' || something === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!('type' in something)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:completed-docs
|
||||
const type = (something as { type: unknown; }).type;
|
||||
|
||||
if (typeof type !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Object
|
||||
.values(SCThingType)
|
||||
.indexOf(type) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to check if translations exist
|
||||
*
|
||||
* @param {SCThing} thing Thing to check
|
||||
* @param thing Thing to check
|
||||
*/
|
||||
export function isThingWithTranslations(thing: SCThing): thing is SCThingWithTranslations {
|
||||
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
||||
// tslint:disable-next-line:completed-docs
|
||||
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
|
||||
return typeof thing.translations !== 'undefined';
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a bulk response
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isBulkResponse(something: any): something is SCBulkResponse {
|
||||
return typeof something.expiration === 'string'
|
||||
&& typeof something.source === 'string'
|
||||
&& typeof something.state === 'string'
|
||||
&& typeof something.type === 'string'
|
||||
&& typeof something.uid === 'string';
|
||||
export function isBulkResponse(something: unknown): something is SCBulkResponse {
|
||||
if (typeof something !== 'object' || something === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!('expiration' in something)
|
||||
|| !('source' in something)
|
||||
|| !('state' in something)
|
||||
|| !('type' in something)
|
||||
|| !('uid' in something)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const {expiration, source, state, type, uid} = something as {
|
||||
// tslint:disable:completed-docs
|
||||
expiration: unknown;
|
||||
source: unknown;
|
||||
state: unknown;
|
||||
type: unknown;
|
||||
uid: unknown;
|
||||
// tslint:enable
|
||||
};
|
||||
|
||||
return typeof expiration === 'string'
|
||||
&& typeof source === 'string'
|
||||
&& typeof state === 'string'
|
||||
&& typeof type === 'string'
|
||||
&& typeof uid === 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a search response
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isSearchResponse(something: any): something is SCSearchResponse {
|
||||
return Array.isArray(something.data)
|
||||
&& 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';
|
||||
export function isSearchResponse(something: unknown): something is SCSearchResponse {
|
||||
if (!(typeof something === 'object') || something === null) {
|
||||
return false;
|
||||
}
|
||||
const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
|
||||
|
||||
return Array.isArray(somethingObject.data)
|
||||
&& Array.isArray(somethingObject.facets)
|
||||
&& typeof somethingObject.pagination !== 'undefined'
|
||||
&& typeof somethingObject.pagination.count === 'number'
|
||||
&& typeof somethingObject.pagination.offset === 'number'
|
||||
&& typeof somethingObject.pagination.total === 'number'
|
||||
&& typeof somethingObject.stats !== 'undefined'
|
||||
&& typeof somethingObject.stats.time === 'number';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,8 +116,11 @@ export function isSearchResponse(something: any): something is SCSearchResponse
|
||||
*
|
||||
* @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 as boolean);
|
||||
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
|
||||
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
|
||||
|
||||
return Object.keys(something as { [key: string]: string; })
|
||||
.reduce((previousOnesAreSearchResponses, key) => {
|
||||
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
|
||||
}, initialValue as boolean);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 StApps
|
||||
* Copyright (C) 2019 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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-next-line:no-implicit-dependencies
|
||||
import {Polygon} from 'geojson';
|
||||
import {SCSetting} from '../../things/Setting';
|
||||
import {SCTranslations} from '../i18n';
|
||||
@@ -126,11 +127,11 @@ export interface SCAppConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Map of features
|
||||
*/
|
||||
export interface SCAppConfigurationFeature {
|
||||
/**
|
||||
*
|
||||
* Whether or not widgets are enabled
|
||||
*/
|
||||
widgets: boolean;
|
||||
}
|
||||
|
||||
@@ -176,10 +176,9 @@ export interface SCBackendInternalConfiguration {
|
||||
/**
|
||||
* Configuration of the database
|
||||
*/
|
||||
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<any> {
|
||||
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<unknown> {
|
||||
/**
|
||||
* Name of the database used by the backend
|
||||
*/
|
||||
name: string;
|
||||
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ export interface SCMonitoringWatcher {
|
||||
/**
|
||||
* Query to execute against the database
|
||||
*/
|
||||
query: any;
|
||||
query: unknown;
|
||||
|
||||
/**
|
||||
* A list of triggers
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArgument
|
||||
/**
|
||||
* Arguments for the filter instruction
|
||||
*/
|
||||
export type SCSearchAbstractFilterArguments = SCMap<any>;
|
||||
export type SCSearchAbstractFilterArguments = SCMap<unknown>;
|
||||
|
||||
/**
|
||||
* Available filter instructions
|
||||
|
||||
@@ -22,6 +22,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
||||
* Filter for documents where it cannot be safely determined that they are not available
|
||||
*/
|
||||
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractFilter.type
|
||||
*/
|
||||
type: 'availability';
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter}
|
||||
* This filter can be used to combine multiple filters with boolean operations.
|
||||
*/
|
||||
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractFilter.type
|
||||
*/
|
||||
type: 'boolean';
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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-next-line:no-implicit-dependencies
|
||||
import {Position} from 'geojson';
|
||||
import {SCThingsField} from '../../Classes';
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
||||
@@ -22,6 +23,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
||||
* Filter for documents that are in the given distance of the given location
|
||||
*/
|
||||
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractFilter.type
|
||||
*/
|
||||
type: 'distance';
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
||||
* Filters for documents that match the value on the given field
|
||||
*/
|
||||
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractFilter.type
|
||||
*/
|
||||
type: 'value';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -690,7 +690,7 @@ export interface SCTranslations<T> {
|
||||
* (Source: https://stackoverflow.com/a/51365037)
|
||||
*/
|
||||
type RecursivePartial<T> = {
|
||||
[P in keyof T]?:
|
||||
[P in keyof T]-?:
|
||||
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
|
||||
T[P] extends object ? RecursivePartial<T[P]> :
|
||||
T[P];
|
||||
@@ -714,6 +714,12 @@ type SCRequiredTranslation<T> = {
|
||||
* Interface to be implemented by all Meta classes
|
||||
*/
|
||||
export interface SCMetaTranslations<T> {
|
||||
/**
|
||||
* Field translations
|
||||
*/
|
||||
fieldTranslations: SCRequiredTranslation<T>;
|
||||
fieldValueTranslations: any;
|
||||
/**
|
||||
* Field value translations
|
||||
*/
|
||||
fieldValueTranslations: unknown;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
|
||||
/**
|
||||
* Map of arguments for the sort instruction
|
||||
*/
|
||||
export interface SCSearchAbstractSortArguments extends SCMap<any> {
|
||||
export interface SCSearchAbstractSortArguments extends SCMap<unknown> {
|
||||
/**
|
||||
* Field to sort by
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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-next-line:no-implicit-dependencies
|
||||
import {Position} from 'geojson';
|
||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
|
||||
@@ -19,6 +20,9 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
* Sort instruction to sort by distance
|
||||
*/
|
||||
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractSort.type
|
||||
*/
|
||||
type: 'distance';
|
||||
}
|
||||
|
||||
|
||||
@@ -18,5 +18,8 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
* Sort instruction for ducet sort
|
||||
*/
|
||||
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractSort.type
|
||||
*/
|
||||
type: 'ducet';
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||
* Sort instruction to sort by price
|
||||
*/
|
||||
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractSort.type
|
||||
*/
|
||||
type: 'price';
|
||||
}
|
||||
|
||||
|
||||
@@ -14,44 +14,129 @@
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
import {SCBulkResponse} from '../src/core/protocol/routes/bulk/BulkResponse';
|
||||
import {SCMultiSearchResponse} from '../src/core/protocol/routes/search/MultiSearchResponse';
|
||||
import {SCSearchResponse} from '../src/core/protocol/routes/search/SearchResponse';
|
||||
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
|
||||
import {SCDish} from '../src/core/things/Dish';
|
||||
import {isThing} from '../src/core/types/Guards';
|
||||
import {
|
||||
isBulkResponse,
|
||||
isMultiSearchResponse,
|
||||
isSearchResponse,
|
||||
isThing,
|
||||
isThingWithTranslations,
|
||||
} from '../src/core/types/Guards';
|
||||
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class GuardsSpec {
|
||||
|
||||
static bulkResponse: SCBulkResponse = {
|
||||
expiration: '2009-06-30T18:30:00+02:00 ',
|
||||
source: 'bar',
|
||||
state: 'done',
|
||||
type: SCThingType.Dish,
|
||||
uid: 'foo',
|
||||
};
|
||||
|
||||
static dishWithTranslation: SCDish = {
|
||||
categories: [
|
||||
'appetizer',
|
||||
],
|
||||
name: 'foo',
|
||||
origin: {
|
||||
created: '',
|
||||
type: SCThingOriginType.User,
|
||||
},
|
||||
translations: {
|
||||
de: {
|
||||
name: 'Foo',
|
||||
},
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'bar',
|
||||
};
|
||||
|
||||
static notADish = {
|
||||
categories: [
|
||||
'appetizer',
|
||||
],
|
||||
name: 'foo',
|
||||
origin: {
|
||||
created: '',
|
||||
type: SCThingOriginType.User,
|
||||
},
|
||||
type: 'foobar',
|
||||
uid: 'bar',
|
||||
};
|
||||
|
||||
static searchResponse: SCSearchResponse = {
|
||||
data: [
|
||||
GuardsSpec.dishWithTranslation,
|
||||
],
|
||||
facets: [
|
||||
{
|
||||
buckets: [
|
||||
{
|
||||
count: 1,
|
||||
key: 'key',
|
||||
},
|
||||
],
|
||||
field: 'field',
|
||||
},
|
||||
],
|
||||
pagination: {
|
||||
count: 1,
|
||||
offset: 0,
|
||||
total: 1,
|
||||
},
|
||||
stats: {
|
||||
time: 1,
|
||||
},
|
||||
};
|
||||
|
||||
@test
|
||||
public isBulkResponse() {
|
||||
expect(isBulkResponse(null)).to.be.equal(false);
|
||||
expect(isBulkResponse(GuardsSpec.dishWithTranslation)).to.be.equal(false);
|
||||
expect(isBulkResponse(GuardsSpec.bulkResponse)).to.be.equal(true);
|
||||
}
|
||||
|
||||
@test
|
||||
public isMultiSearchResponse() {
|
||||
const multiSearchResponse: SCMultiSearchResponse = {
|
||||
foo: GuardsSpec.searchResponse,
|
||||
};
|
||||
expect(isMultiSearchResponse(multiSearchResponse)).to.be.equal(true);
|
||||
const notAMultiSearchResponse = {...multiSearchResponse, ...{bar: 'baz'}};
|
||||
expect(isMultiSearchResponse(notAMultiSearchResponse)).to.be.equal(false);
|
||||
delete multiSearchResponse.foo;
|
||||
expect(isMultiSearchResponse(multiSearchResponse)).to.be.equal(false);
|
||||
}
|
||||
|
||||
@test
|
||||
public isSearchResponse() {
|
||||
const notASearchResponse = {...GuardsSpec.searchResponse};
|
||||
delete notASearchResponse.pagination;
|
||||
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
||||
delete notASearchResponse.data;
|
||||
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
||||
expect(isSearchResponse(null)).to.be.equal(false);
|
||||
expect(isSearchResponse(GuardsSpec.searchResponse)).to.be.equal(true);
|
||||
}
|
||||
|
||||
@test
|
||||
public isThing() {
|
||||
const notADish = {
|
||||
categories: [
|
||||
'appetizer',
|
||||
],
|
||||
name: 'foo',
|
||||
origin: {
|
||||
created: '',
|
||||
type: SCThingOriginType.User,
|
||||
},
|
||||
type: 'foobar',
|
||||
uid: 'bar',
|
||||
};
|
||||
|
||||
const dish: SCDish = {
|
||||
categories: [
|
||||
'appetizer',
|
||||
],
|
||||
name: 'foo',
|
||||
origin: {
|
||||
created: '',
|
||||
type: SCThingOriginType.User,
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'bar',
|
||||
};
|
||||
|
||||
expect(isThing('foo')).to.be.equal(false);
|
||||
expect(isThing({type: 'foo'})).to.be.equal(false);
|
||||
expect(isThing(GuardsSpec.notADish)).to.be.equal(false);
|
||||
expect(isThing(GuardsSpec.dishWithTranslation)).to.be.equal(true);
|
||||
}
|
||||
|
||||
expect(isThing(notADish)).to.be.equal(false);
|
||||
|
||||
expect(isThing(dish)).to.be.equal(true);
|
||||
@test
|
||||
public isThingWithTranslations() {
|
||||
const dishWithoutTranslation = {...GuardsSpec.dishWithTranslation};
|
||||
delete dishWithoutTranslation.translations;
|
||||
expect(isThingWithTranslations(dishWithoutTranslation)).to.be.equal(false);
|
||||
expect(isThingWithTranslations(GuardsSpec.dishWithTranslation)).to.be.equal(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,24 +12,273 @@
|
||||
* 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 {getProjectReflection} from '@openstapps/core-tools/lib/common';
|
||||
import {validateFiles, writeReport} from '@openstapps/core-tools/lib/validate';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {fail} from 'assert';
|
||||
import {expect} from 'chai';
|
||||
import {mkdirSync} from 'fs';
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
import {join, resolve} from 'path';
|
||||
|
||||
const logger = new Logger();
|
||||
import {DeclarationReflection, ProjectReflection} from 'typedoc';
|
||||
import {ArrayType, IntrinsicType, ReferenceType, StringLiteralType, Type, UnionType} from 'typedoc/dist/lib/models';
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
logger.error('UNHANDLED REJECTION', err.stack);
|
||||
Logger.error('UNHANDLED REJECTION', err.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
/**
|
||||
* Check if type is a union type
|
||||
*
|
||||
* @param type Type to check
|
||||
*/
|
||||
function isUnionType(type: Type): type is UnionType {
|
||||
return type.type === 'union';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a type is reference type
|
||||
*
|
||||
* @param type Type to check
|
||||
*/
|
||||
function isReferenceType(type: Type): type is ReferenceType {
|
||||
return type.type === 'reference';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a type is an array type
|
||||
*
|
||||
* @param type Type to check
|
||||
*/
|
||||
function isArrayType(type: Type): type is ArrayType {
|
||||
return type.type === 'array';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a type is an intrinsic type
|
||||
*
|
||||
* @param type Type to check
|
||||
*/
|
||||
function isIntrinsicType(type: Type): type is IntrinsicType {
|
||||
return type.type === 'intrinsic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a type is a string literal type
|
||||
*
|
||||
* @param type Type to check
|
||||
*/
|
||||
function isStringLiteralType(type: Type): type is StringLiteralType {
|
||||
return type.type === 'stringLiteral';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended types of a declaration reflection
|
||||
* @param thingReflection Reflection of the thing
|
||||
* @param objects Map of reflections by name
|
||||
*/
|
||||
function getExtendedTypes(thingReflection: DeclarationReflection,
|
||||
objects: { [name: string]: DeclarationReflection }): string[] {
|
||||
const extendedTypes: string[] = [];
|
||||
|
||||
if (Array.isArray(thingReflection.extendedTypes)) {
|
||||
const typesToCheck = thingReflection.extendedTypes.slice();
|
||||
|
||||
while (typesToCheck.length > 0) {
|
||||
const extendedType = typesToCheck.splice(0, 1)[0];
|
||||
|
||||
extendedTypes.push((extendedType as unknown as ReferenceType).name);
|
||||
|
||||
const extendedObject = objects[(extendedType as unknown as ReferenceType).name];
|
||||
|
||||
if (typeof extendedObject !== 'undefined') {
|
||||
if (Array.isArray(extendedObject.extendedTypes)) {
|
||||
typesToCheck.push.apply(typesToCheck, extendedObject.extendedTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return extendedTypes;
|
||||
}
|
||||
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class ValidateTestFiles {
|
||||
export class SchemaSpec {
|
||||
static objects: { [name: string]: DeclarationReflection } = {};
|
||||
static reflection: ProjectReflection;
|
||||
static thingNames: string[];
|
||||
|
||||
static before() {
|
||||
SchemaSpec.reflection = getProjectReflection(resolve(__dirname, '..', 'src'));
|
||||
|
||||
if (Array.isArray(SchemaSpec.reflection.children)) {
|
||||
for (const module of SchemaSpec.reflection.children) {
|
||||
if (Array.isArray(module.children)) {
|
||||
for (const object of module.children) {
|
||||
SchemaSpec.objects[object.name] = object;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const thingsReflection = SchemaSpec.objects.SCThingsWithoutDiff;
|
||||
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(thingsReflection).not.to.be.undefined;
|
||||
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(isUnionType(thingsReflection.type!)).to.be.true;
|
||||
|
||||
(thingsReflection.type! as UnionType).types.push({
|
||||
'id': 0,
|
||||
'name': 'SCDiff',
|
||||
'type': 'reference',
|
||||
} as unknown as ReferenceType);
|
||||
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect((thingsReflection.type! as UnionType).types.every(isReferenceType)).to.be.true;
|
||||
|
||||
SchemaSpec.thingNames = (thingsReflection.type! as UnionType).types.map((type) => {
|
||||
return (type as ReferenceType).name;
|
||||
});
|
||||
}
|
||||
|
||||
@test
|
||||
async validateTestFiles() {
|
||||
'all things have an origin'() {
|
||||
for (const thingName of SchemaSpec.thingNames) {
|
||||
const thingReflection = SchemaSpec.objects[`${thingName}`];
|
||||
|
||||
let originFound = false;
|
||||
|
||||
if (Array.isArray(thingReflection.children)) {
|
||||
for (const property of thingReflection.children) {
|
||||
if (property.name === 'origin') {
|
||||
originFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(originFound).to.be.equal(true, `'${thingName}' must have property 'origin'.`);
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
'does not have duplicate names'() {
|
||||
const names: string[] = [];
|
||||
|
||||
if (Array.isArray(SchemaSpec.reflection.children)) {
|
||||
for (const module of SchemaSpec.reflection.children) {
|
||||
if (Array.isArray(module.children)) {
|
||||
for (const object of module.children) {
|
||||
expect(names).not.to.contain(object.name);
|
||||
names.push(object.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
'no property is an SCThing'() {
|
||||
for (const thingName of SchemaSpec.thingNames) {
|
||||
const thingReflection = SchemaSpec.objects[`${thingName}`];
|
||||
|
||||
if (Array.isArray(thingReflection.children)) {
|
||||
for (const property of thingReflection.children) {
|
||||
if (typeof property.type === 'undefined') {
|
||||
Logger.error(thingName, property.name);
|
||||
continue;
|
||||
}
|
||||
|
||||
let type = property.type!;
|
||||
|
||||
if (isIntrinsicType(type)) {
|
||||
continue;
|
||||
} else if (isArrayType(type)) {
|
||||
const elementType = type.elementType;
|
||||
|
||||
if (isIntrinsicType(elementType)) {
|
||||
continue;
|
||||
} else if (isReferenceType(elementType)) {
|
||||
expect(SchemaSpec.thingNames).not.to.contain(
|
||||
elementType.name,
|
||||
`Array property '${property.name}' on type '${thingName}' has element type '${elementType.name}'.`,
|
||||
);
|
||||
} else {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
fail(`'${thingName}'#'${property.name}' element type '${elementType.type}' is not handled by this test!`);
|
||||
}
|
||||
} else if (isReferenceType(type)) {
|
||||
do {
|
||||
expect(SchemaSpec.thingNames).not.to.contain(
|
||||
type.name,
|
||||
`Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`,
|
||||
);
|
||||
|
||||
const referencedObject = SchemaSpec.objects[type.name];
|
||||
if (typeof referencedObject !== 'undefined') {
|
||||
const referencedType = referencedObject.type;
|
||||
if (typeof referencedType !== 'undefined') {
|
||||
type = referencedType;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (isReferenceType(type));
|
||||
} else if (isUnionType(type)) {
|
||||
for (const nestedType of type.types) {
|
||||
if (isIntrinsicType(nestedType) || isStringLiteralType(nestedType)) {
|
||||
continue;
|
||||
} else if (isReferenceType(nestedType)) {
|
||||
expect(SchemaSpec.thingNames).not.to.contain(
|
||||
nestedType.name,
|
||||
`Union property '${property.name}' on type '${thingName}' contains type '${nestedType.name}'.`,
|
||||
);
|
||||
} else {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
fail(`'${thingName}'#'${property.name}' union type '${nestedType.type}' is not handled by this test!`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
fail(`'${thingName}'#'${property.name}' with type '${type.type}' is not handled by this test!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
'things extend SCThing'() {
|
||||
for (const thingName of SchemaSpec.thingNames) {
|
||||
const thingReflection = SchemaSpec.objects[`${thingName}`];
|
||||
|
||||
expect(getExtendedTypes(thingReflection, SchemaSpec.objects)).to.contain(
|
||||
'SCThing',
|
||||
`'${thingName}' neither extends 'SCThing' transitively nor directly.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
'things without references do not extend SCThing'() {
|
||||
for (const thingName of SchemaSpec.thingNames) {
|
||||
const thingWithoutReferencesReflection = SchemaSpec.objects[`${thingName}WithoutReferences`];
|
||||
|
||||
expect(getExtendedTypes(thingWithoutReferencesReflection, SchemaSpec.objects)).not.to.contain(
|
||||
'SCThing',
|
||||
`'${thingName}WithoutReferences' extends 'SCThing' either transitively or directly.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
async 'validate against test files'() {
|
||||
const errorsPerFile = await validateFiles(resolve('lib', 'schema'), resolve('test', 'resources'));
|
||||
|
||||
let unexpected = false;
|
||||
@@ -37,12 +286,12 @@ export class ValidateTestFiles {
|
||||
unexpected = unexpected || errorsPerFile[file].some((error) => !error.expected);
|
||||
});
|
||||
|
||||
expect(unexpected).to.be.equal(false);
|
||||
|
||||
mkdirSync('report', {
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
await writeReport(join('report', 'index.html'), errorsPerFile);
|
||||
|
||||
expect(unexpected).to.be.equal(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import clone = require('fast-clone');
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
|
||||
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
|
||||
import {SCBuildingWithoutReferences} from '../src/core/things/Building';
|
||||
import {SCDish, SCDishMeta} from '../src/core/things/Dish';
|
||||
import {SCPerson} from '../src/core/things/Person';
|
||||
import {SCThingTranslator} from '../src/core/Translator';
|
||||
|
||||
const building: SCBuildingWithoutReferences = {
|
||||
@@ -36,11 +37,6 @@ const building: SCBuildingWithoutReferences = {
|
||||
},
|
||||
},
|
||||
name: 'base-space-name',
|
||||
origin: {
|
||||
indexed: '1970-01-01T00:00:00.000Z',
|
||||
name: 'building-connector',
|
||||
type: SCThingOriginType.Remote,
|
||||
},
|
||||
translations: {
|
||||
de: {
|
||||
address: {
|
||||
@@ -71,11 +67,6 @@ const dish: SCDish = {
|
||||
},
|
||||
provider: {
|
||||
name: 'base-provider',
|
||||
origin: {
|
||||
indexed: '1970-01-01T00:00:00.000Z',
|
||||
name: 'dish-connector',
|
||||
type: SCThingOriginType.Remote,
|
||||
},
|
||||
type: SCThingType.Organization,
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217141',
|
||||
},
|
||||
@@ -96,29 +87,15 @@ const dish: SCDish = {
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217140',
|
||||
};
|
||||
|
||||
const person: SCPerson = {
|
||||
familyName: 'base-familyName-name',
|
||||
givenName: 'base-givenName-name',
|
||||
homeLocations: [building, building, building],
|
||||
name : 'base-person-name',
|
||||
origin: {
|
||||
indexed: '1970',
|
||||
name: 'ding',
|
||||
type: SCThingOriginType.Remote,
|
||||
},
|
||||
type: SCThingType.Person,
|
||||
uid: '1234',
|
||||
};
|
||||
|
||||
const translator = new SCThingTranslator('de', 'en');
|
||||
const translator = new SCThingTranslator('de');
|
||||
// tslint:disable-next-line:no-eval
|
||||
const languageNonExistant = eval("'jp'");
|
||||
// this will simulate a translator always utilizing the base language translations
|
||||
const translatorWithFallback = new SCThingTranslator(languageNonExistant);
|
||||
|
||||
// tslint:disable:member-ordering TranslationSpec
|
||||
// tslint:disable:member-ordering TranslationSpecInplace
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class TranslationSpec {
|
||||
export class TranslationSpecInplace {
|
||||
|
||||
@test
|
||||
public directStringLiteralType() {
|
||||
@@ -231,134 +208,24 @@ export class TranslationSpec {
|
||||
expect(translator.translate(dish).offers[0].inPlace.categories[1234]('printer')).to.equal('printer');
|
||||
expect(translator.translate(dish).offers[0].inPlace.categories[1]('printer')).to.not.equal('printer');
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable:member-ordering TranslationSpecByString
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class TranslationSpecByString {
|
||||
|
||||
@test
|
||||
public directStringLiteralType() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'type')).to.equal('Essen');
|
||||
public changingTranslatorLanguageFlushesItsLRUCache() {
|
||||
const translatorDE = new SCThingTranslator('de');
|
||||
expect(translatorDE.translate(dish).name()).to.equal('de-dish-name');
|
||||
translatorDE.language = 'en';
|
||||
expect(translatorDE.translate(dish).name()).to.equal('base-dish-name');
|
||||
}
|
||||
|
||||
@test
|
||||
public directStringProperty() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'name')).to.equal('de-dish-name');
|
||||
}
|
||||
|
||||
@test
|
||||
public directArrayOfString() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'characteristics')).to.deep
|
||||
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
|
||||
}
|
||||
|
||||
@test
|
||||
public directArrayOfStringSubscript() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'characteristics[1]'))
|
||||
.to.deep.equal({name: 'de-characteristic1'});
|
||||
}
|
||||
|
||||
@test
|
||||
public directMetaArrayOfString() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'categories')).to.deep.equal(['Hauptgericht', 'Nachtisch']);
|
||||
}
|
||||
|
||||
@test
|
||||
public directMetaArrayOfStringSubscript() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'categories[1]')).to.equal('Nachtisch');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedStringLiteralType() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'offers[0].inPlace.type')).to.equal('Gebäude');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedStringProperty() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'offers[0].inPlace.name')).to.equal('de-space-name');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedMetaArrayOfString() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'offers[0].inPlace.categories'))
|
||||
.to.deep.equal(['Büro', 'Bildung']);
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedMetaArrayOfStringSubscript() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'offers[0].inPlace.categories[1]')).to.equal('Bildung');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedArrayOfStringSubscript() {
|
||||
expect(translator.getFieldValueTranslation(dish, 'offers[0].inPlace.floors[1]')).to.equal('de-floor1');
|
||||
}
|
||||
|
||||
@test
|
||||
public directStringLiteralTypeFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'type')).to.equal('dish');
|
||||
}
|
||||
|
||||
@test
|
||||
public directStringPropertyFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'name')).to.equal('base-dish-name');
|
||||
}
|
||||
|
||||
@test
|
||||
public directArrayOfStringSubscriptFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'characteristics[1]'))
|
||||
.to.deep.equal({name: 'base-characteristic1'});
|
||||
}
|
||||
|
||||
@test
|
||||
public directMetaArrayOfStringFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'categories'))
|
||||
.to.deep.equal(['main dish', 'dessert']);
|
||||
}
|
||||
|
||||
@test
|
||||
public directMetaArrayOfStringSubscriptFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'categories[1]')).to.equal('dessert');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedStringLiteralTypeFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'offers[0].inPlace.type')).to.equal('building');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedStringPropertyFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'offers[0].inPlace.name')).to.equal('base-space-name');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedMetaArrayOfStringFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'offers[0].inPlace.categories'))
|
||||
.to.deep.equal(['office', 'education']);
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedMetaArrayOfStringSubscriptFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'offers[0].inPlace.categories[1]'))
|
||||
.to.equal('education');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedArrayOfStringSubscriptFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'offers[0].inPlace.floors[1]'))
|
||||
.to.equal('base-floor1');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedArrayOfStringSubscriptUncommonFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(dish, 'offers[0].inPlace.floors.1')).to.equal('base-floor1');
|
||||
}
|
||||
|
||||
@test
|
||||
public nestedNestedMetaArrayOfStringSubscriptUncommonFallback() {
|
||||
expect(translatorWithFallback.getFieldValueTranslation(person, 'homeLocations.1.categories.1'))
|
||||
.to.equal('education');
|
||||
public forceTranslatorLRUCacheToOverflow() {
|
||||
const translatorDE = new SCThingTranslator('de');
|
||||
// Make sure to add more elements to the translator cache than the maximum cache capacity. See Translator.ts
|
||||
for (let i = 0; i < 201; i++) {
|
||||
const anotherDish = Object.assign({}, dish);
|
||||
anotherDish.uid = String(i);
|
||||
expect(translatorDE.translate(anotherDish).name()).to.equal('de-dish-name');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,13 +237,14 @@ export class MetaTranslationSpec {
|
||||
public consistencyWithMetaClass() {
|
||||
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish);
|
||||
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish, 'en');
|
||||
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
|
||||
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
|
||||
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
|
||||
}
|
||||
|
||||
@test
|
||||
public thingWithoutMetaClass() {
|
||||
const dishCopy = Object.assign({}, dish);
|
||||
const dishCopy = clone(dish);
|
||||
const typeNonExistant = eval("(x) => x + 'typeNonExistant';");
|
||||
// this will assign a non existant SCThingType to dishCopy
|
||||
dishCopy.type = typeNonExistant();
|
||||
|
||||
344
test/Type.spec.ts
Normal file
344
test/Type.spec.ts
Normal file
@@ -0,0 +1,344 @@
|
||||
import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks';
|
||||
import {SCThing, SCThingWithoutReferences} from '../src/core/Thing';
|
||||
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/core/things/AcademicEvent';
|
||||
import {SCArticle, SCArticleWithoutReferences} from '../src/core/things/Article';
|
||||
import {SCBook, SCBookWithoutReferences} from '../src/core/things/Book';
|
||||
import {SCBuilding, SCBuildingWithoutReferences} from '../src/core/things/Building';
|
||||
import {SCCatalog, SCCatalogWithoutReferences} from '../src/core/things/Catalog';
|
||||
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/core/things/CourseOfStudies';
|
||||
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/core/things/DateSeries';
|
||||
import {SCDiff, SCDiffWithoutReferences} from '../src/core/things/Diff';
|
||||
import {SCDish, SCDishWithoutReferences} from '../src/core/things/Dish';
|
||||
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/core/things/Favorite';
|
||||
import {SCFloor, SCFloorWithoutReferences} from '../src/core/things/Floor';
|
||||
import {SCMessage, SCMessageWithoutReferences} from '../src/core/things/Message';
|
||||
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/core/things/Organization';
|
||||
import {SCPerson, SCPersonWithoutReferences} from '../src/core/things/Person';
|
||||
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/core/things/PointOfInterest';
|
||||
import {SCRoom, SCRoomWithoutReferences} from '../src/core/things/Room';
|
||||
import {SCSemester, SCSemesterWithoutReferences} from '../src/core/things/Semester';
|
||||
import {SCSetting, SCSettingWithoutReferences} from '../src/core/things/Setting';
|
||||
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/core/things/SportCourse';
|
||||
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/core/things/StudyModule';
|
||||
import {SCTicket, SCTicketWithoutReferences} from '../src/core/things/Ticket';
|
||||
import {SCToDo, SCToDoWithoutReferences} from '../src/core/things/ToDo';
|
||||
import {SCTour, SCTourWithoutReferences} from '../src/core/things/Tour';
|
||||
import {SCVideo, SCVideoWithoutReferences} from '../src/core/things/Video';
|
||||
|
||||
/**
|
||||
* Check if E extends T
|
||||
*/
|
||||
type Extends<E, T> = E extends T ? true : false;
|
||||
|
||||
/**
|
||||
* Get type of array elements up to nesting level 3
|
||||
*/
|
||||
type ElementType<T> = T extends any[] ?
|
||||
(T[0] extends any[] ?
|
||||
(T[0][0] extends any[] ?
|
||||
T[0][0][0] : T[0][0]) : T[0]) : T;
|
||||
|
||||
/**
|
||||
* Get types of properties
|
||||
*
|
||||
* - Extracts only the properties which extend object and are not any.
|
||||
* - If type is an array it returns the type of the elements.
|
||||
*/
|
||||
type PropertyTypes<T> = Extract<ElementType<T extends object ?
|
||||
(IsAny<T[keyof T]> extends true ?
|
||||
never : T[keyof T]) : never>
|
||||
, object>;
|
||||
|
||||
/**
|
||||
* Get nested property types
|
||||
*/
|
||||
type PropertyTypesNested<T> = PropertyTypes<T> extends object ? PropertyTypes<PropertyTypes<T>> : PropertyTypes<T>;
|
||||
|
||||
/**
|
||||
* Types of properties of SCDiff
|
||||
*/
|
||||
type SCDiffPropertyTypes = PropertyTypesNested<SCDiff>;
|
||||
assert<NotHas<SCDiffPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCDiffPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCDiffPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCDiffPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCDiffWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCDiff, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCAcademicEvent
|
||||
*/
|
||||
type SCAcademicEventPropertyTypes = PropertyTypesNested<SCAcademicEvent>;
|
||||
assert<NotHas<SCAcademicEventPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCAcademicEventPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCAcademicEventPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCAcademicEventPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCAcademicEventWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCAcademicEvent, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCArticle
|
||||
*/
|
||||
type SCArticlePropertyTypes = PropertyTypesNested<SCArticle>;
|
||||
assert<NotHas<SCArticlePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCArticlePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCArticlePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCArticlePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCArticleWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCArticle, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCBook
|
||||
*/
|
||||
type SCBookPropertyTypes = PropertyTypesNested<SCBook>;
|
||||
assert<NotHas<SCBookPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCBookPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCBookPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCBookPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCBookWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCBook, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCBuilding
|
||||
*/
|
||||
type SCBuildingPropertyTypes = PropertyTypesNested<SCBuilding>;
|
||||
assert<NotHas<SCBuildingPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCBuildingPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCBuildingPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCBuildingPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCBuildingWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCBuilding, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCCatalog
|
||||
*/
|
||||
type SCCatalogPropertyTypes = PropertyTypesNested<SCCatalog>;
|
||||
assert<NotHas<SCCatalogPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCCatalogPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCCatalogPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCCatalogPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCCatalogWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCCatalog, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCCourseOfStudies
|
||||
*/
|
||||
type SCCourseOfStudiesPropertyTypes = PropertyTypesNested<SCCourseOfStudies>;
|
||||
assert<NotHas<SCCourseOfStudiesPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCCourseOfStudiesPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCCourseOfStudiesPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCCourseOfStudiesPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCCourseOfStudiesWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCCourseOfStudies, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCDateSeries
|
||||
*/
|
||||
type SCDateSeriesPropertyTypes = PropertyTypesNested<SCDateSeries>;
|
||||
assert<NotHas<SCDateSeriesPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCDateSeriesPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCDateSeriesPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCDateSeriesPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCDateSeriesWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCDateSeries, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCDish
|
||||
*/
|
||||
type SCDishPropertyTypes = PropertyTypesNested<SCDish>;
|
||||
assert<NotHas<SCDishPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCDishPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCDishPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCDishPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCDishWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCDish, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCFavorite
|
||||
*/
|
||||
type SCFavoritePropertyTypes = PropertyTypesNested<SCFavorite>;
|
||||
assert<NotHas<SCFavoritePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCFavoritePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCFavoritePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCFavoritePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCFavoriteWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCFavorite, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCFloor
|
||||
*/
|
||||
type SCFloorPropertyTypes = PropertyTypesNested<SCFloor>;
|
||||
assert<NotHas<SCFloorPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCFloorPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCFloorPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCFloorPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCFloorWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCFloor, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCMessage
|
||||
*/
|
||||
type SCMessagePropertyTypes = PropertyTypesNested<SCMessage>;
|
||||
assert<NotHas<SCMessagePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCMessagePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCMessagePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCMessagePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCMessageWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCMessage, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCOrganization
|
||||
*/
|
||||
type SCOrganizationPropertyTypes = PropertyTypesNested<SCOrganization>;
|
||||
assert<NotHas<SCOrganizationPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCOrganizationPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCOrganizationPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCOrganizationPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCOrganizationWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCOrganization, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCPerson
|
||||
*/
|
||||
type SCPersonPropertyTypes = PropertyTypesNested<SCPerson>;
|
||||
assert<NotHas<SCPersonPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCPersonPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCPersonPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCPersonPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCPersonWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCPerson, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCPointOfInterest
|
||||
*/
|
||||
type SCPointOfInterestPropertyTypes = PropertyTypesNested<SCPointOfInterest>;
|
||||
assert<NotHas<SCPointOfInterestPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCPointOfInterestPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCPointOfInterestPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCPointOfInterestPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCPointOfInterestWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCPointOfInterest, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCRoom
|
||||
*/
|
||||
type SCRoomPropertyTypes = PropertyTypesNested<SCRoom>;
|
||||
assert<NotHas<SCRoomPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCRoomPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCRoomPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCRoomPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCRoomWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCRoom, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCSemester
|
||||
*/
|
||||
type SCSemesterPropertyTypes = PropertyTypesNested<SCSemester>;
|
||||
assert<NotHas<SCSemesterPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCSemesterPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCSemesterPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCSemesterPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCSemesterWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCSemester, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCSetting
|
||||
*/
|
||||
type SCSettingPropertyTypes = PropertyTypesNested<SCSetting>;
|
||||
assert<NotHas<SCSettingPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCSettingPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCSettingPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCSettingPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCSettingWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCSetting, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCSportCourse
|
||||
*/
|
||||
type SCSportCoursePropertyTypes = PropertyTypesNested<SCSportCourse>;
|
||||
assert<NotHas<SCSportCoursePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCSportCoursePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCSportCoursePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCSportCoursePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCSportCourseWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCSportCourse, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCStudyModule
|
||||
*/
|
||||
type SCStudyModulePropertyTypes = PropertyTypesNested<SCStudyModule>;
|
||||
assert<NotHas<SCStudyModulePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCStudyModulePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCStudyModulePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCStudyModulePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCStudyModuleWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCStudyModule, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCTicket
|
||||
*/
|
||||
type SCTicketPropertyTypes = PropertyTypesNested<SCTicket>;
|
||||
assert<NotHas<SCTicketPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCTicketPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCTicketPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCTicketPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCTicketWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCTicket, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCToDo
|
||||
*/
|
||||
type SCToDoPropertyTypes = PropertyTypesNested<SCToDo>;
|
||||
assert<NotHas<SCToDoPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCToDoPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCToDoPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCToDoPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCToDoWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCToDo, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCToDo
|
||||
*/
|
||||
type SCTourPropertyTypes = PropertyTypesNested<SCTour>;
|
||||
assert<NotHas<SCTourPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCTourPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCTourPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCTourPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCTourWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCTour, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Types of properties of SCVideo
|
||||
*/
|
||||
type SCVideoPropertyTypes = PropertyTypesNested<SCVideo>;
|
||||
assert<NotHas<SCVideoPropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCVideoPropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCVideoPropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCVideoPropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCVideoWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCVideo, SCThing>>(true);
|
||||
|
||||
/**
|
||||
* Dummy interface, to check if union types still resolve to any if one of the members is any
|
||||
*/
|
||||
interface Foo {
|
||||
bar: SCPerson;
|
||||
foo: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type that is unfortunately never - blame TypeScript
|
||||
*/
|
||||
type UnfortunatelyNever = PropertyTypesNested<Foo>;
|
||||
assert<IsNever<UnfortunatelyNever>>(true);
|
||||
|
||||
/**
|
||||
* Flat property types
|
||||
*/
|
||||
type FlatPropertyTypes<T> = T[keyof T];
|
||||
|
||||
/**
|
||||
* Type that is unfortunately any - blame TypeScript
|
||||
*/
|
||||
type UnfortunatelyAny = FlatPropertyTypes<Foo>;
|
||||
assert<IsAny<UnfortunatelyAny>>(true);
|
||||
@@ -20,12 +20,7 @@
|
||||
"startDate": "2018-04-01",
|
||||
"endDate": "2018-09-30",
|
||||
"eventsStartDate": "2018-04-09",
|
||||
"eventsEndDate": "2018-07-13",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"eventsEndDate": "2018-07-13"
|
||||
}
|
||||
],
|
||||
"performers": [
|
||||
@@ -36,12 +31,7 @@
|
||||
"familyName": "Bürgisser",
|
||||
"gender": "male",
|
||||
"honorificPrefix": "Prof. Dr.",
|
||||
"name": "Peter Bürgisser",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Peter Bürgisser"
|
||||
}
|
||||
],
|
||||
"majors": [
|
||||
@@ -59,12 +49,7 @@
|
||||
"maintainer": {
|
||||
"type": "organization",
|
||||
"name": "tubIT",
|
||||
"uid": "25f76840-db89-5da2-a8a2-75992f637613",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"uid": "25f76840-db89-5da2-a8a2-75992f637613"
|
||||
},
|
||||
"modified": "2018-09-01T10:00:00Z",
|
||||
"originalId": "foo bar",
|
||||
@@ -75,12 +60,7 @@
|
||||
"familyName": "Bürgisser",
|
||||
"gender": "male",
|
||||
"honorificPrefix": "Prof. Dr.",
|
||||
"name": "Peter Bürgisser",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Peter Bürgisser"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -20,12 +20,7 @@
|
||||
"startDate": "2018-04-01",
|
||||
"endDate": "2018-09-30",
|
||||
"eventsStartDate": "2018-04-09",
|
||||
"eventsEndDate": "2018-07-13",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"eventsEndDate": "2018-07-13"
|
||||
}
|
||||
],
|
||||
"performers": [
|
||||
@@ -36,12 +31,7 @@
|
||||
"familyName": "Liesen",
|
||||
"gender": "male",
|
||||
"honorificPrefix": "Prof. Dr.",
|
||||
"name": "Jörg Liesen",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Jörg Liesen"
|
||||
}
|
||||
],
|
||||
"catalogs": [
|
||||
@@ -53,12 +43,7 @@
|
||||
"categories": [
|
||||
"university events"
|
||||
],
|
||||
"name": "Mathematik: Lehrveranstaltungen für andere Fachrichtungen (Service)",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Mathematik: Lehrveranstaltungen für andere Fachrichtungen (Service)"
|
||||
}
|
||||
],
|
||||
"majors": [
|
||||
|
||||
@@ -20,12 +20,7 @@
|
||||
"startDate": "2018-04-01",
|
||||
"endDate": "2018-09-30",
|
||||
"eventsStartDate": "2018-04-09",
|
||||
"eventsEndDate": "2018-07-13",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"eventsEndDate": "2018-07-13"
|
||||
}
|
||||
],
|
||||
"performers": [
|
||||
@@ -35,12 +30,7 @@
|
||||
"givenName": "Paul",
|
||||
"familyName": "Breiding",
|
||||
"gender": "male",
|
||||
"name": "Paul Breiding",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Paul Breiding"
|
||||
},
|
||||
{
|
||||
"type": "person",
|
||||
@@ -48,12 +38,7 @@
|
||||
"givenName": "Pierre",
|
||||
"familyName": "Lairez",
|
||||
"gender": "male",
|
||||
"name": "Pierre Lairez",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Pierre Lairez"
|
||||
}
|
||||
],
|
||||
"catalogs": [
|
||||
@@ -64,12 +49,7 @@
|
||||
"categories": [
|
||||
"university events"
|
||||
],
|
||||
"name": "Mathematik: Grundstudiums-Veranstaltungen (Diplom, Bachelor)",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Mathematik: Grundstudiums-Veranstaltungen (Diplom, Bachelor)"
|
||||
},
|
||||
{
|
||||
"uid": "5a1f4f51-2498-5af1-91cb-c939673cc69c",
|
||||
@@ -79,12 +59,7 @@
|
||||
"categories": [
|
||||
"university events"
|
||||
],
|
||||
"name": "Mathematik: Lehrveranstaltungen für andere Fachrichtungen (Service)",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Mathematik: Lehrveranstaltungen für andere Fachrichtungen (Service)"
|
||||
}
|
||||
],
|
||||
"majors": [
|
||||
|
||||
@@ -10,12 +10,7 @@
|
||||
"uid": "10dfe386-71b4-554a-beb1-2d38561e42f8",
|
||||
"name": "Jutta Saatweber",
|
||||
"givenName": "Jutta",
|
||||
"familyName": "Saatweber",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"familyName": "Saatweber"
|
||||
}
|
||||
],
|
||||
"datePublished": "2007-08-01",
|
||||
@@ -23,12 +18,7 @@
|
||||
{
|
||||
"type": "organization",
|
||||
"uid": "28df2bb9-c854-5898-b9d5-1abbd3524804",
|
||||
"name": "Symposion Publishing",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Symposion Publishing"
|
||||
}
|
||||
],
|
||||
"inLanguages": [
|
||||
|
||||
@@ -10,12 +10,7 @@
|
||||
"uid": "10dfe386-71b4-554a-beb1-2d38561e42f8",
|
||||
"name": "Jutta Saatweber",
|
||||
"givenName": "Jutta",
|
||||
"familyName": "Saatweber",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"familyName": "Saatweber"
|
||||
}
|
||||
],
|
||||
"datePublished": "2007-08-01",
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
"WiSe 2017/18"
|
||||
],
|
||||
"startDate": "2017-10-01",
|
||||
"endDate": "2018-03-31",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"endDate": "2018-03-31"
|
||||
},
|
||||
"superCatalog": {
|
||||
"type": "catalog",
|
||||
@@ -31,12 +26,7 @@
|
||||
"university events"
|
||||
],
|
||||
"uid": "a7404d36-282d-546e-bfa5-6c7b25ba7838",
|
||||
"name": "Vorlesungsverzeichnis WS 2017/18",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Vorlesungsverzeichnis WS 2017/18"
|
||||
},
|
||||
"superCatalogs": [
|
||||
{
|
||||
@@ -46,12 +36,7 @@
|
||||
"university events"
|
||||
],
|
||||
"uid": "a7404d36-282d-546e-bfa5-6c7b25ba7838",
|
||||
"name": "Vorlesungsverzeichnis WS 2017/18",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Vorlesungsverzeichnis WS 2017/18"
|
||||
}
|
||||
],
|
||||
"origin": {
|
||||
|
||||
@@ -18,12 +18,7 @@
|
||||
"WiSe 2017/18"
|
||||
],
|
||||
"startDate": "2017-10-01",
|
||||
"endDate": "2018-03-31",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"endDate": "2018-03-31"
|
||||
},
|
||||
"superCatalog": {
|
||||
"uid": "2fdcccce-1948-5f5a-8938-3711b7e65e8a",
|
||||
@@ -32,12 +27,7 @@
|
||||
"categories": [
|
||||
"university events"
|
||||
],
|
||||
"name": "Mathematik",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Mathematik"
|
||||
},
|
||||
"superCatalogs": [
|
||||
{
|
||||
@@ -47,12 +37,7 @@
|
||||
"university events"
|
||||
],
|
||||
"uid": "a7404d36-282d-546e-bfa5-6c7b25ba7838",
|
||||
"name": "Vorlesungsverzeichnis WS 2017",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Vorlesungsverzeichnis WS 2017"
|
||||
},
|
||||
{
|
||||
"uid": "0718211b-d0c2-50fb-bc78-b968f20fd95b",
|
||||
@@ -61,12 +46,7 @@
|
||||
"categories": [
|
||||
"university events"
|
||||
],
|
||||
"name": "Fakultät II Mathematik und Naturwissenschaften",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Fakultät II Mathematik und Naturwissenschaften"
|
||||
},
|
||||
{
|
||||
"uid": "2fdcccce-1948-5f5a-8938-3711b7e65e8a",
|
||||
@@ -75,12 +55,7 @@
|
||||
"categories": [
|
||||
"university events"
|
||||
],
|
||||
"name": "Mathematik",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"name": "Mathematik"
|
||||
}
|
||||
],
|
||||
"origin": {
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
"academicDegreewithFieldShort": "B.A.",
|
||||
"department": {
|
||||
"name": "Technische Universität Berlin",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"type": "organization",
|
||||
"uid": "b0f878fd-8fda-53b8-b065-a8d854c3d0d2"
|
||||
},
|
||||
@@ -28,11 +23,6 @@
|
||||
},
|
||||
"secretary": {
|
||||
"name": "Technische Universität Berlin",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"type": "organization",
|
||||
"uid": "b0f878fd-8fda-53b8-b065-a8d854c3d0d2"
|
||||
},
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
52.51211
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
},
|
||||
"frequency": "once",
|
||||
@@ -41,12 +36,7 @@
|
||||
"majors": [
|
||||
"Economics BSc",
|
||||
"Wirtschaftsingenieurwesen BSc"
|
||||
],
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
]
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
|
||||
@@ -21,12 +21,7 @@
|
||||
],
|
||||
"uid": "b535c86a-777b-54c3-b89a-cad528d0580f",
|
||||
"name": "EMH 225",
|
||||
"floor": "2",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floorName": "2"
|
||||
},
|
||||
"frequency": "once",
|
||||
"dates": [
|
||||
@@ -38,12 +33,7 @@
|
||||
"name": "Distributed Algorithms",
|
||||
"categories": [
|
||||
"written exam"
|
||||
],
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
]
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
|
||||
@@ -21,12 +21,7 @@
|
||||
],
|
||||
"uid": "b535c86a-777b-54c3-b89a-cad528d0580f",
|
||||
"name": "EMH 225",
|
||||
"floor": "2",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floorName": "2"
|
||||
},
|
||||
"frequency": "once",
|
||||
"dates": [
|
||||
@@ -38,12 +33,7 @@
|
||||
"name": "Dance course for beginners",
|
||||
"categories": [
|
||||
"special"
|
||||
],
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
]
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
@@ -62,11 +52,6 @@
|
||||
},
|
||||
"provider": {
|
||||
"name": "Studentenwerk",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"type": "organization",
|
||||
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"uid": "072db1e5-e479-5040-88e0-4a98d731e443",
|
||||
"name": "Name One",
|
||||
"type": "message",
|
||||
"message": "Message",
|
||||
"messageBody": "Message",
|
||||
"audiences": [
|
||||
"students"
|
||||
],
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"uid": "072db1e5-e479-5040-88e0-4a98d731e443",
|
||||
"name": "Name One",
|
||||
"type": "message",
|
||||
"message": "Message",
|
||||
"messageBody": "Message",
|
||||
"audiences": [
|
||||
"students"
|
||||
],
|
||||
|
||||
@@ -29,11 +29,6 @@
|
||||
},
|
||||
"provider": {
|
||||
"name": "Studentenwerk",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"type": "organization",
|
||||
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
||||
},
|
||||
@@ -63,11 +58,6 @@
|
||||
"addressRegion": "Berlin",
|
||||
"postalCode": "10623",
|
||||
"streetAddress": "Hardenbergstraße 34"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
},
|
||||
"provider": {
|
||||
"name": "Studentenwerk",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"type": "organization",
|
||||
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
||||
},
|
||||
@@ -53,11 +48,6 @@
|
||||
"addressRegion": "Berlin",
|
||||
"postalCode": "10623",
|
||||
"streetAddress": "Hardenbergstraße 34"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
50.1743717
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
},
|
||||
"prices": {
|
||||
@@ -47,11 +42,6 @@
|
||||
},
|
||||
"provider": {
|
||||
"name": "Studentenwerk",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"type": "organization",
|
||||
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
||||
}
|
||||
@@ -95,12 +85,7 @@
|
||||
"name": "Pommes frites",
|
||||
"categories": [
|
||||
"side dish"
|
||||
],
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"characteristics": [
|
||||
@@ -128,12 +113,7 @@
|
||||
"categories": [
|
||||
"side dish",
|
||||
"salad"
|
||||
],
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"type": "dish",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user