mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-17 15:12:51 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68c5fcacbb | ||
|
|
56d43bb59a | ||
|
|
2ad314eda6 | ||
|
|
f2a86fb6bd | ||
|
|
198f48add4 | ||
|
|
5e29203e3d | ||
|
|
ca72c20bd0 | ||
|
|
da0507ee34 | ||
|
|
1a73208c6f | ||
|
|
1d6a2b7841 | ||
|
|
e3d3d022c7 | ||
|
|
bff6079f60 | ||
|
|
bac09ffebc | ||
|
|
1c5a931e09 | ||
|
|
e8da621558 | ||
|
|
6f12fbda94 | ||
|
|
cf83692e71 | ||
|
|
27417e80e1 | ||
|
|
bab675b806 | ||
|
|
d3790adbd8 | ||
|
|
d8aa023b28 | ||
|
|
4217e237fb | ||
|
|
c7e2584472 | ||
|
|
e30e04384f | ||
|
|
6fb9ccb821 | ||
|
|
9fb0a7c885 | ||
|
|
b5e0b76c24 | ||
|
|
a2f44762f9 | ||
|
|
d46abbe29b | ||
|
|
4986042428 | ||
|
|
3242411768 | ||
|
|
37e5f6c490 | ||
|
|
623ed613a9 | ||
|
|
fd994e2c08 | ||
|
|
8dc40dbb00 | ||
|
|
c4e30c5fdd | ||
|
|
81887315f8 | ||
|
|
55687daca9 |
@@ -1,4 +1,3 @@
|
||||
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
@@ -7,11 +6,10 @@ root = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# We recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
29
.gitignore
vendored
29
.gitignore
vendored
@@ -20,7 +20,7 @@ coverage
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
@@ -29,14 +29,14 @@ bower_components
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Typescript v1 declaration files
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
@@ -57,6 +57,29 @@ typings/
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
#DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
########## end of https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
|
||||
# ignore ide files
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# Ignore all files/folders by default
|
||||
# See https://stackoverflow.com/a/29932318
|
||||
/*
|
||||
|
||||
# Execept this files/folders
|
||||
!docs
|
||||
# Except these files/folders
|
||||
!lib
|
||||
lib/tsconfig.tsbuildinfo
|
||||
!LICENSE
|
||||
!package.json
|
||||
!package-lock.json
|
||||
!README.md
|
||||
!src
|
||||
test/*
|
||||
!test/resources/
|
||||
|
||||
57
CHANGELOG.md
57
CHANGELOG.md
@@ -1,3 +1,60 @@
|
||||
# [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)
|
||||
|
||||
|
||||
|
||||
# [0.15.0](https://gitlab.com/openstapps/core/compare/v0.14.0...v0.15.0) (2019-04-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042))
|
||||
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed61)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/3242411))
|
||||
|
||||
|
||||
|
||||
# [0.14.0](https://gitlab.com/openstapps/core/compare/v0.13.0...v0.14.0) (2019-04-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/8188731))
|
||||
|
||||
|
||||
|
||||
# [0.13.0](https://gitlab.com/openstapps/core/compare/v0.12.0...v0.13.0) (2019-04-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9))
|
||||
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fca))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2e)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
|
||||
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
||||
|
||||
|
||||
|
||||
# [0.12.0](https://gitlab.com/openstapps/core/compare/v0.11.0...v0.12.0) (2019-03-14)
|
||||
|
||||
|
||||
|
||||
4417
package-lock.json
generated
4417
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
47
package.json
47
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openstapps/core",
|
||||
"version": "0.13.0",
|
||||
"version": "0.19.0",
|
||||
"description": "StAppsCore - Generalized model of data",
|
||||
"keywords": [
|
||||
"Model",
|
||||
@@ -14,52 +14,56 @@
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run documentation",
|
||||
"build": "npm run tslint && npm run compile && npm run pack && npm run schema",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'",
|
||||
"check-configuration": "openstapps-configuration",
|
||||
"compile": "tsc",
|
||||
"compile": "rimraf lib && tsc",
|
||||
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
||||
"pack": "openstapps-core-tools pack",
|
||||
"prepublishOnly": "npm ci && npm run build",
|
||||
"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",
|
||||
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
|
||||
"tslint": "tslint 'src/**/*.ts'"
|
||||
},
|
||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"contributors": [
|
||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||
"Jovan Krunic <jovan.krunic@gmail.com>",
|
||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||
"Andreas Lehmann",
|
||||
"Sebastian Lange",
|
||||
"Rainer Killinger",
|
||||
"Imran Hossain"
|
||||
"Imran Hossain",
|
||||
"Michel Jonathan Schmitz",
|
||||
"Wieland Schöbl"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/geojson": "1.0.6",
|
||||
"@types/json-patch": "0.0.30",
|
||||
"@types/node": "10.14.6",
|
||||
"fast-clone": "1.5.13",
|
||||
"json-patch": "0.7.0",
|
||||
"jsonschema": "1.2.4",
|
||||
"ts-optchain": "0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/configuration": "0.8.0",
|
||||
"@openstapps/core-tools": "0.3.0",
|
||||
"@openstapps/logger": "0.0.5",
|
||||
"@krlwlfrt/async-pool": "0.1.0",
|
||||
"@openstapps/configuration": "0.14.0",
|
||||
"@openstapps/core-tools": "0.6.0",
|
||||
"@openstapps/logger": "0.1.0",
|
||||
"@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.19.0",
|
||||
"conventional-changelog-cli": "2.0.12",
|
||||
"mocha": "6.0.2",
|
||||
"commander": "2.20.0",
|
||||
"conventional-changelog-cli": "2.0.21",
|
||||
"mocha": "6.1.4",
|
||||
"mocha-typescript": "1.1.17",
|
||||
"nyc": "13.3.0",
|
||||
"nyc": "14.1.1",
|
||||
"rimraf": "2.6.3",
|
||||
"ts-node": "8.0.3",
|
||||
"tslint": "5.15.0",
|
||||
"source-map-support": "0.5.12",
|
||||
"ts-node": "8.1.0",
|
||||
"tslint": "5.16.0",
|
||||
"typedoc": "0.14.2",
|
||||
"typescript": "3.4.1"
|
||||
"typescript": "3.4.5"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
@@ -67,7 +71,7 @@
|
||||
"lines": 95,
|
||||
"statements": 95,
|
||||
"functions": 95,
|
||||
"branches": 95,
|
||||
"branches": 85,
|
||||
"include": [
|
||||
"src/core/Route.ts",
|
||||
"src/core/Thing.ts",
|
||||
@@ -82,5 +86,10 @@
|
||||
"text-summary"
|
||||
],
|
||||
"all": true
|
||||
},
|
||||
"openstappsConfiguration": {
|
||||
"hasCli": false,
|
||||
"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';
|
||||
@@ -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.
|
||||
|
||||
@@ -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,9 +49,9 @@ export enum SCThingType {
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing
|
||||
* A thing without references
|
||||
*/
|
||||
export interface SCThing {
|
||||
export interface SCThingWithoutReferences {
|
||||
/**
|
||||
* Alternate names of the thing
|
||||
*/
|
||||
@@ -62,7 +63,7 @@ export interface SCThing {
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Image of the thing
|
||||
* URL of an image of the thing
|
||||
*/
|
||||
image?: string;
|
||||
/**
|
||||
@@ -71,10 +72,6 @@ export interface SCThing {
|
||||
* @minLength 1
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Origin of the thing
|
||||
*/
|
||||
origin: SCThingRemoteOrigin | SCThingUserOrigin;
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
@@ -95,6 +92,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 +119,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
|
||||
@@ -149,7 +156,7 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
|
||||
*
|
||||
* e.g. an organizer for an event
|
||||
*/
|
||||
responsibleEntity?: SCPerson | SCOrganization;
|
||||
responsibleEntity?: SCPersonWithoutReferences | SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Type of the origin
|
||||
@@ -222,7 +229,7 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Set type definiton for singleton instance
|
||||
*/
|
||||
protected static _instance: SCThingMeta;
|
||||
protected static _instance = new Map<string, unknown>();
|
||||
|
||||
/**
|
||||
* Translations of fields
|
||||
@@ -255,7 +262,7 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
type: 'Ding',
|
||||
},
|
||||
@@ -268,9 +275,12 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
* Function to retrieve typed singleton instance
|
||||
*/
|
||||
public static getInstance<T extends SCThingMeta>(): T {
|
||||
const typedThis = this as any as typeof SCThingMeta;
|
||||
return (typedThis._instance || (typedThis._instance = new this())) as T;
|
||||
if (!this._instance.has(this.name)) {
|
||||
this._instance.set(this.name, new this());
|
||||
}
|
||||
return this._instance.get(this.name) as T;
|
||||
}
|
||||
|
||||
protected constructor() {}
|
||||
protected constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,30 +12,33 @@
|
||||
* 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';
|
||||
|
||||
/**
|
||||
* 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 cache: LRUCache<SCThing>;
|
||||
|
||||
/**
|
||||
* Property providing a mapping from a SCThingType to its known own meta class
|
||||
*/
|
||||
private metaClasses: typeof SCClasses;
|
||||
|
||||
@@ -45,42 +48,44 @@ export class SCThingTranslator {
|
||||
* // 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 = 200) {
|
||||
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> {
|
||||
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]);
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -98,19 +103,19 @@ 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) {
|
||||
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
|
||||
Object.keys(metaClass.fieldTranslations[language]).forEach((key) => {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
|
||||
});
|
||||
@@ -132,120 +137,34 @@ export class SCThingTranslator {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,33 +180,27 @@ 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
|
||||
@@ -300,4 +213,129 @@ export class SCThingTranslator {
|
||||
// return {...{}, ...this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T};
|
||||
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 = (language) ? language : this.language;
|
||||
// Recursively call this function on all nested SCThings, arrays and objects
|
||||
Object.keys(instance).forEach((key) => {
|
||||
if (
|
||||
isThing((instance as any)[key]) ||
|
||||
instance[key] instanceof Array ||
|
||||
instance[key] instanceof Object) {
|
||||
instance[key] = this.translateWholeThingDestructively(instance[key], targetLanguage);
|
||||
}
|
||||
});
|
||||
|
||||
// Spread variable translations given by the connector into thing
|
||||
if (typeof instance.translations !== 'undefined') {
|
||||
if (typeof instance.translations![targetLanguage] !== 'undefined') {
|
||||
instance = {...instance, ...instance.translations![targetLanguage]} as typeof instance;
|
||||
}
|
||||
}
|
||||
// Spread known translations from meta classes into (partly) translated thing
|
||||
this.replaceAvailableMetaFieldValueTranslations(instance, targetLanguage);
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* LRUCache class
|
||||
* Small last recently used cache intended to get used by SCThingTranslator
|
||||
*/
|
||||
class LRUCache<T> {
|
||||
/**
|
||||
* Map property that manages cached content
|
||||
*/
|
||||
private entries: Map<string, T> = new Map<string, T>();
|
||||
|
||||
/**
|
||||
* Property representing cache maximum capacity
|
||||
*/
|
||||
private maxEntries: number;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @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 (entry) {
|
||||
// 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,39 +12,46 @@
|
||||
* 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)
|
||||
*/
|
||||
academicDegreewithField: string;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* The achievable academic degree with academic field specification
|
||||
* shorted (eg. M.Sc.).
|
||||
*/
|
||||
academicDegreewithFieldShort: string;
|
||||
}
|
||||
|
||||
export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences {
|
||||
/**
|
||||
* An academic degree
|
||||
*/
|
||||
export interface SCAcademicDegree
|
||||
extends SCAcademicDegreeWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic degrees
|
||||
*/
|
||||
export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
|
||||
export class SCAcademicDegreeMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCAcademicDegree> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
@@ -86,11 +93,12 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati
|
||||
/**
|
||||
* Types of (german) academic degrees
|
||||
*/
|
||||
export type SCGermanAcademicDegree = 'bachelor' |
|
||||
'diploma' |
|
||||
'doctor' |
|
||||
'licentiate' |
|
||||
'magister' |
|
||||
'master' |
|
||||
'master pupil' |
|
||||
'state examination' ;
|
||||
export type SCGermanAcademicDegree =
|
||||
'bachelor'
|
||||
| 'diploma'
|
||||
| 'doctor'
|
||||
| 'licentiate'
|
||||
| 'magister'
|
||||
| 'master'
|
||||
| 'master pupil'
|
||||
| 'state examination' ;
|
||||
|
||||
@@ -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,14 +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 {SCThing, SCThingMeta} from '../Thing';
|
||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* An academic term without references
|
||||
*/
|
||||
export interface SCAcademicTermWithoutReferences extends SCThing {
|
||||
export interface SCAcademicTermWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Short name of the academic term, using the given pattern
|
||||
*/
|
||||
@@ -46,31 +47,40 @@ export interface SCAcademicTermWithoutReferences extends SCThing {
|
||||
startDate: SCISO8601Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* An academic term
|
||||
*/
|
||||
export interface SCAcademicTerm
|
||||
extends SCAcademicTermWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic terms
|
||||
*/
|
||||
export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
export class SCAcademicTermWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
@@ -21,12 +21,14 @@ import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './ThingThatCanBeOffered';
|
||||
|
||||
/**
|
||||
* A creative work without references
|
||||
*/
|
||||
export interface SCCreativeWorkWithoutReferences extends SCThing {
|
||||
export interface SCCreativeWorkWithoutReferences
|
||||
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* Date the creative work was published
|
||||
*/
|
||||
@@ -51,7 +53,8 @@ export interface SCCreativeWorkWithoutReferences extends SCThing {
|
||||
/**
|
||||
* A creative work
|
||||
*/
|
||||
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
export interface SCCreativeWork
|
||||
extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
@@ -82,28 +85,29 @@ 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().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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,7 +22,8 @@ import {SCCreativeWorkWithoutReferences} from './CreativeWork';
|
||||
/**
|
||||
* An event without references
|
||||
*/
|
||||
export interface SCEventWithoutReferences extends SCThing {
|
||||
export interface SCEventWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Maximum number of participants of the event
|
||||
*
|
||||
@@ -41,7 +42,8 @@ export interface SCEventWithoutReferences extends SCThing {
|
||||
/**
|
||||
* An event
|
||||
*/
|
||||
export interface SCEvent extends SCEventWithoutReferences {
|
||||
export interface SCEvent
|
||||
extends SCEventWithoutReferences, SCThing {
|
||||
/**
|
||||
* Academic terms that an event belongs to, e.g. semester(s).
|
||||
*/
|
||||
@@ -73,28 +75,29 @@ export interface SCEvent extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Meta information about events
|
||||
*/
|
||||
export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
export class SCEventMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -44,38 +45,53 @@ 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?: 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().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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().fieldTranslations.de,
|
||||
inPlace: 'Ort',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
inPlace: 'location',
|
||||
},
|
||||
};
|
||||
@@ -42,12 +46,12 @@ export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 {SCMetaTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
@@ -24,41 +24,50 @@ export type SCThingThatAcceptsPaymentsAcceptedPayments =
|
||||
| 'Cafeteria Card';
|
||||
|
||||
/**
|
||||
* A place without references that accepts payments
|
||||
* A thing without references that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThing {
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Accepted payments of the place
|
||||
*/
|
||||
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPayments
|
||||
extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta extends SCThingMeta implements
|
||||
SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> {
|
||||
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 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,12 +12,12 @@
|
||||
* 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, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
||||
import {SCPersonWithoutReferences} from '../things/Person';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCInPlace} from '../types/Places';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
import {SCInPlace} from './../types/Places';
|
||||
|
||||
/**
|
||||
* Default price without distinction
|
||||
@@ -32,7 +32,8 @@ export interface SCPriceGroup {
|
||||
/**
|
||||
* Price distinctions for academic context
|
||||
*/
|
||||
export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
export interface SCAcademicPriceGroup
|
||||
extends SCPriceGroup {
|
||||
/**
|
||||
* Price for employees
|
||||
*/
|
||||
@@ -50,10 +51,21 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing without references that has a price tag
|
||||
* A thing without references that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Translations of a thing that can be offered
|
||||
*/
|
||||
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thing that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
|
||||
extends SCThing {
|
||||
extends SCThing, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* List of offers for that thing
|
||||
*/
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -22,9 +22,8 @@ import {SCMap} from '../types/Map';
|
||||
* !!! BEWARE !!!
|
||||
* `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
||||
*/
|
||||
export interface SCThingWithCategoriesWithoutReferences<T,
|
||||
U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThing {
|
||||
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Categories of a thing with categories
|
||||
*/
|
||||
@@ -43,10 +42,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
|
||||
*/
|
||||
@@ -70,7 +81,7 @@ export interface SCThingWithCategoriesSpecificValues {
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Category specific image of a thing
|
||||
* URL of a category specific image of a thing
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
@@ -88,8 +99,8 @@ export interface SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U> implements
|
||||
SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||
|
||||
protected static _instance: SCThingMeta;
|
||||
|
||||
@@ -98,22 +109,22 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U> implements
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -42,6 +42,7 @@ export abstract class SCError implements SCErrorResponse {
|
||||
|
||||
/**
|
||||
* Instatiate an SCError
|
||||
*
|
||||
* @param name Name of the error
|
||||
* @param message Message of the error
|
||||
* @param statusCode HTTP status code to return this error with
|
||||
@@ -66,6 +67,7 @@ export class SCValidationErrorResponse extends SCError {
|
||||
|
||||
/**
|
||||
* Create a SCValidationErrorResponse
|
||||
*
|
||||
* @param errors List of validation errors
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
@@ -81,6 +83,7 @@ export class SCValidationErrorResponse extends SCError {
|
||||
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCUnsupportedMediaTypeErrorResponse
|
||||
*
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
@@ -94,6 +97,7 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||
export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCMethodNotAllowedErrorResponse
|
||||
*
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
@@ -120,6 +124,7 @@ export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCTooManyRequestsErrorResponse
|
||||
*
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
@@ -133,6 +138,7 @@ export class SCTooManyRequestsErrorResponse extends SCError {
|
||||
export class SCNotFoundErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCNotFoundErrorResponse
|
||||
*
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
@@ -140,12 +146,80 @@ export class SCNotFoundErrorResponse extends SCError {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
|
||||
* acceptable.
|
||||
*/
|
||||
export class SCParametersNotAcceptable extends SCError {
|
||||
/**
|
||||
* Create a ParametersNotAcceptable
|
||||
*
|
||||
* @param message contains more details to what you did wrong
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('ParametersNotAcceptable', message, 406, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
|
||||
* running at the same time.
|
||||
* This usually indicates that there is more than one instance a plugin running.
|
||||
*/
|
||||
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a PluginAlreadyRegisteredError
|
||||
*
|
||||
* @param message contains potential differences in other parameters outside of the name
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('PluginRegisteringFailedError', message, 409, stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned whenever there is an unexpected error while creating a plugin
|
||||
*/
|
||||
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a PluginRegisteringFailedError
|
||||
*
|
||||
* @param message Describes what went wrong wile registering the plugin
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that is returned whenever there is a syntax error
|
||||
*/
|
||||
export class SCSyntaxErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SyntaxError
|
||||
*
|
||||
* @param message Describes the syntax error
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
@@ -165,6 +239,7 @@ 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
|
||||
* and the internal server error should be displayed to the client
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
116
src/core/protocol/routes/plugin/PluginRegisterRequest.ts
Normal file
116
src/core/protocol/routes/plugin/PluginRegisterRequest.ts
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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 {Schema} from 'jsonschema';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {
|
||||
SCInternalServerErrorResponse,
|
||||
SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable,
|
||||
SCPluginAlreadyRegisteredErrorResponse,
|
||||
SCPluginRegisteringFailedErrorResponse,
|
||||
SCPluginRouteAlreadyRegisteredErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
} from '../../errors/ErrorResponse';
|
||||
|
||||
/**
|
||||
* Plugin register request
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
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';
|
||||
|
||||
/**
|
||||
* Plugin information needed for its registration
|
||||
*/
|
||||
plugin: SCPluginMetaData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
action: 'remove';
|
||||
|
||||
/**
|
||||
* The route of the plugin you want to remove
|
||||
*/
|
||||
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
|
||||
*/
|
||||
export class SCPluginRegisterRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
SCInternalServerErrorResponse,
|
||||
SCMethodNotAllowedErrorResponse,
|
||||
SCParametersNotAcceptable,
|
||||
SCPluginAlreadyRegisteredErrorResponse,
|
||||
SCPluginRegisteringFailedErrorResponse,
|
||||
SCPluginRouteAlreadyRegisteredErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
];
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||
this.statusCodeSuccess = 200;
|
||||
this.urlFragment = '/plugin/register';
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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,12 +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 {SCThing, SCThingTranslatableProperties} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A thing that has translations
|
||||
* Plugin register response
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCThingWithTranslations extends SCThing {
|
||||
translations: SCTranslations<SCThingTranslatableProperties>;
|
||||
export interface SCPluginRegisterResponse {
|
||||
/**
|
||||
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
|
||||
*/
|
||||
success: boolean;
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||
import {SCSearchContext} from '../../../types/config/Backend';
|
||||
import {SCSearchFilter} from '../../../types/filters/Abstract';
|
||||
import {SCSearchSort} from '../../../types/sorts/Abstract';
|
||||
import {
|
||||
@@ -37,7 +38,12 @@ export interface SCSearchRequest extends SCSearchQuery {
|
||||
*/
|
||||
export interface SCSearchQuery {
|
||||
/**
|
||||
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
|
||||
* The context name from where the search query was initiated
|
||||
*/
|
||||
context?: SCSearchContext;
|
||||
|
||||
/**
|
||||
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
|
||||
*/
|
||||
filter?: SCSearchFilter;
|
||||
|
||||
|
||||
@@ -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,8 +28,7 @@ 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
|
||||
*/
|
||||
@@ -55,7 +55,9 @@ export interface SCAcademicEventWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences {
|
||||
export interface SCAcademicEvent
|
||||
extends SCEvent, SCAcademicEventWithoutReferences,
|
||||
SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
*/
|
||||
@@ -104,37 +106,39 @@ export interface SCAcademicEventTranslatableProperties
|
||||
/**
|
||||
* Meta information about academic events
|
||||
*/
|
||||
export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<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().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCEventMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCEventMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
type: 'akademische Veranstaltung',
|
||||
},
|
||||
en: {
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCEventMeta.getInstance().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,8 +33,7 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
*/
|
||||
export interface SCArticleWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Article itself as markdown
|
||||
*/
|
||||
@@ -55,7 +55,9 @@ export interface SCArticleWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences {
|
||||
export interface SCArticle
|
||||
extends SCCreativeWork, SCArticleWithoutReferences,
|
||||
SCThingWithCategories<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
@@ -86,37 +88,38 @@ 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().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
type: 'Artikel',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().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,7 +26,8 @@ import {SCPersonWithoutReferences} from './Person';
|
||||
/**
|
||||
* A book without references
|
||||
*/
|
||||
export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
export interface SCBookWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* Edition of a book
|
||||
*/
|
||||
@@ -58,7 +59,8 @@ export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBook extends SCCreativeWork, SCBookWithoutReferences {
|
||||
export interface SCBook
|
||||
extends SCCreativeWork, SCBookWithoutReferences {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
@@ -95,23 +97,23 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Buch',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().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,8 +39,7 @@ export type SCBuildingCategories =
|
||||
| 'restroom';
|
||||
|
||||
export interface SCBuildingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Categories of a building
|
||||
@@ -66,7 +67,9 @@ export interface SCBuildingWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBuilding extends SCBuildingWithoutReferences {
|
||||
export interface SCBuilding
|
||||
extends SCBuildingWithoutReferences, SCPlace,
|
||||
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a building
|
||||
*/
|
||||
@@ -79,39 +82,41 @@ export interface SCBuilding extends SCBuildingWithoutReferences {
|
||||
}
|
||||
|
||||
export interface SCBuildingTranslatableProperties
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||
floors?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<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().fieldTranslations.de,
|
||||
floors: 'Etagen',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 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().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
@@ -125,9 +130,9 @@ 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().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,19 +14,20 @@
|
||||
*/
|
||||
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations} from '../types/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* A catalog without references
|
||||
*/
|
||||
export interface SCCatalogWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues> {
|
||||
extends SCThingWithCategoriesWithoutReferences<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
|
||||
*
|
||||
@@ -45,7 +46,9 @@ export interface SCCatalogWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCCatalog extends SCCatalogWithoutReferences {
|
||||
export interface SCCatalog
|
||||
extends SCCatalogWithoutReferences, SCThing,
|
||||
SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Academic term that a catalog belongs to (e.g. semester)
|
||||
*/
|
||||
@@ -61,42 +64,48 @@ export interface SCCatalog extends SCCatalogWithoutReferences {
|
||||
*/
|
||||
superCatalogs?: SCCatalogWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a catalog
|
||||
*/
|
||||
translations?: SCTranslations<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,
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
type: 'Verzeichnis',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
type: SCThingType.Catalog,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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,21 +12,23 @@
|
||||
* 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 {SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
|
||||
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from '../base/AcademicDegree';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
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,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
export interface SCCourseOfStudiesWithoutReferences
|
||||
extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The main language in which the course of studies
|
||||
* is beeing offered
|
||||
@@ -64,55 +66,67 @@ export interface SCCourseOfStudiesWithoutReferences extends
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
|
||||
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
|
||||
* 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
|
||||
*/
|
||||
startDates?: SCDateSeriesWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a course of studies
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of studies
|
||||
*/
|
||||
type: SCThingType.CourseOfStudies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a course of studies
|
||||
*/
|
||||
export interface SCCourseOfStudiesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
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().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
|
||||
...SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
|
||||
modes: {
|
||||
combination: 'Kombinationsstudiengang',
|
||||
dual: 'Dualer Studiengang',
|
||||
@@ -122,7 +136,7 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
|
||||
type: 'Studiengang',
|
||||
},
|
||||
en: {
|
||||
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
|
||||
academicDegree: 'Hochschulabschluss',
|
||||
department: 'Fachbereich',
|
||||
major: 'Studienfach',
|
||||
@@ -136,13 +150,13 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
|
||||
/**
|
||||
* Types of (german) course of studies modes
|
||||
*/
|
||||
export type SCCourseOfStudiesMode = 'combination' |
|
||||
'dual' |
|
||||
'double-degree' |
|
||||
'standard' ;
|
||||
export type SCCourseOfStudiesMode = 'combination'
|
||||
| 'dual'
|
||||
| 'double-degree'
|
||||
| 'standard' ;
|
||||
|
||||
/**
|
||||
* Types of (german) course of studies time modes
|
||||
*/
|
||||
export type SCCourseOfStudiesTimeMode = 'fulltime' |
|
||||
'parttime' ;
|
||||
export type SCCourseOfStudiesTimeMode = 'fulltime'
|
||||
| 'parttime' ;
|
||||
|
||||
@@ -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.
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
@@ -28,7 +29,8 @@ import {SCSportCourseWithoutReferences} from './SportCourse';
|
||||
/**
|
||||
* Price groups for sport courses
|
||||
*/
|
||||
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
export interface SCSportCoursePriceGroup
|
||||
extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* Price for alumnis
|
||||
*/
|
||||
@@ -39,7 +41,7 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
* A date without references
|
||||
*/
|
||||
export interface SCDateSeriesWithoutReferences
|
||||
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* Dates of the date series that are initially planned to be held
|
||||
*/
|
||||
@@ -76,7 +78,10 @@ export interface SCDateSeriesWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace {
|
||||
export interface SCDateSeries
|
||||
extends SCDateSeriesWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
/**
|
||||
* Event to which the date series belongs
|
||||
*/
|
||||
@@ -102,32 +107,34 @@ export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPl
|
||||
/**
|
||||
* 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().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
frequency: 'Wiederholung',
|
||||
type: 'Wiederholungreihe',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.DateSeries,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -48,7 +49,8 @@ export interface SCDiffWithoutReferences extends SCThing {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCDiff extends SCDiffWithoutReferences {
|
||||
export interface SCDiff
|
||||
extends SCDiffWithoutReferences, SCThing {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
@@ -63,37 +65,34 @@ export interface SCDiff extends SCDiffWithoutReferences {
|
||||
/**
|
||||
* Meta information about a diff
|
||||
*/
|
||||
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
|
||||
/**
|
||||
* Set type definiton for singleton instance
|
||||
*/
|
||||
protected static _instance: SCThingMeta;
|
||||
|
||||
export class SCDiffMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDiff> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
action: 'Aktion',
|
||||
changes: 'Änderungen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Unterschied',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Diff,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 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,8 +16,10 @@ import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -30,11 +32,8 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
* A dish without references
|
||||
*/
|
||||
export interface SCDishWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
extends SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*/
|
||||
@@ -71,7 +70,9 @@ export interface SCDishWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCDish extends SCDishWithoutReferences {
|
||||
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)
|
||||
*/
|
||||
@@ -101,7 +102,7 @@ export interface SCDishTranslatableProperties
|
||||
*/
|
||||
export interface SCDishCharacteristic {
|
||||
/**
|
||||
* URL to the image of the characteristic
|
||||
* URL of an image of the characteristic
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
@@ -167,28 +168,30 @@ 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,
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
appetizer: 'Vorspeise',
|
||||
dessert: 'Nachtisch',
|
||||
@@ -200,8 +203,8 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
|
||||
type: 'Essen',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
type: SCThingType.Dish,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -40,8 +40,9 @@ export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences
|
||||
/**
|
||||
* A favorite without references
|
||||
*/
|
||||
export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences {
|
||||
|
||||
export interface SCFavoriteWithoutReferences
|
||||
extends SCSaveableThingWithoutReferences {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +50,8 @@ export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutRefer
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCFavorite extends SCSaveableThing<SCFavoriteDataTypes> {
|
||||
export interface SCFavorite
|
||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
@@ -59,5 +61,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.
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingType} from '../Thing';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
||||
import {SCRoomWithoutReferences} from './Room';
|
||||
@@ -22,7 +22,8 @@ import {SCRoomWithoutReferences} from './Room';
|
||||
/**
|
||||
* A floor without references
|
||||
*/
|
||||
export interface SCFloorWithoutReferences extends SCThing {
|
||||
export interface SCFloorWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
||||
*/
|
||||
@@ -49,7 +50,8 @@ export interface SCFloorWithoutReferences extends SCThing {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
export interface SCFloor
|
||||
extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
@@ -86,7 +88,8 @@ export interface SCFloorFeatureWithPlace<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
|
||||
*/
|
||||
@@ -96,29 +99,31 @@ 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().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Etage',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Floor,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -58,7 +59,8 @@ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferen
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
export interface SCMessage
|
||||
extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
@@ -92,29 +94,31 @@ export interface SCMessageTranslatableProperties
|
||||
/**
|
||||
* Meta information about messages
|
||||
*/
|
||||
export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
|
||||
export class SCMessageMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCMessage> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Nachricht',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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,12 +13,13 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
|
||||
/**
|
||||
* An organization without references
|
||||
*/
|
||||
export interface SCOrganizationWithoutReferences extends SCThing {
|
||||
export interface SCOrganizationWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
@@ -30,7 +31,8 @@ export interface SCOrganizationWithoutReferences extends SCThing {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
export interface SCOrganization
|
||||
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
|
||||
@@ -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,7 +23,8 @@ import {SCRoomWithoutReferences} from './Room';
|
||||
/**
|
||||
* A person without references
|
||||
*/
|
||||
export interface SCPersonWithoutReferences extends SCThing {
|
||||
export interface SCPersonWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Additional first names of the person.
|
||||
*/
|
||||
@@ -102,7 +103,8 @@ export interface SCPersonWithoutReferences extends SCThing {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCPerson extends SCPersonWithoutReferences {
|
||||
export interface SCPerson
|
||||
extends SCPersonWithoutReferences, SCThing {
|
||||
/**
|
||||
* Organization the person works for
|
||||
*/
|
||||
@@ -129,29 +131,31 @@ export interface SCPerson extends SCPersonWithoutReferences {
|
||||
/**
|
||||
* Meta information about a person
|
||||
*/
|
||||
export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPerson> {
|
||||
export class SCPersonMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPerson> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Person',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Person,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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 {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
@@ -27,8 +28,7 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
* A point of interest without references
|
||||
*/
|
||||
export interface SCPointOfInterestWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
@@ -46,7 +46,9 @@ export interface SCPointOfInterestWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace {
|
||||
export interface SCPointOfInterest
|
||||
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
||||
SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
*/
|
||||
@@ -71,39 +73,41 @@ export type SCPointOfInterestCategories =
|
||||
/**
|
||||
* Meta information about points of interest
|
||||
*/
|
||||
export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations<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().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().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().fieldValueTranslations.de,
|
||||
type: 'Sonderziel',
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance().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,
|
||||
@@ -81,7 +83,9 @@ export interface SCRoomWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
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,7 +102,8 @@ export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Category specific values of a room
|
||||
*/
|
||||
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
|
||||
export interface SCRoomSpecificValues
|
||||
extends SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific opening hours of the room
|
||||
*/
|
||||
@@ -108,37 +113,39 @@ export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValue
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<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().fieldTranslations.de,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.en,
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 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().fieldValueTranslations.de,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
@@ -157,11 +164,11 @@ 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().fieldValueTranslations.en,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().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,14 +12,19 @@
|
||||
* 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.
|
||||
*
|
||||
@@ -38,7 +43,8 @@ export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutRefere
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSemester extends SCSemesterWithoutReferences {
|
||||
export interface SCSemester
|
||||
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||
/**
|
||||
* Type of the semester
|
||||
*/
|
||||
@@ -48,13 +54,15 @@ export interface SCSemester extends SCSemesterWithoutReferences {
|
||||
/**
|
||||
* Meta information about a semester
|
||||
*/
|
||||
export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
|
||||
export class SCSemesterMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCSemester> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de,
|
||||
acronym: 'Abkürzung',
|
||||
endDate: 'Ende',
|
||||
eventsEndDate: 'Vorlesungsschluss',
|
||||
@@ -62,20 +70,20 @@ export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
startDate: 'Beginn',
|
||||
},
|
||||
en: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Semester',
|
||||
},
|
||||
en: {
|
||||
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance().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,12 +13,13 @@
|
||||
* 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;
|
||||
@@ -28,11 +29,14 @@ export type SCSettingCategories = string;
|
||||
*/
|
||||
export interface SCSettingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
|
||||
/**
|
||||
* The type of input/value this setting is carrying
|
||||
* The default value of a setting
|
||||
*/
|
||||
input: SCSettingInputType;
|
||||
defaultValue: SCSettingValue | SCSettingValues;
|
||||
/**
|
||||
* The input type of this setting
|
||||
*/
|
||||
inputType: SCSettingInputType;
|
||||
/**
|
||||
* The order number this setting should show up in its category list
|
||||
*/
|
||||
@@ -45,23 +49,39 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* The types of input/value a setting object can carry
|
||||
*/
|
||||
export type SCSettingInputType = SCSettingSingleChoice
|
||||
| SCSettingMultipleChoice
|
||||
| SCSettingNumber
|
||||
| SCSettingText
|
||||
| SCSettingPassword;
|
||||
export enum SCSettingInputType {
|
||||
SingleChoice = 'single choice',
|
||||
MultipleChoice = 'multiple choice',
|
||||
Number = 'number',
|
||||
Text = 'text',
|
||||
Password = 'password',
|
||||
}
|
||||
|
||||
/**
|
||||
* A setting with references
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSetting extends SCSettingWithoutReferences {
|
||||
export interface SCSetting
|
||||
extends SCSettingWithoutReferences, SCThing,
|
||||
SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a setting
|
||||
*/
|
||||
translations?: SCTranslations<SCSettingValueTranslatableProperties>;
|
||||
/**
|
||||
* The type of this model
|
||||
*/
|
||||
@@ -69,58 +89,23 @@ export interface SCSetting extends SCSettingWithoutReferences {
|
||||
}
|
||||
|
||||
/**
|
||||
* Input type with single choice as value
|
||||
* The type a value of a setting can have
|
||||
*/
|
||||
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
|
||||
*/
|
||||
values?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,30 +118,43 @@ 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',
|
||||
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',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
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
|
||||
*/
|
||||
@@ -31,7 +32,8 @@ export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
export interface SCSportCourse
|
||||
extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
@@ -41,33 +43,35 @@ export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Meta information about a sport course
|
||||
*/
|
||||
export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations<SCSportCourse> {
|
||||
export class SCSportCourseMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCSportCourse> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
||||
... SCEventMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCEventMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
||||
... SCEventMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCEventMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Sportkurs',
|
||||
},
|
||||
en: {
|
||||
... SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCEventMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.SportCourse,
|
||||
},
|
||||
};
|
||||
|
||||
187
src/core/things/StudyModule.ts
Normal file
187
src/core/things/StudyModule.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
* 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 {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)
|
||||
*/
|
||||
ects: number;
|
||||
|
||||
/**
|
||||
* The language in which the study module is offered
|
||||
*/
|
||||
language: SCLanguage;
|
||||
|
||||
/**
|
||||
* Majors that this study module is meant for
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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,
|
||||
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,
|
||||
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().fieldValueTranslations.de,
|
||||
necessity: {
|
||||
'elective': 'Wahlfach',
|
||||
'optional': 'optional',
|
||||
'required': 'benötigt',
|
||||
},
|
||||
type: 'Studiengangmodul',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().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
|
||||
*/
|
||||
@@ -47,7 +48,8 @@ export interface SCTicketWithoutReferences extends SCThing {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
export interface SCTicket
|
||||
extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
@@ -57,29 +59,31 @@ export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Meta information about a ticket
|
||||
*/
|
||||
export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTicket> {
|
||||
export class SCTicketMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCTicket> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Ticket',
|
||||
},
|
||||
en: {
|
||||
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Ticket,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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';
|
||||
|
||||
/**
|
||||
@@ -51,7 +54,17 @@ export interface SCToDoWithoutReferences
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
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 +85,27 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,13 +12,14 @@
|
||||
* 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
|
||||
*/
|
||||
@@ -40,7 +41,8 @@ export interface SCTourWithoutReferences extends SCThing {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCTour extends SCTourWithoutReferences {
|
||||
export interface SCTour
|
||||
extends SCTourWithoutReferences, SCThing {
|
||||
/**
|
||||
* Type of a tour
|
||||
*/
|
||||
@@ -50,7 +52,9 @@ export interface SCTour extends SCTourWithoutReferences {
|
||||
/**
|
||||
* Meta information about a tour
|
||||
*/
|
||||
export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour> {
|
||||
export class SCTourMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCTour> {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -102,7 +103,8 @@ export interface SCVideoTrack {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
export interface SCVideo
|
||||
extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
/**
|
||||
* Persons acting in the Video
|
||||
*/
|
||||
@@ -117,29 +119,31 @@ export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
/**
|
||||
* Meta information about a video
|
||||
*/
|
||||
export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVideo> {
|
||||
export class SCVideoMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCVideo> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Video',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Video,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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,16 +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 {SCThingWithTranslations} from '../base/ThingWithTranslations';
|
||||
import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse';
|
||||
import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse';
|
||||
import {SCSearchResponse} from '../protocol/routes/search/SearchResponse';
|
||||
import {SCThing, SCThingType} from '../Thing';
|
||||
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||
import {SCTranslations} from './i18n';
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a SCThing
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isThing(something: any): something is SCThing {
|
||||
return (
|
||||
@@ -34,16 +34,17 @@ export function isThing(something: any): something is SCThing {
|
||||
/**
|
||||
* Type guard to check if translations exist
|
||||
*
|
||||
* @param {SCThing} thing Thing to check
|
||||
* @param thing Thing to check
|
||||
*/
|
||||
export function isThingWithTranslations(thing: SCThing): thing is SCThingWithTranslations {
|
||||
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
||||
: thing is SCThingWithoutReferences & { translations: SCTranslations<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'
|
||||
@@ -56,7 +57,7 @@ export function isBulkResponse(something: any): something is SCBulkResponse {
|
||||
/**
|
||||
* Type guard to check if something is a search response
|
||||
*
|
||||
* @param {any} something Something to check
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isSearchResponse(something: any): something is SCSearchResponse {
|
||||
return Array.isArray(something.data)
|
||||
|
||||
@@ -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.
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
/**
|
||||
* Capsulation for a map with a string as key with values of type `T`
|
||||
*
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
|
||||
*
|
||||
*
|
||||
* @typeparam T Can be any type.
|
||||
*/
|
||||
export interface SCMap<T> {
|
||||
@@ -27,3 +27,20 @@ export interface SCMap<T> {
|
||||
*/
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restricted map with keys, limited to values of `U`, and corresponding values of type `T`
|
||||
*
|
||||
* !!! BEWARE !!!
|
||||
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
|
||||
* Also note, that this is a type not an interface
|
||||
*
|
||||
* @typeparam U Must be a type the `in` operator can be applied to and contains only strings or numbers
|
||||
* @typeparam T Can be any type
|
||||
*/
|
||||
export type SCRestrictedMap<U extends string | number, T> = {
|
||||
/**
|
||||
* One value for each key
|
||||
*/
|
||||
[key in U]: 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.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import {SCThingType} from '../../Thing';
|
||||
import {SCSearchSortType} from '../sorts/Abstract';
|
||||
import {SCUuid} from '../UUID';
|
||||
import {SCMap} from './../Map';
|
||||
import {SCMap, SCRestrictedMap} from './../Map';
|
||||
import {SCMonitoringConfiguration} from './Monitoring';
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ export interface SCBackendConfigurationSortableField {
|
||||
|
||||
/**
|
||||
* A list of SC types on which this field exists
|
||||
*
|
||||
*
|
||||
* If no type is given it is assumed it exists on every type
|
||||
*/
|
||||
onlyOnTypes?: SCThingType[];
|
||||
@@ -84,10 +84,27 @@ export interface SCBackendConfigurationSortableField {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible context names to be used by the search request
|
||||
*/
|
||||
export type SCSearchContext =
|
||||
| 'default'
|
||||
| 'dining'
|
||||
| 'place';
|
||||
|
||||
/**
|
||||
* A boosting configuration for one context
|
||||
*/
|
||||
export type SCBackendConfigurationSearchBoostingContext =
|
||||
SCRestrictedMap<
|
||||
SCSearchContext,
|
||||
SCBackendConfigurationSearchBoostingType[]
|
||||
>;
|
||||
|
||||
/**
|
||||
* A boosting configuration for one SCType
|
||||
*/
|
||||
export interface SCBackendConfigurationSearchBoosting {
|
||||
export interface SCBackendConfigurationSearchBoostingType {
|
||||
|
||||
/**
|
||||
* The factor of which the scores matching this type should be multiplied by
|
||||
@@ -98,7 +115,7 @@ export interface SCBackendConfigurationSearchBoosting {
|
||||
* Outer-Map:
|
||||
* Fields of this type that should be boosted if they match a given value
|
||||
* For nest fields you can use the `.` as a separator. For example `academicTerms.acronym`
|
||||
*
|
||||
*
|
||||
* Inner-map:
|
||||
* Value of the field that should be boosted by the given number
|
||||
* For example `"SS 2019": 2`
|
||||
@@ -143,7 +160,7 @@ export interface SCBackendInternalConfiguration {
|
||||
* The resulting scores of matching objects can be boosted (multiplied by a number) to change the order in the
|
||||
* set of results
|
||||
*/
|
||||
boostings: SCBackendConfigurationSearchBoosting[];
|
||||
boostings: SCBackendConfigurationSearchBoostingContext;
|
||||
|
||||
/**
|
||||
* Configuration of the database
|
||||
|
||||
@@ -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,24 +12,259 @@
|
||||
* 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;
|
||||
}
|
||||
|
||||
const 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)) {
|
||||
expect(SchemaSpec.thingNames).not.to.contain(
|
||||
type.name,
|
||||
`Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`,
|
||||
);
|
||||
} 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 +272,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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,7 +243,7 @@ export class MetaTranslationSpec {
|
||||
|
||||
@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();
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
"floor": "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"
|
||||
}
|
||||
"floor": "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"
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -16,12 +16,7 @@
|
||||
"Wirtschaftsmathematik BSc",
|
||||
"Technomathematik BSc",
|
||||
"Mathematik BSc"
|
||||
],
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
]
|
||||
},
|
||||
"origin": {
|
||||
"created": "2018-09-11T12:30:00Z",
|
||||
|
||||
@@ -164,11 +164,6 @@
|
||||
"addressRegion": "Berlin",
|
||||
"postalCode": "10623",
|
||||
"streetAddress": "Straße des 17. Juni 136"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
},
|
||||
"floorName": "0",
|
||||
@@ -3388,12 +3383,7 @@
|
||||
],
|
||||
"uid": "593655b5-0fc9-59de-a82f-b8f5f908deef",
|
||||
"name": "MA 043",
|
||||
"floor": "0",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floor": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -5536,12 +5526,7 @@
|
||||
],
|
||||
"uid": "31b1ab4c-1803-51ed-8c66-59bfc97cd350",
|
||||
"name": "MA Foyer",
|
||||
"floor": "0",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floor": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6355,12 +6340,7 @@
|
||||
],
|
||||
"uid": "56ce0744-ae39-5209-b18f-d3a6edcb8f0a",
|
||||
"name": "MA 042",
|
||||
"floor": "0",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floor": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6470,12 +6450,7 @@
|
||||
],
|
||||
"uid": "96b7e555-1214-5ca8-8294-e8209ac04f5a",
|
||||
"name": "MA 041",
|
||||
"floor": "0",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floor": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6705,12 +6680,7 @@
|
||||
],
|
||||
"uid": "ed50a94d-eb06-5d07-8058-dfbdeb6c3a0b",
|
||||
"name": "MA 001",
|
||||
"floor": "0",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floor": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -104,11 +104,6 @@
|
||||
"addressRegion": "Berlin",
|
||||
"postalCode": "10623",
|
||||
"streetAddress": "Straße des 17. Juni 135"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
},
|
||||
"floorName": "4",
|
||||
|
||||
@@ -104,11 +104,6 @@
|
||||
"addressRegion": "Berlin",
|
||||
"postalCode": "10623",
|
||||
"streetAddress": "Straße des 17. Juni 135"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
},
|
||||
"floorName": "5",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"instance": {
|
||||
"type": "message",
|
||||
"uid": "4706ef24-b631-5c20-91d1-3c627decca5a",
|
||||
"image": "icon ion-android-hand stapps-color-red-dark",
|
||||
"image": "https://backend/res/img/message_small.png",
|
||||
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
|
||||
"message": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
|
||||
"audiences": [
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"instance": {
|
||||
"type": "invalid-value-in-schema",
|
||||
"uid": "cdb7059c-a1a2-5229-821d-434c345e2917",
|
||||
"image": "icon ion-android-hand stapps-color-red-dark",
|
||||
"image": "https://backend/res/img/message_small.png",
|
||||
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
|
||||
"message": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
|
||||
"audiences": [
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"type": "message",
|
||||
"invalid-non-existing-key-in-schema": 1,
|
||||
"uid": "4706ef24-b631-5c20-91d1-3c627decca5a",
|
||||
"image": "icon ion-android-hand stapps-color-red-dark",
|
||||
"image": "https://backend/res/img/message_small.png",
|
||||
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
|
||||
"message": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
|
||||
"audiences": [
|
||||
|
||||
@@ -40,11 +40,6 @@
|
||||
],
|
||||
"type": "Point"
|
||||
}
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -72,11 +67,6 @@
|
||||
],
|
||||
"type": "Point"
|
||||
}
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
74
test/resources/PluginRegisterRequest.1.json
Normal file
74
test/resources/PluginRegisterRequest.1.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"errorNames": [],
|
||||
"instance": {
|
||||
"action": "add",
|
||||
"plugin": {
|
||||
"address": "http://foo.com:1234",
|
||||
"name": "Foo Plugin",
|
||||
"requestSchema": {
|
||||
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||
"definitions": {
|
||||
"SCFooPluginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"query": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"query"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"description": "User query"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"query": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"query"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"description": "User query",
|
||||
"id": "https://core.stapps.tu-berlin.de/v0.18.0/lib/schema/SCFooPluginRequest.json"
|
||||
},
|
||||
"responseSchema": {
|
||||
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||
"definitions": {
|
||||
"SCFooPluginResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"type": "array",
|
||||
"items": {}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"description": "A response to a query"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"type": "array",
|
||||
"items": {}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"description": "A response to a query",
|
||||
"id": "https://core.stapps.tu-berlin.de/v0.18.0/lib/schema/SCFooPluginResponse.json"
|
||||
},
|
||||
"route": "/foo"
|
||||
}
|
||||
},
|
||||
"schema": "SCPluginRegisterRequest"
|
||||
}
|
||||
8
test/resources/PluginRegisterRequest.2.json
Normal file
8
test/resources/PluginRegisterRequest.2.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"errorNames": [],
|
||||
"instance": {
|
||||
"action": "remove",
|
||||
"route": "/foo"
|
||||
},
|
||||
"schema": "SCPluginRegisterRequest"
|
||||
}
|
||||
7
test/resources/PluginRegisterResponse.1.json
Normal file
7
test/resources/PluginRegisterResponse.1.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"errorNames": [],
|
||||
"instance": {
|
||||
"success": true
|
||||
},
|
||||
"schema": "SCPluginRegisterResponse"
|
||||
}
|
||||
@@ -98,12 +98,7 @@
|
||||
"library"
|
||||
],
|
||||
"type": "building",
|
||||
"uid": "65596790-a217-5d70-888e-16aa17bfda0a",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"uid": "65596790-a217-5d70-888e-16aa17bfda0a"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
|
||||
@@ -286,12 +286,7 @@
|
||||
"categories": [
|
||||
"education"
|
||||
],
|
||||
"uid": "a825451c-cbc4-544a-9d96-9de0b635fdbd",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"uid": "a825451c-cbc4-544a-9d96-9de0b635fdbd"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
|
||||
@@ -177,11 +177,6 @@
|
||||
"addressRegion": "Berlin",
|
||||
"postalCode": "10623",
|
||||
"streetAddress": "Straße des 17. Juni 136"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
},
|
||||
"floor": "0",
|
||||
|
||||
@@ -67,12 +67,7 @@
|
||||
"education"
|
||||
],
|
||||
"type": "building",
|
||||
"uid": "583b4bd4-d7b7-5736-b2df-87e05c41d97a",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"uid": "583b4bd4-d7b7-5736-b2df-87e05c41d97a"
|
||||
},
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"errorNames": [],
|
||||
"instance": {
|
||||
"query": "*",
|
||||
"context": "default",
|
||||
"filter": {
|
||||
"arguments": {
|
||||
"filters": [
|
||||
|
||||
@@ -5,15 +5,13 @@
|
||||
"privacy"
|
||||
],
|
||||
"description": "This is a Description",
|
||||
"input": {
|
||||
"defaultValue": "student",
|
||||
"inputType": "singleChoice",
|
||||
"values": [
|
||||
"student",
|
||||
"employee",
|
||||
"guest"
|
||||
]
|
||||
},
|
||||
"defaultValue": "student",
|
||||
"inputType": "single choice",
|
||||
"values": [
|
||||
"student",
|
||||
"employee",
|
||||
"guest"
|
||||
],
|
||||
"name": "group",
|
||||
"order": 0,
|
||||
"origin": {
|
||||
@@ -21,11 +19,6 @@
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": "Dies ist eine Beschreibung"
|
||||
}
|
||||
},
|
||||
"type": "setting",
|
||||
"uid": "c4ff2b08-be18-528e-9b09-cb8c1d18487b"
|
||||
},
|
||||
|
||||
@@ -5,20 +5,18 @@
|
||||
"privacy"
|
||||
],
|
||||
"description": "This is a Description",
|
||||
"input": {
|
||||
"defaultValue": [],
|
||||
"inputType": "multipleChoice",
|
||||
"values": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8
|
||||
]
|
||||
},
|
||||
"defaultValue": [],
|
||||
"inputType": "multiple choice",
|
||||
"values": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8
|
||||
],
|
||||
"name": "numbers",
|
||||
"order": 1,
|
||||
"origin": {
|
||||
@@ -26,16 +24,6 @@
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": "Dies ist eine Beschreibung",
|
||||
"name": "Nummern"
|
||||
},
|
||||
"en": {
|
||||
"description": "This is a Description",
|
||||
"name": "Numbers"
|
||||
}
|
||||
},
|
||||
"type": "setting",
|
||||
"uid": "9f0c362e-0b41-532f-9e8b-a0ac373fbede"
|
||||
},
|
||||
|
||||
47
test/resources/Setting.3.json
Normal file
47
test/resources/Setting.3.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"errorNames": [],
|
||||
"instance": {
|
||||
"categories": [
|
||||
"profile"
|
||||
],
|
||||
"defaultValue": "en",
|
||||
"description": "The language this app is going to use.",
|
||||
"inputType": "single choice",
|
||||
"name": "language",
|
||||
"order": 0,
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
},
|
||||
"translations": {
|
||||
"de": {
|
||||
"categories": ["Benutzer"],
|
||||
"description": "Die Sprache in der die App angezeigt wird.",
|
||||
"name": "Sprache",
|
||||
"values": [
|
||||
"English",
|
||||
"German"
|
||||
]
|
||||
},
|
||||
"en": {
|
||||
"categories": [
|
||||
"User"
|
||||
],
|
||||
"description": "The language this app is going to use.",
|
||||
"name": "Language",
|
||||
"values": [
|
||||
"english",
|
||||
"german"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "setting",
|
||||
"values": [
|
||||
"en",
|
||||
"de"
|
||||
],
|
||||
"uid": "184b717a-d020-46f5-995c-03023670cc62"
|
||||
},
|
||||
"schema": "SCSetting"
|
||||
}
|
||||
@@ -26,12 +26,7 @@
|
||||
"H 0010"
|
||||
],
|
||||
"name": "Prüfungsamt - Team 2",
|
||||
"floor": "0",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"floor": "0"
|
||||
},
|
||||
"serviceType": {
|
||||
"name": "Prüfungsamt"
|
||||
|
||||
@@ -35,12 +35,7 @@
|
||||
"uid": "540862f3-ea30-5b8f-8678-56b4dc217642",
|
||||
"name": "Big Buck Bunny",
|
||||
"givenName": "Big Buck",
|
||||
"familyName": "Bunny",
|
||||
"origin": {
|
||||
"indexed": "2018-09-11T12:30:00Z",
|
||||
"name": "Dummy",
|
||||
"type": "remote"
|
||||
}
|
||||
"familyName": "Bunny"
|
||||
}
|
||||
],
|
||||
"origin": {
|
||||
|
||||
Reference in New Issue
Block a user