Compare commits

...

49 Commits

Author SHA1 Message Date
Jovan Krunić
95b2fc5c18 0.75.0 2023-02-28 14:22:05 +01:00
Jovan Krunić
28eacf7925 feat: add rating for things
Closes #152
2023-02-27 13:33:24 +01:00
Rainer Killinger
2afbdabc54 0.74.0 2023-01-30 13:59:40 +01:00
Rainer Killinger
4e521926d3 refactor: reorder version related asset generation 2023-01-30 13:27:27 +01:00
openstappsbot
3b0014abac refactor: update all 2023-01-30 13:26:34 +01:00
Rainer Killinger
bdaa1f0201 refactor: Feedback metaData has to be optiobal 2023-01-13 11:59:33 +01:00
Rainer Killinger
1703a3dd40 docs: update changelog 2023-01-12 19:12:43 +01:00
Rainer Killinger
877903dd1a 0.73.0 2023-01-12 19:12:41 +01:00
openstappsbot
2873e22038 refactor: update all 2023-01-12 19:02:40 +01:00
Jovan Krunić
7fdf6f7c25 docs: update changelog 2022-12-06 14:44:04 +01:00
Jovan Krunić
17dc720df6 0.72.0 2022-12-06 14:44:02 +01:00
Jovan Krunić
be98fd8c4c feat: add dish menu section and service times
Closes #150
2022-12-06 13:35:49 +01:00
Rainer Killinger
8c032209a0 docs: update changelog 2022-11-22 12:48:15 +01:00
Rainer Killinger
82aaefe843 0.71.1 2022-11-22 12:48:12 +01:00
Rainer Killinger
0ad7e48462 refactor: adjust dish additives translations 2022-11-22 12:45:42 +01:00
Rainer Killinger
48218e89da docs: update changelog 2022-10-11 16:57:52 +02:00
Rainer Killinger
02d7208d73 0.71.0 2022-10-11 16:57:50 +02:00
Rainer Killinger
75155a9a86 refactor: remodel app config menu categories 2022-10-11 11:41:21 +00:00
Jovan Krunić
dd138fd0be feat: add new book categories
Closes #147
2022-10-11 12:32:01 +02:00
Rainer Killinger
608429c139 docs: update changelog 2022-09-02 14:24:32 +02:00
Rainer Killinger
27ed3c11f1 0.70.0 2022-09-02 14:24:30 +02:00
Rainer Killinger
b183198029 feat: add auth provider to config menu items 2022-09-02 14:18:24 +02:00
Rainer Killinger
6e50b89b1a docs: update changelog 2022-08-17 16:16:49 +02:00
Rainer Killinger
62ab6384d3 0.69.0 2022-08-17 16:16:47 +02:00
Rainer Killinger
f864c64efa refactor: move to eslint 2022-08-17 16:09:45 +02:00
Rainer Killinger
c1dc7b4e8f ci: add cobertura coverage report 2022-08-17 14:04:50 +02:00
Rainer Killinger
a096d5be62 docs: update contributors list 2022-08-17 14:04:12 +02:00
openstappsbot
ed6358a0c8 refactor: update all 2022-08-17 14:00:49 +02:00
Rainer Killinger
7f22cbb54c docs: update changelog 2022-06-27 16:04:10 +02:00
Rainer Killinger
8b9bb45868 0.68.0 2022-06-27 16:04:08 +02:00
openstappsbot
77f1f0a5b8 refactor: update all 2022-06-27 15:56:36 +02:00
Rainer Killinger
1015fd24ac docs: update changelog 2022-05-31 16:13:54 +02:00
Rainer Killinger
618a9046bc 0.67.0 2022-05-31 16:13:51 +02:00
Rainer Killinger
c43e2b38e6 refactor: remove SCMetaTranslations singletons 2022-05-31 16:10:41 +02:00
Rainer Killinger
9d0ff36af5 refactor: untangle SCCreativeWork inheritance 2022-05-30 17:00:14 +02:00
Rainer Killinger
31bb7e89ea docs: update changelog 2022-05-27 16:54:09 +02:00
Rainer Killinger
942f04e250 0.66.1 2022-05-27 16:54:06 +02:00
Rainer Killinger
930b574618 refactor: update dependencies 2022-05-27 16:51:08 +02:00
Rainer Killinger
7b88be3a75 refactor: initalize meta classes in translator 2022-05-27 15:21:59 +02:00
Jovan Krunić
5277f7601c docs: update changelog 2022-05-11 13:54:54 +02:00
Jovan Krunić
5241a01b55 0.66.0 2022-05-11 13:54:52 +02:00
484be6a890 feat: add geo filter envelope support 2022-04-28 09:50:44 +02:00
Rainer Killinger
45e0f26391 docs: update changelog 2022-04-04 20:56:06 +02:00
Rainer Killinger
ead47aca19 0.65.1 2022-04-04 20:56:04 +02:00
Rainer Killinger
f9c2414000 docs: adjust typedoc option 'entryPointStrategy' 2022-04-04 20:55:16 +02:00
Rainer Killinger
523de51160 docs: update changelog 2022-04-04 20:47:21 +02:00
Rainer Killinger
d912c03eb0 0.65.0 2022-04-04 20:47:19 +02:00
Rainer Killinger
a638f5447b refactor: update dependencies 2022-04-04 20:42:01 +02:00
Rainer Killinger
cecf95aa46 docs: update changelog 2022-03-21 11:05:27 +01:00
96 changed files with 3961 additions and 3129 deletions

2
.eslintignore Normal file
View File

@@ -0,0 +1,2 @@
resources
openapi

29
.eslintrc.json Normal file
View File

@@ -0,0 +1,29 @@
{
"extends": "@openstapps",
"rules": {
"@typescript-eslint/no-empty-interface": "off",
"jsdoc/check-tag-names": [
"error",
{
"definedTags": [
"internal",
"aggregatable",
"float",
"indexable",
"integer",
"keyword",
"sortable",
"text",
"date",
"validatable",
"filterable",
"inheritTags",
"minLength",
"pattern",
"typeparam",
"TJS-format"
]
}
]
}
}

1
.gitignore vendored
View File

@@ -10,6 +10,7 @@ pids
*.pid *.pid
*.seed *.seed
*.pid.lock *.pid.lock
.DS_Store
# Directory for instrumented libs generated by jscoverage/JSCover # Directory for instrumented libs generated by jscoverage/JSCover
lib-cov lib-cov

View File

@@ -83,10 +83,15 @@ test:
stage: test stage: test
script: script:
- npm test - npm test
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
artifacts: artifacts:
paths: paths:
- report - report
- coverage - coverage
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
mapping: mapping:
tags: tags:

View File

@@ -1,3 +1,88 @@
# [0.75.0](https://gitlab.com/openstapps/core/compare/v0.74.0...v0.75.0) (2023-02-28)
### Features
* add rating for things ([28eacf7](https://gitlab.com/openstapps/core/commit/28eacf7925f84caa129cad4b94fb449effd4d6ea)), closes [#152](https://gitlab.com/openstapps/core/issues/152)
# [0.74.0](https://gitlab.com/openstapps/core/compare/v0.73.0...v0.74.0) (2023-01-30)
# [0.73.0](https://gitlab.com/openstapps/core/compare/v0.72.0...v0.73.0) (2023-01-12)
# [0.72.0](https://gitlab.com/openstapps/core/compare/v0.71.1...v0.72.0) (2022-12-06)
### Features
* add dish menu section and service times ([be98fd8](https://gitlab.com/openstapps/core/commit/be98fd8c4c2fbb01eb80808bf3aa609b08b90ec6)), closes [#150](https://gitlab.com/openstapps/core/issues/150)
## [0.71.1](https://gitlab.com/openstapps/core/compare/v0.71.0...v0.71.1) (2022-11-22)
# [0.71.0](https://gitlab.com/openstapps/core/compare/v0.70.0...v0.71.0) (2022-10-11)
### Features
* add new book categories ([dd138fd](https://gitlab.com/openstapps/core/commit/dd138fd0be6d8100fc242816f5eb2549f2672ab3)), closes [#147](https://gitlab.com/openstapps/core/issues/147)
# [0.70.0](https://gitlab.com/openstapps/core/compare/v0.69.0...v0.70.0) (2022-09-02)
### Features
* add auth provider to config menu items ([b183198](https://gitlab.com/openstapps/core/commit/b18319802969d711373e70cca5921730345aa3e8))
# [0.69.0](https://gitlab.com/openstapps/core/compare/v0.68.0...v0.69.0) (2022-08-17)
# [0.68.0](https://gitlab.com/openstapps/core/compare/v0.67.0...v0.68.0) (2022-06-27)
# [0.67.0](https://gitlab.com/openstapps/core/compare/v0.66.1...v0.67.0) (2022-05-31)
## [0.66.1](https://gitlab.com/openstapps/core/compare/v0.66.0...v0.66.1) (2022-05-27)
# [0.66.0](https://gitlab.com/openstapps/core/compare/v0.65.1...v0.66.0) (2022-05-11)
### Features
* add geo filter envelope support ([484be6a](https://gitlab.com/openstapps/core/commit/484be6a890d743601efa5d40d33ea2c619f3126d))
## [0.65.1](https://gitlab.com/openstapps/core/compare/v0.65.0...v0.65.1) (2022-04-04)
# [0.65.0](https://gitlab.com/openstapps/core/compare/v0.64.0...v0.65.0) (2022-04-04)
# [0.64.0](https://gitlab.com/openstapps/core/compare/v0.63.0...v0.64.0) (2022-03-21)
# [0.63.0](https://gitlab.com/openstapps/core/compare/v0.62.0...v0.63.0) (2022-01-24) # [0.63.0](https://gitlab.com/openstapps/core/compare/v0.62.0...v0.63.0) (2022-01-24)

2804
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/core", "name": "@openstapps/core",
"version": "0.64.0", "version": "0.75.0",
"description": "StAppsCore - Generalized model of data", "description": "StAppsCore - Generalized model of data",
"keywords": [ "keywords": [
"Model", "Model",
@@ -14,21 +14,21 @@
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"scripts": { "scripts": {
"build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run mappings", "build": "npm run lint && npm run compile && npm run pack && npm run schema && npm run mappings",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"check-configuration": "openstapps-configuration", "check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc", "compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks src", "documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
"pack": "openstapps-core-tools pack", "pack": "openstapps-core-tools pack",
"postversion": "npm run changelog", "version": "npm run changelog",
"prepublishOnly": "npm ci && npm run build", "prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly", "preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"", "push": "git push && git push origin \"v$npm_package_version\"",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src lib/schema", "schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src lib/schema",
"mappings": "mkdir lib/mappings && openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json", "mappings": "mkdir lib/mappings && openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json",
"mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/", "mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/",
"test": "nyc mocha --require ts-node/register --recursive 'test/*.spec.ts'", "test": "nyc mocha --recursive 'test/*.spec.ts'",
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'" "lint": "eslint --ext .ts src/"
}, },
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>", "author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"contributors": [ "contributors": [
@@ -42,43 +42,51 @@
"Rainer Killinger <mail-openstapps@killinger.co>", "Rainer Killinger <mail-openstapps@killinger.co>",
"Roman Klopsch", "Roman Klopsch",
"Sebastian Lange", "Sebastian Lange",
"Wieland Schöbl" "Thea Schöbl"
], ],
"dependencies": { "dependencies": {
"@openstapps/core-tools": "0.29.0", "@openstapps/core-tools": "0.34.0",
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30", "@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.10", "@types/json-schema": "7.0.11",
"@types/node": "14.18.3", "@types/node": "14.18.36",
"fast-clone": "1.5.13",
"fast-deep-equal": "3.1.3", "fast-deep-equal": "3.1.3",
"http-status-codes": "2.2.0", "http-status-codes": "2.2.0",
"json-patch": "0.7.0", "json-patch": "0.7.0",
"json-schema": "0.4.0", "json-schema": "0.4.0",
"rfdc": "1.3.0",
"ts-optchain": "0.1.8" "ts-optchain": "0.1.8"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/configuration": "0.29.0", "@openstapps/configuration": "0.34.0",
"@openstapps/es-mapping-generator": "0.0.4", "@openstapps/es-mapping-generator": "0.4.0",
"@openstapps/logger": "0.8.0", "@openstapps/eslint-config": "1.1.0",
"@testdeck/mocha": "0.2.0", "@openstapps/logger": "1.1.1",
"@types/chai": "4.3.0", "@testdeck/mocha": "0.3.3",
"@types/lodash": "4.14.180", "@types/chai": "4.3.4",
"@types/mocha": "9.1.0", "@types/lodash": "4.14.182",
"@types/mocha": "10.0.1",
"@types/rimraf": "3.0.2", "@types/rimraf": "3.0.2",
"chai": "4.3.6", "@typescript-eslint/eslint-plugin": "5.49.0",
"conditional-type-checks": "1.0.5", "@typescript-eslint/parser": "5.49.0",
"chai": "4.3.7",
"conditional-type-checks": "1.0.6",
"conventional-changelog-cli": "2.2.2", "conventional-changelog-cli": "2.2.2",
"eslint": "8.33.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-jsdoc": "39.7.4",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "45.0.2",
"lodash": "4.17.21", "lodash": "4.17.21",
"mocha": "9.2.2", "mocha": "10.2.0",
"nyc": "15.1.0", "nyc": "15.1.0",
"prettier": "2.8.3",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"source-map-support": "0.5.21", "source-map-support": "0.5.21",
"surge": "0.23.1", "surge": "0.23.1",
"ts-node": "10.7.0", "ts-node": "10.9.1",
"tslint": "6.1.3", "typedoc": "0.22.18",
"typedoc": "0.21.6", "typescript": "4.4.4"
"typescript": "4.3.5"
}, },
"nyc": { "nyc": {
"all": true, "all": true,
@@ -100,6 +108,7 @@
"lines": 95, "lines": 95,
"per-file": true, "per-file": true,
"reporter": [ "reporter": [
"cobertura",
"html", "html",
"text-summary" "text-summary"
], ],

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,17 +12,23 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson'; import {Polygon} from 'geojson';
import {SCTranslations} from '../general/i18n'; import {SCTranslations} from '../general/i18n';
import {SCMap} from '../general/map'; import {SCMap} from '../general/map';
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting'; import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
import {SCAuthorizationProviderType} from './authorization';
import {SCFeatureConfiguration} from './feature'; import {SCFeatureConfiguration} from './feature';
/** /**
* An app configuration menu item * An app configuration menu item
*/ */
export interface SCAppConfigurationMenuItem { export interface SCAppConfigurationMenuItem {
/**
* Key of authorization provider available in SCConfigFile
* Restricting and enabling the usage of this item
*/
authProvider?: SCAuthorizationProviderType;
/** /**
* Icon for the menu item * Icon for the menu item
*/ */
@@ -53,29 +59,25 @@ export interface SCAppConfigurationMenuCategory {
*/ */
icon: string; icon: string;
/**
* ID of the menu category
*/
id:
'main'
| 'meta'
| 'personal'
| 'external';
/** /**
* A list of items that belong to the category * A list of items that belong to the category
*/ */
items: SCAppConfigurationMenuItem[]; items: SCAppConfigurationMenuItem[];
/** /**
* Name of the category * Title of the category
*/ */
name: string; title: string;
/**
* Route inside the app
*/
route: string;
/** /**
* Translations for the menu category * Translations for the menu category
*/ */
translations: SCTranslations<SCAppConfigurationMenuCategoryTranslationName>; translations: SCTranslations<SCAppConfigurationMenuCategoryTranslationTitle>;
} }
/** /**
@@ -167,11 +169,11 @@ export interface SCAppConfigurationMenuItemTranslationTitle {
/** /**
* Translatable property of a menu category * Translatable property of a menu category
*/ */
export interface SCAppConfigurationMenuCategoryTranslationName { export interface SCAppConfigurationMenuCategoryTranslationTitle {
/** /**
* Translation of the name of a menu category * Translation of the name of a menu category
*/ */
name: string; title: string;
} }
export enum SCAboutPageContentType { export enum SCAboutPageContentType {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -21,7 +21,7 @@ import {SCUserConfigurationMap} from './user';
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1 * @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1
* @see https://github.com/gbv/paia * @see https://github.com/gbv/paia
*/ */
export type SCAuthorizationProviderType = 'default' | 'paia' ; export type SCAuthorizationProviderType = 'default' | 'paia';
/** /**
* An authorization provider complete configuration * An authorization provider complete configuration

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -95,29 +95,25 @@ export interface SCBackendConfigurationSortableField {
* A list of supported sorts on this field * A list of supported sorts on this field
*/ */
sortTypes: SCSearchSortType[]; sortTypes: SCSearchSortType[];
} }
/** /**
* Possible context names to be used by the search request * Possible context names to be used by the search request
*/ */
export type SCSearchContext = export type SCSearchContext = 'default' | 'dining' | 'place';
| 'default'
| 'dining'
| 'place';
/** /**
* A boosting configuration for one context * A boosting configuration for one context
*/ */
export type SCBackendConfigurationSearchBoostingContext = export type SCBackendConfigurationSearchBoostingContext = SCRestrictedMap<
SCRestrictedMap<SCSearchContext, SCSearchContext,
SCBackendConfigurationSearchBoostingType[]>; SCBackendConfigurationSearchBoostingType[]
>;
/** /**
* A boosting configuration for one SCType * A boosting configuration for one SCType
*/ */
export interface SCBackendConfigurationSearchBoostingType { export interface SCBackendConfigurationSearchBoostingType {
/** /**
* The factor of which the scores matching this type should be multiplied by * The factor of which the scores matching this type should be multiplied by
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -28,7 +28,6 @@ export interface SCFeatureConfiguration {
plugins?: SCMap<SCFeatureConfigurationPlugin>; plugins?: SCMap<SCFeatureConfigurationPlugin>;
} }
export interface SCFeatureConfigurationPlugin { export interface SCFeatureConfigurationPlugin {
/** /**
* URL path registered with the backend * URL path registered with the backend

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -19,10 +19,10 @@ import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend'
/** /**
* A configuration file that configures app and backend * A configuration file that configures app and backend
*
* @validatable * @validatable
*/ */
export interface SCConfigFile { export interface SCConfigFile {
/** /**
* Configuration for the app that is visible to clients * Configuration for the app that is visible to clients
*/ */
@@ -31,7 +31,7 @@ export interface SCConfigFile {
/** /**
* Configuration for the supported authorization providers * Configuration for the supported authorization providers
*/ */
auth: { [key in SCAuthorizationProviderType]?: SCAuthorizationProvider; }; auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider};
/** /**
* Configuration for the backend that is visible to clients * Configuration for the backend that is visible to clients

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,7 +16,9 @@
/** /**
* User configuration keys mapped to string type while including their requiredness * User configuration keys mapped to string type while including their requiredness
*/ */
export type SCUserConfigurationMap = { [K in keyof SCUserConfigurationOptional]?: string } & { [K in keyof SCUserConfigurationRequired]: string }; export type SCUserConfigurationMap = {[K in keyof SCUserConfigurationOptional]?: string} & {
[K in keyof SCUserConfigurationRequired]: string;
};
/** /**
* A user configuration * A user configuration
@@ -40,7 +42,7 @@ interface SCUserConfigurationRequired {
/** /**
* A user configurations optional properties * A user configurations optional properties
*/ */
interface SCUserConfigurationOptional { interface SCUserConfigurationOptional {
/** /**
* User's e-mail * User's e-mail
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -37,7 +37,7 @@ export interface SCLanguage {
* @see https://en.wikipedia.org/wiki/ISO_639-1 * @see https://en.wikipedia.org/wiki/ISO_639-1
*/ */
export type SCLanguageName = export type SCLanguageName =
'afar' | 'afar'
| 'abkhazian' | 'abkhazian'
| 'avestan' | 'avestan'
| 'afrikaans' | 'afrikaans'
@@ -229,7 +229,7 @@ export type SCLanguageName =
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes * @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/ */
export type SCLanguageCode = export type SCLanguageCode =
'aa' | 'aa'
| 'ab' | 'ab'
| 'ae' | 'ae'
| 'af' | 'af'
@@ -421,7 +421,7 @@ export type SCLanguageCode =
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*/ */
export type SCNationality = export type SCNationality =
'Afghanistan' | 'Afghanistan'
| 'Åland Islands' | 'Åland Islands'
| 'Albania' | 'Albania'
| 'Algeria' | 'Algeria'
@@ -475,7 +475,7 @@ export type SCNationality =
| 'Congo (Democratic Republic of the)' | 'Congo (Democratic Republic of the)'
| 'Cook Islands' | 'Cook Islands'
| 'Costa Rica' | 'Costa Rica'
| 'Côte d\'Ivoire' | "Côte d'Ivoire"
| 'Croatia' | 'Croatia'
| 'Cuba' | 'Cuba'
| 'Curaçao' | 'Curaçao'
@@ -538,11 +538,11 @@ export type SCNationality =
| 'Kazakhstan' | 'Kazakhstan'
| 'Kenya' | 'Kenya'
| 'Kiribati' | 'Kiribati'
| 'Korea (Democratic People\'s Republic of)' | "Korea (Democratic People's Republic of)"
| 'Korea (Republic of)' | 'Korea (Republic of)'
| 'Kuwait' | 'Kuwait'
| 'Kyrgyzstan' | 'Kyrgyzstan'
| 'Lao People\'s Democratic Republic' | "Lao People's Democratic Republic"
| 'Latvia' | 'Latvia'
| 'Lebanon' | 'Lebanon'
| 'Lesotho' | 'Lesotho'
@@ -694,10 +694,11 @@ export interface SCTranslations<T> {
* (Source: https://stackoverflow.com/a/51365037) * (Source: https://stackoverflow.com/a/51365037)
*/ */
type RecursivePartial<T> = { type RecursivePartial<T> = {
[P in keyof T]-?: [P in keyof T]-?: T[P] extends Array<infer U>
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> : ? Array<RecursivePartial<U>>
T[P] extends object ? RecursivePartial<T[P]> : : T[P] extends object
T[P]; ? RecursivePartial<T[P]>
: T[P];
}; };
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -42,5 +42,5 @@ export type SCRestrictedMap<U extends string | number, T> = {
/** /**
* One value for each key * One value for each key
*/ */
[key in U]: T [key in U]: T;
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,19 +12,15 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/* tslint:disable:max-line-length */
/** /**
* An ISO8601 date * An ISO8601 date
* *
* @pattern ^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])(T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])([\.,][0-9]{0,7})?(Z|[+-](?:2[0-3]|[01][0-9])(:?[0-5][0-9])?)?)?$ * @pattern ^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])(T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])([\.,][0-9]{0,7})?(Z|[+-](?:2[0-3]|[01][0-9])(:?[0-5][0-9])?)?)?$
* @see https://gist.github.com/philipashlock/8830168 * @see https://gist.github.com/philipashlock/8830168
*
* @date * @date
*/ */
export type SCISO8601Date = string; export type SCISO8601Date = string;
/* tslint:enable */
/* tslint:disable:max-line-length */
/** /**
* An ISO8601 duration * An ISO8601 duration
* *
@@ -32,7 +28,6 @@ export type SCISO8601Date = string;
* @see https://gist.github.com/philipashlock/8830168 * @see https://gist.github.com/philipashlock/8830168
*/ */
export type SCISO8601Duration = string; export type SCISO8601Duration = string;
/* tslint:enable */
/** /**
* An ISO8601 time * An ISO8601 time

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,7 +16,12 @@ import {SCTranslations} from './general/i18n';
import {SCBulkResponse} from './protocol/routes/bulk-request'; import {SCBulkResponse} from './protocol/routes/bulk-request';
import {SCSearchResponse} from './protocol/routes/search'; import {SCSearchResponse} from './protocol/routes/search';
import {SCMultiSearchResponse} from './protocol/routes/search-multi'; import {SCMultiSearchResponse} from './protocol/routes/search-multi';
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing'; import {
SCThing,
SCThingTranslatableProperties,
SCThingType,
SCThingWithoutReferences,
} from './things/abstract/thing';
/** /**
* Type guard to check if something is a SCThing * Type guard to check if something is a SCThing
@@ -32,16 +37,13 @@ export function isThing(something: unknown): something is SCThing {
return false; return false;
} }
// tslint:disable-next-line:completed-docs const type = (something as {type: unknown}).type;
const type = (something as { type: unknown; }).type;
if (typeof type !== 'string') { if (typeof type !== 'string') {
return false; return false;
} }
return Object return Object.values(SCThingType).includes(type as SCThingType);
.values(SCThingType)
.indexOf(type as SCThingType) >= 0;
} }
/** /**
@@ -49,10 +51,10 @@ export function isThing(something: unknown): something is SCThing {
* *
* @param thing Thing to check * @param thing Thing to check
*/ */
export function isThingWithTranslations(thing: SCThingWithoutReferences) export function isThingWithTranslations(
// tslint:disable-next-line:completed-docs thing: SCThingWithoutReferences,
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } { ): thing is SCThingWithoutReferences & {translations: SCTranslations<SCThingTranslatableProperties>} {
return typeof thing.translations !== 'undefined'; return thing.translations !== undefined;
} }
/** /**
@@ -65,29 +67,31 @@ export function isBulkResponse(something: unknown): something is SCBulkResponse
return false; return false;
} }
if (!('expiration' in something) if (
|| !('source' in something) !('expiration' in something) ||
|| !('state' in something) !('source' in something) ||
|| !('type' in something) !('state' in something) ||
|| !('uid' in something)) { !('type' in something) ||
!('uid' in something)
) {
return false; return false;
} }
const {expiration, source, state, type, uid} = something as { const {expiration, source, state, type, uid} = something as {
// tslint:disable:completed-docs
expiration: unknown; expiration: unknown;
source: unknown; source: unknown;
state: unknown; state: unknown;
type: unknown; type: unknown;
uid: unknown; uid: unknown;
// tslint:enable
}; };
return typeof expiration === 'string' return (
&& typeof source === 'string' typeof expiration === 'string' &&
&& typeof state === 'string' typeof source === 'string' &&
&& typeof type === 'string' typeof state === 'string' &&
&& typeof uid === 'string'; typeof type === 'string' &&
typeof uid === 'string'
);
} }
/** /**
@@ -99,16 +103,18 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
if (!(typeof something === 'object') || something === null) { if (!(typeof something === 'object') || something === null) {
return false; return false;
} }
const somethingObject = (something as { [key: string]: { [key: string]: string; }; }); const somethingObject = something as {[key: string]: {[key: string]: string}};
return Array.isArray(somethingObject.data) return (
&& Array.isArray(somethingObject.facets) Array.isArray(somethingObject.data) &&
&& typeof somethingObject.pagination !== 'undefined' Array.isArray(somethingObject.facets) &&
&& typeof somethingObject.pagination.count === 'number' somethingObject.pagination !== undefined &&
&& typeof somethingObject.pagination.offset === 'number' typeof somethingObject.pagination.count === 'number' &&
&& typeof somethingObject.pagination.total === 'number' typeof somethingObject.pagination.offset === 'number' &&
&& typeof somethingObject.stats !== 'undefined' typeof somethingObject.pagination.total === 'number' &&
&& typeof somethingObject.stats.time === 'number'; somethingObject.stats !== undefined &&
typeof somethingObject.stats.time === 'number'
);
} }
/** /**
@@ -117,10 +123,10 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
* @param something Something to check * @param something Something to check
*/ */
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse { export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false; const initialValue = Object.keys(something as {[key: string]: string}).length > 0 ? true : false;
return Object.keys(something as { [key: string]: string; }) // eslint-disable-next-line unicorn/no-array-reduce
.reduce((previousOnesAreSearchResponses, key) => { return Object.keys(something as {[key: string]: string}).reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]); return previousOnesAreSearchResponses && isSearchResponse((something as {[key: string]: string})[key]);
}, initialValue as boolean); }, initialValue as boolean);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,14 +13,22 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingType} from './things/abstract/thing'; import {SCThingType} from './things/abstract/thing';
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event'; import {
SCAcademicEvent,
SCAcademicEventMeta,
SCAcademicEventWithoutReferences,
} from './things/academic-event';
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article'; import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article';
import {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment'; import {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment';
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book'; import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building'; import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog'; import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point'; import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point';
import {SCCourseOfStudy, SCCourseOfStudyMeta, SCCourseOfStudyWithoutReferences} from './things/course-of-study'; import {
SCCourseOfStudy,
SCCourseOfStudyMeta,
SCCourseOfStudyWithoutReferences,
} from './things/course-of-study';
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series'; import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff'; import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish'; import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish';
@@ -30,7 +38,11 @@ import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/mes
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization'; import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
import {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical'; import {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical';
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person'; import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest'; import {
SCPointOfInterest,
SCPointOfInterestMeta,
SCPointOfInterestWithoutReferences,
} from './things/point-of-interest';
import { import {
SCPublicationEvent, SCPublicationEvent,
SCPublicationEventMeta, SCPublicationEventMeta,
@@ -46,12 +58,10 @@ import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour'; import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video'; import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
/* tslint:disable:variable-name */
/** /**
* A map of things, from type to meta data * A map of things, from type to meta data
*/ */
export const SCClasses: { [K in SCThingType]: object } = { export const SCClasses: {[K in SCThingType]: object} = {
/* tslint:enable */
'assessment': SCAssessmentMeta, 'assessment': SCAssessmentMeta,
'academic event': SCAcademicEventMeta, 'academic event': SCAcademicEventMeta,
'article': SCArticleMeta, 'article': SCArticleMeta,
@@ -83,7 +93,7 @@ export const SCClasses: { [K in SCThingType]: object } = {
}; };
export type SCIndexableThings = export type SCIndexableThings =
SCAssessment | SCAssessment
| SCAcademicEvent | SCAcademicEvent
| SCArticle | SCArticle
| SCBook | SCBook
@@ -112,9 +122,7 @@ export type SCIndexableThings =
/** /**
* An object that exists in the StAppsCore * An object that exists in the StAppsCore
*/ */
export type SCThings = export type SCThings = SCIndexableThings | SCDiff | SCFavorite | SCSetting;
SCIndexableThings
| SCDiff | SCFavorite | SCSetting;
/** /**
* A field of a thing * A field of a thing
@@ -124,67 +132,121 @@ export type SCThingsField = keyof SCThings | string;
/** /**
* Thing without references for a thing * Thing without references for a thing
*/ */
export type SCAssociatedThingWithoutReferences<THING extends SCThings> = export type SCAssociatedThingWithoutReferences<THING extends SCThings> = THING extends SCAssessment
THING extends SCAssessment ? SCAssessmentWithoutReferences : ? SCAssessmentWithoutReferences
THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences : : THING extends SCAcademicEvent
THING extends SCArticle ? SCArticleWithoutReferences : ? SCAcademicEventWithoutReferences
THING extends SCBook ? SCBookWithoutReferences : : THING extends SCArticle
THING extends SCBuilding ? SCBuildingWithoutReferences : ? SCArticleWithoutReferences
THING extends SCCatalog ? SCCatalogWithoutReferences : : THING extends SCBook
THING extends SCContactPoint ? SCContactPointWithoutReferences : ? SCBookWithoutReferences
THING extends SCCourseOfStudy ? SCCourseOfStudyWithoutReferences : : THING extends SCBuilding
THING extends SCDateSeries ? SCDateSeriesWithoutReferences : ? SCBuildingWithoutReferences
THING extends SCDiff ? SCDiffWithoutReferences : : THING extends SCCatalog
THING extends SCDish ? SCDishWithoutReferences : ? SCCatalogWithoutReferences
THING extends SCFavorite ? SCFavoriteWithoutReferences : : THING extends SCContactPoint
THING extends SCFloor ? SCFloorWithoutReferences : ? SCContactPointWithoutReferences
THING extends SCMessage ? SCMessageWithoutReferences : : THING extends SCCourseOfStudy
THING extends SCOrganization ? SCOrganizationWithoutReferences : ? SCCourseOfStudyWithoutReferences
THING extends SCPeriodical ? SCPeriodicalWithoutReferences : : THING extends SCDateSeries
THING extends SCPerson ? SCPersonWithoutReferences : ? SCDateSeriesWithoutReferences
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences : : THING extends SCDiff
THING extends SCPublicationEvent ? SCPublicationEventWithoutReferences : ? SCDiffWithoutReferences
THING extends SCRoom ? SCRoomWithoutReferences : : THING extends SCDish
THING extends SCSemester ? SCSemesterWithoutReferences : ? SCDishWithoutReferences
THING extends SCSetting ? SCSettingWithoutReferences : : THING extends SCFavorite
THING extends SCSportCourse ? SCSportCourseWithoutReferences : ? SCFavoriteWithoutReferences
THING extends SCStudyModule ? SCStudyModuleWithoutReferences : : THING extends SCFloor
THING extends SCTicket ? SCTicketWithoutReferences : ? SCFloorWithoutReferences
THING extends SCToDo ? SCToDoWithoutReferences : : THING extends SCMessage
THING extends SCTour ? SCTourWithoutReferences : ? SCMessageWithoutReferences
THING extends SCVideo ? SCVideoWithoutReferences : : THING extends SCOrganization
never; ? SCOrganizationWithoutReferences
: THING extends SCPeriodical
? SCPeriodicalWithoutReferences
: THING extends SCPerson
? SCPersonWithoutReferences
: THING extends SCPointOfInterest
? SCPointOfInterestWithoutReferences
: THING extends SCPublicationEvent
? SCPublicationEventWithoutReferences
: THING extends SCRoom
? SCRoomWithoutReferences
: THING extends SCSemester
? SCSemesterWithoutReferences
: THING extends SCSetting
? SCSettingWithoutReferences
: THING extends SCSportCourse
? SCSportCourseWithoutReferences
: 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 * Thing for a thing without references
*/ */
export type SCAssociatedThing<THING extends SCThings> = export type SCAssociatedThing<THING extends SCThings> = THING extends SCAssessmentWithoutReferences
THING extends SCAssessmentWithoutReferences ? SCAssessment : ? SCAssessment
THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent : : THING extends SCAcademicEventWithoutReferences
THING extends SCArticleWithoutReferences ? SCArticle : ? SCAcademicEvent
THING extends SCBookWithoutReferences ? SCBook : : THING extends SCArticleWithoutReferences
THING extends SCBuildingWithoutReferences ? SCBuilding : ? SCArticle
THING extends SCCatalogWithoutReferences ? SCCatalog : : THING extends SCBookWithoutReferences
THING extends SCContactPointWithoutReferences ? SCContactPoint : ? SCBook
THING extends SCCourseOfStudyWithoutReferences ? SCCourseOfStudy : : THING extends SCBuildingWithoutReferences
THING extends SCDateSeriesWithoutReferences ? SCDateSeries : ? SCBuilding
THING extends SCDiffWithoutReferences ? SCDiff : : THING extends SCCatalogWithoutReferences
THING extends SCDishWithoutReferences ? SCDish : ? SCCatalog
THING extends SCFavoriteWithoutReferences ? SCFavorite : : THING extends SCContactPointWithoutReferences
THING extends SCFloorWithoutReferences ? SCFloor : ? SCContactPoint
THING extends SCMessageWithoutReferences ? SCMessage : : THING extends SCCourseOfStudyWithoutReferences
THING extends SCOrganizationWithoutReferences ? SCOrganization : ? SCCourseOfStudy
THING extends SCPeriodicalWithoutReferences ? SCPeriodical : : THING extends SCDateSeriesWithoutReferences
THING extends SCPersonWithoutReferences ? SCPerson : ? SCDateSeries
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest : : THING extends SCDiffWithoutReferences
THING extends SCPublicationEventWithoutReferences ? SCPublicationEvent : ? SCDiff
THING extends SCRoomWithoutReferences ? SCRoom : : THING extends SCDishWithoutReferences
THING extends SCSemesterWithoutReferences ? SCSemester : ? SCDish
THING extends SCSettingWithoutReferences ? SCSetting : : THING extends SCFavoriteWithoutReferences
THING extends SCSportCourseWithoutReferences ? SCSportCourse : ? SCFavorite
THING extends SCStudyModuleWithoutReferences ? SCStudyModule : : THING extends SCFloorWithoutReferences
THING extends SCTicketWithoutReferences ? SCTicket : ? SCFloor
THING extends SCToDoWithoutReferences ? SCToDo : : THING extends SCMessageWithoutReferences
THING extends SCTourWithoutReferences ? SCTour : ? SCMessage
THING extends SCVideoWithoutReferences ? SCVideo : : THING extends SCOrganizationWithoutReferences
never; ? SCOrganization
: THING extends SCPeriodicalWithoutReferences
? SCPeriodical
: THING extends SCPersonWithoutReferences
? SCPerson
: THING extends SCPointOfInterestWithoutReferences
? SCPointOfInterest
: THING extends SCPublicationEventWithoutReferences
? SCPublicationEvent
: THING extends SCRoomWithoutReferences
? SCRoom
: THING extends SCSemesterWithoutReferences
? SCSemester
: THING extends SCSettingWithoutReferences
? SCSetting
: THING extends SCSportCourseWithoutReferences
? SCSportCourse
: THING extends SCStudyModuleWithoutReferences
? SCStudyModule
: THING extends SCTicketWithoutReferences
? SCTicket
: THING extends SCToDoWithoutReferences
? SCToDo
: THING extends SCTourWithoutReferences
? SCTour
: THING extends SCVideoWithoutReferences
? SCVideo
: never;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -50,7 +50,8 @@ export abstract class SCError implements SCErrorResponse {
constructor(public name: string, public message: string, public statusCode: number, stack = false) { constructor(public name: string, public message: string, public statusCode: number, stack = false) {
// generate stacktrace if needed // generate stacktrace if needed
if (stack) { if (stack) {
this.stack = (new Error()).stack; // eslint-disable-next-line unicorn/error-message
this.stack = new Error().stack;
} }
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -29,15 +29,15 @@ export class SCInternalServerErrorResponse extends SCError {
/** /**
* Create a SCInternalServerErrorResponse * Create a SCInternalServerErrorResponse
* *
* @param err Internal server error * @param error Internal server error
* @param stack Set to true if a stack trace should be created * @param stack Set to true if a stack trace should be created
* and the internal server error should be displayed to the client * and the internal server error should be displayed to the client
*/ */
constructor(err?: Error, stack = false) { constructor(error?: Error, stack = false) {
super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack); super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack);
if (stack) { if (stack) {
this.additionalData = err; this.additionalData = error;
} }
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -27,6 +27,11 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created * @param stack Set to true if a stack trace should be created
*/ */
constructor(stack?: boolean) { constructor(stack?: boolean) {
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', StatusCodes.METHOD_NOT_ALLOWED, stack); super(
'MethodNotAllowedError',
'HTTP method is not allowed on this route',
StatusCodes.METHOD_NOT_ALLOWED,
stack,
);
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -27,6 +27,7 @@ import {SCFeedbackRequest, SCFeedbackResponse, SCFeedbackRoute} from './routes/f
import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search'; import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search';
import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi'; import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi';
import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update'; import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update';
import {SCRatingRequest, SCRatingResponse, SCRatingRoute} from './routes/rating';
/** /**
* Possible Verbs for HTTP requests * Possible Verbs for HTTP requests
@@ -40,8 +41,8 @@ export enum SCRouteHttpVerbs {
/** /**
* The constructor of an error response * The constructor of an error response
*/ */
// tslint:disable-next-line:no-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse; export type SCErrorResponseConstructor = new (...arguments_: any[]) => SCErrorResponse;
/** /**
* A description of a route * A description of a route
@@ -91,26 +92,32 @@ export abstract class SCAbstractRoute implements SCRoute {
* @see SCRoute.errorNames * @see SCRoute.errorNames
*/ */
errorNames: SCErrorResponseConstructor[] = []; errorNames: SCErrorResponseConstructor[] = [];
/** /**
* @see SCRoute.method * @see SCRoute.method
*/ */
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET; method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
/** /**
* @see SCRoute.obligatoryParameters * @see SCRoute.obligatoryParameters
*/ */
obligatoryParameters?: SCMap<string>; obligatoryParameters?: SCMap<string>;
/** /**
* @see SCRoute.requestBodyName * @see SCRoute.requestBodyName
*/ */
requestBodyName = 'any'; requestBodyName = 'any';
/** /**
* @see SCRoute.responseBodyName * @see SCRoute.responseBodyName
*/ */
responseBodyName = 'any'; responseBodyName = 'any';
/** /**
* @see SCRoute.statusCodeSuccess * @see SCRoute.statusCodeSuccess
*/ */
statusCodeSuccess = 200; statusCodeSuccess = 200;
/** /**
* @see SCRoute.urlPath * @see SCRoute.urlPath
*/ */
@@ -134,15 +141,15 @@ export abstract class SCAbstractRoute implements SCRoute {
return this.urlPath return this.urlPath
.split('/') .split('/')
.map((part) => { .map(part => {
if (part.indexOf(':') !== 0) { if (part.indexOf(':') !== 0) {
return part; return part;
} }
const parameter = part.substr(1); const parameter = part.slice(1);
if (typeof parameters[parameter] === 'undefined') { if (parameters[parameter] === undefined) {
throw new Error(`Parameter '${parameter}' not provided.`); throw new TypeError(`Parameter '${parameter}' not provided.`);
} }
return parameters[parameter]; return parameters[parameter];
@@ -155,11 +162,12 @@ export abstract class SCAbstractRoute implements SCRoute {
* Possible requests * Possible requests
*/ */
export type SCRequests = export type SCRequests =
SCBookAvailabilityRequest | SCBookAvailabilityRequest
| SCBulkRequest | SCBulkRequest
| SCBulkAddRequest | SCBulkAddRequest
| SCBulkDoneRequest | SCBulkDoneRequest
| SCFeedbackRequest | SCFeedbackRequest
| SCRatingRequest
| SCIndexRequest | SCIndexRequest
| SCMultiSearchRequest | SCMultiSearchRequest
| SCSearchRequest | SCSearchRequest
@@ -169,11 +177,12 @@ export type SCRequests =
* Possible responses * Possible responses
*/ */
export type SCResponses = export type SCResponses =
SCBookAvailabilityResponse | SCBookAvailabilityResponse
| SCBulkResponse | SCBulkResponse
| SCBulkAddResponse | SCBulkAddResponse
| SCBulkDoneResponse | SCBulkDoneResponse
| SCFeedbackResponse | SCFeedbackResponse
| SCRatingResponse
| SCIndexResponse | SCIndexResponse
| SCMultiSearchResponse | SCMultiSearchResponse
| SCSearchResponse | SCSearchResponse
@@ -182,59 +191,99 @@ export type SCResponses =
/** /**
* Associated response for a request * Associated response for a request
*/ */
export type SCAssociatedResponse<REQUEST> = export type SCAssociatedResponse<REQUEST> = REQUEST extends SCBookAvailabilityRequest
REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse : ? SCBookAvailabilityResponse
REQUEST extends SCBulkRequest ? SCBulkResponse : : REQUEST extends SCBulkRequest
REQUEST extends SCBulkAddRequest ? SCBulkAddResponse : ? SCBulkResponse
REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse : : REQUEST extends SCBulkAddRequest
REQUEST extends SCFeedbackRequest ? SCFeedbackResponse : ? SCBulkAddResponse
REQUEST extends SCIndexRequest ? SCIndexResponse : : REQUEST extends SCBulkDoneRequest
REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse : ? SCBulkDoneResponse
REQUEST extends SCSearchRequest ? SCSearchResponse : : REQUEST extends SCFeedbackRequest
REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse : ? SCFeedbackResponse
never; : REQUEST extends SCRatingRequest
? SCRatingResponse
: REQUEST extends SCIndexRequest
? SCIndexResponse
: REQUEST extends SCMultiSearchRequest
? SCMultiSearchResponse
: REQUEST extends SCSearchRequest
? SCSearchResponse
: REQUEST extends SCThingUpdateRequest
? SCThingUpdateResponse
: never;
/** /**
* Associated request for a response * Associated request for a response
*/ */
export type SCAssociatedRequest<RESPONSE> = export type SCAssociatedRequest<RESPONSE> = RESPONSE extends SCBookAvailabilityResponse
RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest : ? SCBookAvailabilityRequest
RESPONSE extends SCBulkResponse ? SCBulkRequest : : RESPONSE extends SCBulkResponse
RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest : ? SCBulkRequest
RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest : : RESPONSE extends SCBulkAddResponse
RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest : ? SCBulkAddRequest
RESPONSE extends SCIndexResponse ? SCIndexRequest : : RESPONSE extends SCBulkDoneResponse
RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest : ? SCBulkDoneRequest
RESPONSE extends SCSearchResponse ? SCSearchRequest : : RESPONSE extends SCFeedbackResponse
RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest : ? SCFeedbackRequest
never; : RESPONSE extends SCRatingResponse
? SCRatingRequest
: RESPONSE extends SCIndexResponse
? SCIndexRequest
: RESPONSE extends SCMultiSearchResponse
? SCMultiSearchRequest
: RESPONSE extends SCSearchResponse
? SCSearchRequest
: RESPONSE extends SCThingUpdateResponse
? SCThingUpdateRequest
: never;
/** /**
* Associated request for a route * Associated request for a route
*/ */
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> = export type SCAssignedRequest<ROUTE extends SCAbstractRoute> = ROUTE extends SCBookAvailabilityRoute
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityRequest : ? SCBookAvailabilityRequest
ROUTE extends SCBulkRoute ? SCBulkRequest : : ROUTE extends SCBulkRoute
ROUTE extends SCBulkAddRoute ? SCBulkAddRequest : ? SCBulkRequest
ROUTE extends SCBulkDoneRoute ? SCBulkDoneRequest : : ROUTE extends SCBulkAddRoute
ROUTE extends SCFeedbackRoute ? SCFeedbackRequest : ? SCBulkAddRequest
ROUTE extends SCIndexRoute ? SCIndexRequest : : ROUTE extends SCBulkDoneRoute
ROUTE extends SCMultiSearchRoute ? SCMultiSearchRequest : ? SCBulkDoneRequest
ROUTE extends SCSearchRoute ? SCSearchRequest : : ROUTE extends SCFeedbackRoute
ROUTE extends SCThingUpdateRoute ? SCThingUpdateRequest : ? SCFeedbackRequest
never; : ROUTE extends SCRatingRoute
? SCRatingRequest
: ROUTE extends SCIndexRoute
? SCIndexRequest
: ROUTE extends SCMultiSearchRoute
? SCMultiSearchRequest
: ROUTE extends SCSearchRoute
? SCSearchRequest
: ROUTE extends SCThingUpdateRoute
? SCThingUpdateRequest
: never;
/** /**
* Associated response for a route * Associated response for a route
*/ */
export type SCAssignedResponse<ROUTE extends SCAbstractRoute> = export type SCAssignedResponse<ROUTE extends SCAbstractRoute> = ROUTE extends SCBookAvailabilityRoute
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityResponse : ? SCBookAvailabilityResponse
ROUTE extends SCBulkRoute ? SCBulkResponse : : ROUTE extends SCBulkRoute
ROUTE extends SCBulkAddRoute ? SCBulkAddResponse : ? SCBulkResponse
ROUTE extends SCBulkDoneRoute ? SCBulkDoneResponse : : ROUTE extends SCBulkAddRoute
ROUTE extends SCFeedbackRoute ? SCFeedbackResponse : ? SCBulkAddResponse
ROUTE extends SCIndexRoute ? SCIndexResponse : : ROUTE extends SCBulkDoneRoute
ROUTE extends SCMultiSearchRoute ? SCMultiSearchResponse : ? SCBulkDoneResponse
ROUTE extends SCSearchRoute ? SCSearchResponse : : ROUTE extends SCFeedbackRoute
ROUTE extends SCThingUpdateRoute ? SCThingUpdateResponse : ? SCFeedbackResponse
never; : ROUTE extends SCRatingRoute
? SCRatingResponse
: ROUTE extends SCIndexRoute
? SCIndexResponse
: ROUTE extends SCMultiSearchRoute
? SCMultiSearchResponse
: ROUTE extends SCSearchRoute
? SCSearchResponse
: ROUTE extends SCThingUpdateRoute
? SCThingUpdateResponse
: never;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -14,7 +14,10 @@
*/ */
import {StatusCodes} from 'http-status-codes'; import {StatusCodes} from 'http-status-codes';
import {SCUuid} from '../../general/uuid'; import {SCUuid} from '../../general/uuid';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered'; import {
SCAcademicPriceGroup,
SCThingThatCanBeOfferedOffer,
} from '../../things/abstract/thing-that-can-be-offered';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed'; import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found'; import {SCNotFoundErrorResponse} from '../errors/not-found';

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -35,8 +35,7 @@ export type SCBulkAddRequest = SCThings;
* *
* @validatable * @validatable
*/ */
export interface SCBulkAddResponse { export interface SCBulkAddResponse {}
}
/** /**
* Route for indexing SC things in a bulk * Route for indexing SC things in a bulk

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -27,16 +27,14 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
* *
* @validatable * @validatable
*/ */
export interface SCBulkDoneRequest { export interface SCBulkDoneRequest {}
}
/** /**
* Response to a request to change the state of a bulk to done * Response to a request to change the state of a bulk to done
* *
* @validatable * @validatable
*/ */
export interface SCBulkDoneResponse { export interface SCBulkDoneResponse {}
}
/** /**
* Route for closing bulks * Route for closing bulks

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -31,8 +31,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
* *
* @validatable * @validatable
*/ */
export interface SCBulkRequest extends SCBulkParameters { export type SCBulkRequest = SCBulkParameters;
}
/** /**
* Parameters for a bulk * Parameters for a bulk

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -31,7 +31,7 @@ export interface SCFeedbackRequest extends SCMessage {
/** /**
* Meta data that helps to understand the feedback * Meta data that helps to understand the feedback
*/ */
metaData: SCFeedbackRequestMetaData; metaData?: SCFeedbackRequestMetaData;
} }
/** /**
@@ -39,8 +39,7 @@ export interface SCFeedbackRequest extends SCMessage {
* *
* @validatable * @validatable
*/ */
export interface SCFeedbackResponse { export interface SCFeedbackResponse {}
}
/** /**
* Route for feedback submission * Route for feedback submission

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -29,8 +29,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
* *
* @validatable * @validatable
*/ */
export interface SCIndexRequest { export interface SCIndexRequest {}
}
/** /**
* A response to an index request * A response to an index request
@@ -46,7 +45,7 @@ export interface SCIndexResponse {
/** /**
* @see SCAuthorizationProvider * @see SCAuthorizationProvider
*/ */
auth: { [key in SCAuthorizationProviderType]?: SCAuthorizationProvider; }; auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider};
/** /**
* @see SCBackendConfiguration * @see SCBackendConfiguration

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2019-2023 Open StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {StatusCodes} from 'http-status-codes';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
import {SCThing} from '../../things/abstract/thing';
import {SCUserGroupSetting} from '../../things/setting';
import {SCValidationErrorResponse} from '../errors/validation';
/**
* User rating from the app
* Plugin needs to define its own rating request to hit the target rating system.
* That request should extend this one and contain timestamp and other needed data.
*
* @validatable
*/
export interface SCRatingRequest {
/**
* Number of rating stars
*/
rating: 1 | 2 | 3 | 4 | 5;
/**
* User's group in the app
*/
userGroup: SCUserGroupSetting['value'];
/**
* UID of the thing that is rated
*/
uid: SCThing['uid'];
}
/**
* A response to a rating request
*
* @validatable
*/
export interface SCRatingResponse {}
/**
* Route for rating submission
*/
export class SCRatingRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCRatingRequest';
this.responseBodyName = 'SCRatingResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlPath = '/rating';
}
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -28,16 +28,14 @@ import {SCSearchResult} from '../search/result';
* *
* @validatable * @validatable
*/ */
export interface SCSearchRequest extends SCSearchQuery { export type SCSearchRequest = SCSearchQuery;
}
/** /**
* A search response * A search response
* *
* @validatable * @validatable
*/ */
export interface SCSearchResponse extends SCSearchResult { export type SCSearchResponse = SCSearchResult;
}
/** /**
* Route for searching things * Route for searching things

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -35,8 +35,7 @@ export type SCThingUpdateRequest = SCThings;
* *
* @validatable * @validatable
*/ */
export interface SCThingUpdateResponse { export interface SCThingUpdateResponse {}
}
/** /**
* Route for updating existing things * Route for updating existing things

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -27,7 +27,7 @@ import {SCSearchValueFilter} from './filters/value';
* Filter instruction types * Filter instruction types
*/ */
export type SCSearchFilterType = export type SCSearchFilterType =
'availability' | 'availability'
| 'boolean' | 'boolean'
| 'distance' | 'distance'
| 'value' | 'value'
@@ -59,7 +59,7 @@ export type SCSearchAbstractFilterArguments = SCMap<unknown>;
* Available filter instructions * Available filter instructions
*/ */
export type SCSearchFilter = export type SCSearchFilter =
SCSearchAvailabilityFilter | SCSearchAvailabilityFilter
| SCSearchBooleanFilter | SCSearchBooleanFilter
| SCSearchDistanceFilter | SCSearchDistanceFilter
| SCSearchValueFilter | SCSearchValueFilter

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson'; import {Position} from 'geojson';
import {SCThingsField} from '../../../meta'; import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter'; import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies import {Polygon, Position} from 'geojson';
import {Polygon} from 'geojson';
import {SCThingsField} from '../../../meta'; import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter'; import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
@@ -29,6 +28,24 @@ export interface SCGeoFilter extends SCSearchAbstractFilter<SCGeoFilterArguments
type: 'geo'; type: 'geo';
} }
/**
* A rectangular geo shape, representing the top-left and bottom-right corners
*
* This is an extension of the Geojson type
* http://geojson.org/geojson-spec.html
*/
export interface Envelope {
/**
* The top-left and bottom-right corners of the bounding box
*/
coordinates: [Position, Position];
/**
* The type of the geometry
*/
type: 'envelope';
}
/** /**
* Arguments for filter instruction by geo data * Arguments for filter instruction by geo data
*/ */
@@ -41,7 +58,7 @@ export interface SCGeoFilterArguments extends SCSearchAbstractFilterArguments {
/** /**
* Geo data to check up on * Geo data to check up on
*/ */
shape: Polygon; shape: Polygon | Envelope;
/** /**
* Spatial relation between the provided shape and the shape of the field. * Spatial relation between the provided shape and the shape of the field.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2021 StApps * Copyright (C) 2020-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -47,6 +47,7 @@ export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter<SCNum
* Additional arguments for date range filters * Additional arguments for date range filters
* *
* Filter uses a plain string to allow for date math expressions * Filter uses a plain string to allow for date math expressions
*
* @see https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/date-math-expressions.html * @see https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/date-math-expressions.html
*/ */
export interface SCDateRangeFilterArguments extends SCRangeFilterArguments<string> { export interface SCDateRangeFilterArguments extends SCRangeFilterArguments<string> {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019, 2020 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson'; import {Position} from 'geojson';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort'; import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* An academic degree without references * An academic degree without references
*/ */
export interface SCAcademicDegreeWithoutReferences export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* The achievable academic degree * The achievable academic degree
* *
@@ -46,28 +45,26 @@ export interface SCAcademicDegreeWithoutReferences
/** /**
* An academic degree * An academic degree
*/ */
export interface SCAcademicDegree export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences, SCThing {
extends SCAcademicDegreeWithoutReferences, SCThing {
// noop // noop
} }
/** /**
* Meta information about academic degrees * Meta information about academic degrees
*/ */
export class SCAcademicDegreeMeta export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
academicDegree: 'Abschlussgrad', academicDegree: 'Abschlussgrad',
academicDegreewithField: 'Abschlussbezeichnung', academicDegreewithField: 'Abschlussbezeichnung',
academicDegreewithFieldShort: 'Abschlussbezeichnung (kurz)', academicDegreewithFieldShort: 'Abschlussbezeichnung (kurz)',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
academicDegree: 'academic degree', academicDegree: 'academic degree',
academicDegreewithField: 'acedemic degree and discipline', academicDegreewithField: 'acedemic degree and discipline',
academicDegreewithFieldShort: 'acedemic degree and discipline (short)', academicDegreewithFieldShort: 'acedemic degree and discipline (short)',
@@ -79,10 +76,10 @@ export class SCAcademicDegreeMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -19,8 +19,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* An academic term without references * An academic term without references
*/ */
export interface SCAcademicTermWithoutReferences export interface SCAcademicTermWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Short name of the academic term, using the given pattern * Short name of the academic term, using the given pattern
* *
@@ -62,22 +61,20 @@ export interface SCAcademicTermWithoutReferences
/** /**
* An academic term * An academic term
*/ */
export interface SCAcademicTerm export interface SCAcademicTerm extends SCAcademicTermWithoutReferences, SCThing {
extends SCAcademicTermWithoutReferences, SCThing {
// noop // noop
} }
/** /**
* Meta information about academic terms * Meta information about academic terms
*/ */
export class SCAcademicTermWithoutReferencesMeta export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCThing> {
extends SCThingMeta implements SCMetaTranslations<SCThing> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
acronym: 'Akronym', acronym: 'Akronym',
endDate: 'Enddatum', endDate: 'Enddatum',
eventsEndDate: 'Enddatum der Veranstaltungen', eventsEndDate: 'Enddatum der Veranstaltungen',
@@ -85,7 +82,7 @@ export class SCAcademicTermWithoutReferencesMeta
startDate: 'Startdatum', startDate: 'Startdatum',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
acronym: 'acronym', acronym: 'acronym',
endDate: 'end date', endDate: 'end date',
eventsEndDate: 'end date of events', eventsEndDate: 'end date of events',
@@ -99,10 +96,10 @@ export class SCAcademicTermWithoutReferencesMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -17,20 +17,12 @@ import {SCISO8601Date} from '../../general/time';
import {SCOrganizationWithoutReferences} from '../organization'; import {SCOrganizationWithoutReferences} from '../organization';
import {SCPersonWithoutReferences} from '../person'; import {SCPersonWithoutReferences} from '../person';
import {SCPublicationEventWithoutReferences} from '../publication-event'; import {SCPublicationEventWithoutReferences} from '../publication-event';
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing'; import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './thing-that-can-be-offered';
/** /**
* A creative work without references * A creative work without references
*/ */
export interface SCCreativeWorkWithoutReferences export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
/** /**
* Languages this creative work is available in * Languages this creative work is available in
*/ */
@@ -87,8 +79,7 @@ export interface SCCreativeWorkWithoutReferences
/** /**
* A creative work * A creative work
*/ */
export interface SCCreativeWork export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThing {
extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* Authors of the creative work * Authors of the creative work
*/ */
@@ -123,8 +114,7 @@ export interface SCCreativeWork
/** /**
* Translatable properties of creative works * Translatable properties of creative works
*/ */
export interface SCCreativeWorkTranslatableProperties export interface SCCreativeWorkTranslatableProperties extends SCThingTranslatableProperties {
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/** /**
* Translation of the keywords of the creative work * Translation of the keywords of the creative work
* *
@@ -136,15 +126,13 @@ export interface SCCreativeWorkTranslatableProperties
/** /**
* Meta information about creative works * Meta information about creative works
*/ */
export class SCCreativeWorkMeta export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
name: 'Titel', name: 'Titel',
authors: 'beteiligte Personen', authors: 'beteiligte Personen',
availableLanguages: 'verfügbare Übersetzungen', availableLanguages: 'verfügbare Übersetzungen',
@@ -160,8 +148,7 @@ export class SCCreativeWorkMeta
sourceOrganization: 'Körperschaft', sourceOrganization: 'Körperschaft',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
name: 'title', name: 'title',
authors: 'involved persons', authors: 'involved persons',
availableLanguages: 'available languages', availableLanguages: 'available languages',
@@ -183,12 +170,10 @@ export class SCCreativeWorkMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
}, },
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -22,8 +22,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* An event without references * An event without references
*/ */
export interface SCEventWithoutReferences export interface SCEventWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Maximum number of participants of the event * Maximum number of participants of the event
* *
@@ -46,8 +45,7 @@ export interface SCEventWithoutReferences
/** /**
* An event * An event
*/ */
export interface SCEvent export interface SCEvent extends SCEventWithoutReferences, SCThing {
extends SCEventWithoutReferences, SCThing {
/** /**
* Academic terms that an event belongs to, e.g. semester(s). * Academic terms that an event belongs to, e.g. semester(s).
*/ */
@@ -79,14 +77,13 @@ export interface SCEvent
/** /**
* Meta information about events * Meta information about events
*/ */
export class SCEventMeta export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEvent> {
extends SCThingMeta implements SCMetaTranslations<SCEvent> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
academicTerms: 'Semester', academicTerms: 'Semester',
catalogs: 'Verzeichnis', catalogs: 'Verzeichnis',
creativeWorks: 'begleitende Werke', creativeWorks: 'begleitende Werke',
@@ -96,7 +93,7 @@ export class SCEventMeta
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern', remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
academicTerms: 'academic terms', academicTerms: 'academic terms',
catalogs: 'catalogs', catalogs: 'catalogs',
creativeWorks: 'related material', creativeWorks: 'related material',
@@ -112,10 +109,10 @@ export class SCEventMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies
import {Point, Polygon} from 'geojson'; import {Point, Polygon} from 'geojson';
import {SCMetaTranslations, SCTranslations} from '../../general/i18n'; import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCBuildingWithoutReferences} from '../building'; import {SCBuildingWithoutReferences} from '../building';
@@ -84,8 +83,7 @@ export interface SCPostalAddress {
/** /**
* A place without references * A place without references
*/ */
export interface SCPlaceWithoutReferences export interface SCPlaceWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Address of the place * Address of the place
*/ */
@@ -116,8 +114,7 @@ export interface SCPlaceWithoutReferences
/** /**
* A place * A place
*/ */
export interface SCPlace export interface SCPlace extends SCPlaceWithoutReferences, SCThing {
extends SCPlaceWithoutReferences, SCThing {
/** /**
* Translated fields of a place * Translated fields of a place
*/ */
@@ -127,8 +124,7 @@ export interface SCPlace
/** /**
* Translatable properties of a place without references * Translatable properties of a place without references
*/ */
export interface SCPlaceWithoutReferencesTranslatableProperties export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties {
extends SCThingTranslatableProperties {
/** /**
* Address of a place * Address of a place
*/ */
@@ -139,19 +135,21 @@ export interface SCPlaceWithoutReferencesTranslatableProperties
* Meta information about creative works * Meta information about creative works
*/ */
export class SCPlaceWithoutReferencesMeta export class SCPlaceWithoutReferencesMeta
extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> { extends SCThingMeta
implements SCMetaTranslations<SCPlaceWithoutReferences>
{
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
address: 'Adresse', address: 'Adresse',
geo: 'Geoinformation', geo: 'Geoinformation',
openingHours: 'Öffnungszeiten', openingHours: 'Öffnungszeiten',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
address: 'address', address: 'address',
geo: 'geographic information', geo: 'geographic information',
openingHours: 'opening hours', openingHours: 'opening hours',
@@ -163,10 +161,10 @@ export class SCPlaceWithoutReferencesMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
} }
@@ -181,8 +179,5 @@ export interface SCInPlace {
/** /**
* Place the thing is or happens in * Place the thing is or happens in
*/ */
inPlace?: inPlace?: SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences;
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -24,41 +24,43 @@ export type SCISO8601DateRange = SCRange<SCISO8601Date>;
/** /**
* Generic range type * Generic range type
*/ */
export type SCRange<T> = { export type SCRange<T> =
/** | {
* Greater than value /**
*/ * Greater than value
gt?: never; */
gt?: never;
/** /**
* Greater or equal to value * Greater or equal to value
*/ */
gte?: T; gte?: T;
/** /**
* Greater than value * Greater than value
*/ */
lt?: never; lt?: never;
/** /**
* Greater or equal to value * Greater or equal to value
*/ */
lte?: T; lte?: T;
} | { }
// tslint:disable:completed-docs | {
gt?: T; gt?: T;
gte?: never; gte?: never;
lt?: T; lt?: T;
lte?: never; lte?: never;
} | { }
gt?: T; | {
gte?: never; gt?: T;
lt?: never; gte?: never;
lte?: T; lt?: never;
} | { lte?: T;
gt?: never; }
gte?: T; | {
lt?: T; gt?: never;
lte?: never; gte?: T;
// tslint:enable:completed-docs lt?: T;
}; lte?: never;
};

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -18,15 +18,12 @@ import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
/** /**
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
*/ */
export interface SCSaveableThingWithoutReferences export type SCSaveableThingWithoutReferences = SCThingWithoutReferences;
extends SCThingWithoutReferences {
}
/** /**
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
*/ */
export interface SCSaveableThing export interface SCSaveableThing extends SCSaveableThingWithoutReferences, SCThing {
extends SCSaveableThingWithoutReferences, SCThing {
/** /**
* The contained data * The contained data
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -19,26 +19,24 @@ import {SCThing, SCThingMeta} from './thing';
/** /**
* A thing that is or happens in a place * A thing that is or happens in a place
*/ */
export interface SCThingInPlace export interface SCThingInPlace extends SCThing, SCInPlace {
extends SCThing, SCInPlace {
// noop // noop
} }
/** /**
* Meta information about thing in a place * Meta information about thing in a place
*/ */
export class SCThingInPlaceMeta export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
inPlace: 'Ort', inPlace: 'Ort',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
inPlace: 'location', inPlace: 'location',
}, },
}; };
@@ -48,10 +46,10 @@ export class SCThingInPlaceMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -18,16 +18,12 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* Types of payment that are accepted at a place. * Types of payment that are accepted at a place.
*/ */
export type SCThingThatAcceptsPaymentsAcceptedPayments = export type SCThingThatAcceptsPaymentsAcceptedPayments = 'cash' | 'credit' | 'cafeteria card';
'cash'
| 'credit'
| 'cafeteria card';
/** /**
* A thing without references that accepts payments * A thing without references that accepts payments
*/ */
export interface SCThingThatAcceptsPaymentsWithoutReferences export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Accepted payments of the place * Accepted payments of the place
* *
@@ -39,8 +35,7 @@ export interface SCThingThatAcceptsPaymentsWithoutReferences
/** /**
* A thing that accepts payments * A thing that accepts payments
*/ */
export interface SCThingThatAcceptsPayments export interface SCThingThatAcceptsPayments extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
// noop // noop
} }
@@ -48,17 +43,19 @@ export interface SCThingThatAcceptsPayments
* Meta information about a thing without references that accepts payments * Meta information about a thing without references that accepts payments
*/ */
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
extends SCThingMeta implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> { extends SCThingMeta
implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences>
{
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
paymentsAccepted: 'Bezahlmethoden', paymentsAccepted: 'Bezahlmethoden',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
paymentsAccepted: 'accepted payment methods', paymentsAccepted: 'accepted payment methods',
}, },
}; };
@@ -68,7 +65,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
paymentsAccepted: { paymentsAccepted: {
'cafeteria card': 'Mensakarte', 'cafeteria card': 'Mensakarte',
'cash': 'Bar', 'cash': 'Bar',
@@ -76,7 +73,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
}, },
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -35,8 +35,7 @@ export interface SCPriceGroup {
/** /**
* Price distinctions for academic context * Price distinctions for academic context
*/ */
export interface SCAcademicPriceGroup export interface SCAcademicPriceGroup extends SCPriceGroup {
extends SCPriceGroup {
/** /**
* Price for employees * Price for employees
* *
@@ -65,8 +64,7 @@ export interface SCAcademicPriceGroup
/** /**
* A thing without references that can be offered * A thing without references that can be offered
*/ */
export interface SCThingThatCanBeOfferedWithoutReferences export interface SCThingThatCanBeOfferedWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Translations of a thing that can be offered * Translations of a thing that can be offered
*/ */
@@ -77,7 +75,8 @@ export interface SCThingThatCanBeOfferedWithoutReferences
* A thing that can be offered * A thing that can be offered
*/ */
export interface SCThingThatCanBeOffered<T extends SCPriceGroup> export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
extends SCThing, SCThingThatCanBeOfferedWithoutReferences { extends SCThing,
SCThingThatCanBeOfferedWithoutReferences {
/** /**
* List of offers for that thing * List of offers for that thing
*/ */
@@ -92,8 +91,7 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
/** /**
* Offer of a thing * Offer of a thing
*/ */
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> extends SCInPlace {
extends SCInPlace {
/** /**
* Availability of an offer * Availability of an offer
*/ */
@@ -118,8 +116,7 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
/** /**
* Translatable properties of a thing that can be offered * Translatable properties of a thing that can be offered
*/ */
export interface SCThingThatCanBeOfferedTranslatableProperties export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
extends SCThingTranslatableProperties {
/** /**
* Availability of an offer * Availability of an offer
* *
@@ -131,9 +128,7 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
/** /**
* Entity responsible for the offer * Entity responsible for the offer
*/ */
export type SCThingThatCanBeOfferedProvider = export type SCThingThatCanBeOfferedProvider = SCOrganizationWithoutReferences | SCPersonWithoutReferences;
| SCOrganizationWithoutReferences
| SCPersonWithoutReferences;
/** /**
* Availability of an Offer * Availability of an Offer
@@ -148,23 +143,18 @@ export type SCThingThatCanBeOfferedAvailability =
* Meta information about a thing without references that accepts payments * Meta information about a thing without references that accepts payments
*/ */
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
implements SCMetaTranslations<SCThingThatCanBeOffered<T>> { implements SCMetaTranslations<SCThingThatCanBeOffered<T>>
{
/**
* Instance
*/
protected static _instance = new Map<string, unknown>();
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
offers: 'Angebote', offers: 'Angebote',
}, },
en: { en: {
...SCThingMeta.getInstance().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
offers: 'offers', offers: 'offers',
}, },
}; };
@@ -174,26 +164,10 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
// tslint:disable:static-this
/**
* Function to retrieve typed singleton instance (including generics)
*/
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
if (!SCThingThatCanBeOfferedMeta._instance.has(this.name)) {
SCThingThatCanBeOfferedMeta._instance.set(this.name, new SCThingThatCanBeOfferedMeta<T>());
}
return SCThingThatCanBeOfferedMeta._instance
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
}
protected constructor() {
}
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -50,7 +50,8 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
* A thing with categories * A thing with categories
*/ */
export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecificValues> export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecificValues>
extends SCThing, SCThingWithCategoriesWithoutReferences<T, U> { extends SCThing,
SCThingWithCategoriesWithoutReferences<T, U> {
/** /**
* Translated fields of a thing with categories * Translated fields of a thing with categories
*/ */
@@ -60,8 +61,7 @@ export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecifi
/** /**
* Translatable properties of a thing with categories * Translatable properties of a thing with categories
*/ */
export interface SCThingWithCategoriesTranslatableProperties export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
extends SCThingTranslatableProperties {
/** /**
* translations of the categories of a thing with categories * translations of the categories of a thing with categories
* *
@@ -117,25 +117,20 @@ export interface SCThingWithCategoriesSpecificValues {
* Meta information about a thing without references that accepts payments * Meta information about a thing without references that accepts payments
* It intentionally does not extend the SCThingMeta implementation to be able to include generics. * It intentionally does not extend the SCThingMeta implementation to be able to include generics.
*/ */
export class SCThingWithCategoriesWithoutReferencesMeta<T, U> export class SCThingWithCategoriesWithoutReferencesMeta<T, U extends SCThingWithCategoriesSpecificValues>
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> { implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>>
{
/**
* Instance
*/
protected static _instance = new Map<string, unknown>();
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
categories: 'Kategorien', categories: 'Kategorien',
categorySpecificValues: 'besondere Kategorien', categorySpecificValues: 'besondere Kategorien',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
categories: 'categories', categories: 'categories',
categorySpecificValues: 'category with specific values', categorySpecificValues: 'category with specific values',
}, },
@@ -146,27 +141,10 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
}, },
}; };
// tslint:disable:static-this
/**
* Function to retrieve typed singleton instance (including generics)
*/
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
SCThingWithCategoriesWithoutReferencesMeta._instance
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
}
return SCThingWithCategoriesWithoutReferencesMeta._instance
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
}
protected constructor() {
}
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -269,11 +269,6 @@ export interface SCThingTranslatablePropertyOrigin {
* Meta information about things * Meta information about things
*/ */
export class SCThingMeta implements SCMetaTranslations<SCThing> { export class SCThingMeta implements SCMetaTranslations<SCThing> {
/**
* Set type definition for singleton instance
*/
protected static _instance = new Map<string, unknown>();
/** /**
* Translations of fields * Translations of fields
*/ */
@@ -315,19 +310,4 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
type: 'Thing', type: 'Thing',
}, },
}; };
// tslint:disable:static-this
/**
* Function to retrieve typed singleton instance
*/
public static getInstance<T extends SCThingMeta>(): T {
if (!SCThingMeta._instance.has(this.name)) {
SCThingMeta._instance.set(this.name, new this());
}
return SCThingMeta._instance.get(this.name) as T;
}
protected constructor() {
}
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -15,7 +15,4 @@
/** /**
* Types of data consumers * Types of data consumers
*/ */
export type SCUserGroup = export type SCUserGroup = 'students' | 'employees' | 'guests';
'students'
| 'employees'
| 'guests';

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -64,7 +64,8 @@ export interface SCAcademicEventWithoutReferences
* @indexable * @indexable
*/ */
export interface SCAcademicEvent export interface SCAcademicEvent
extends SCEvent, SCAcademicEventWithoutReferences, extends SCEvent,
SCAcademicEventWithoutReferences,
SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Translated fields of an academic event * Translated fields of an academic event
@@ -81,7 +82,7 @@ export interface SCAcademicEvent
* Categories of academic events * Categories of academic events
*/ */
export type SCAcademicEventCategories = export type SCAcademicEventCategories =
'lecture' | 'lecture'
| 'seminar' | 'seminar'
| 'integrated course' | 'integrated course'
| 'written exam' | 'written exam'
@@ -100,8 +101,7 @@ export type SCAcademicEventCategories =
/** /**
* Translatable properties of an academic event * Translatable properties of an academic event
*/ */
export interface SCAcademicEventTranslatableProperties export interface SCAcademicEventTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
extends SCThingWithCategoriesTranslatableProperties {
/** /**
* Translations of the majors of the academic event that this event belongs to * Translations of the majors of the academic event that this event belongs to
* *
@@ -120,24 +120,26 @@ export interface SCAcademicEventTranslatableProperties
/** /**
* Meta information about academic events * Meta information about academic events
*/ */
export class SCAcademicEventMeta export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicEvent> {
extends SCThingMeta
implements SCMetaTranslations<SCAcademicEvent> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de, ...new SCEventMeta().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
majors: 'Hauptfächer', majors: 'Hauptfächer',
originalCategory: 'ursprüngliche Kategorie', originalCategory: 'ursprüngliche Kategorie',
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en, ...new SCEventMeta().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
majors: 'majors', majors: 'majors',
originalCategory: 'original category', originalCategory: 'original category',
}, },
@@ -148,9 +150,11 @@ export class SCAcademicEventMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de, ...new SCEventMeta().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
'colloquium': 'Kolloquium', 'colloquium': 'Kolloquium',
'course': 'Kurs', 'course': 'Kurs',
@@ -171,9 +175,11 @@ export class SCAcademicEventMeta
type: 'akademische Veranstaltung', type: 'akademische Veranstaltung',
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en, ...new SCEventMeta().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.AcademicEvent, type: SCThingType.AcademicEvent,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -20,6 +20,13 @@ import {
SCCreativeWorkWithoutReferences, SCCreativeWorkWithoutReferences,
} from './abstract/creative-work'; } from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
@@ -31,16 +38,15 @@ import {SCPeriodicalWithoutReferences} from './periodical';
/** /**
* Categories of an article * Categories of an article
*/ */
export type SCArticleCategories = 'unipedia' export type SCArticleCategories = 'unipedia' | 'article' | 'eArticle';
| 'article'
| 'eArticle';
/** /**
* An article without references * An article without references
*/ */
export interface SCArticleWithoutReferences export interface SCArticleWithoutReferences
extends SCCreativeWorkWithoutReferences, extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> { SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Article itself as markdown * Article itself as markdown
* *
@@ -71,7 +77,9 @@ export interface SCArticleWithoutReferences
* @indexable * @indexable
*/ */
export interface SCArticle export interface SCArticle
extends SCCreativeWork, SCArticleWithoutReferences { extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCArticleWithoutReferences {
/** /**
* A periodical to which this article belongs * A periodical to which this article belongs
*/ */
@@ -96,7 +104,9 @@ export interface SCArticle
* Translatable properties of an article * Translatable properties of an article
*/ */
export interface SCArticleTranslatableProperties export interface SCArticleTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties { extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties,
SCCreativeWorkTranslatableProperties {
/** /**
* Translation of the article itself as markdown * Translation of the article itself as markdown
* *
@@ -108,26 +118,29 @@ export interface SCArticleTranslatableProperties
/** /**
* Meta information about an article * Meta information about an article
*/ */
export class SCArticleMeta export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCArticle> {
extends SCThingMeta implements SCMetaTranslations<SCArticle> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...new SCCreativeWorkMeta().fieldTranslations.de,
.de, ...new SCThingWithCategoriesWithoutReferencesMeta<
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories, SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
categories: 'Format', categories: 'Format',
reference: 'Referenz', reference: 'Referenz',
articleBody: 'Artikelinhalt', articleBody: 'Artikelinhalt',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...new SCCreativeWorkMeta().fieldTranslations.en,
.en, ...new SCThingWithCategoriesWithoutReferencesMeta<
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories, SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
categories: 'format', categories: 'format',
reference: 'reference', reference: 'reference',
articleBody: 'article body', articleBody: 'article body',
@@ -139,8 +152,12 @@ export class SCArticleMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
article: 'Artikel', article: 'Artikel',
eArticle: 'E-Aufsatz', eArticle: 'E-Aufsatz',
@@ -149,8 +166,12 @@ export class SCArticleMeta
type: 'Artikel', type: 'Artikel',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Article, type: SCThingType.Article,
categories: { categories: {
article: 'article', article: 'article',

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,59 +16,67 @@
import {SCMetaTranslations, SCTranslations} from '../general/i18n'; import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time'; import {SCISO8601Date} from '../general/time';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing'; import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta} from './abstract/thing-with-categories'; import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from './abstract/thing-with-categories';
import {SCCourseOfStudyWithoutReferences} from './course-of-study'; import {SCCourseOfStudyWithoutReferences} from './course-of-study';
/** /**
* Categories of assessments * Categories of assessments
*/ */
export type SCAssessmentCategories = 'university assessment'; export type SCAssessmentCategories = 'university assessment';
/** /**
* An assessment without references * An assessment without references
* *
*/ */
export interface SCAssessmentWithoutReferences export interface SCAssessmentWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> { extends SCThingWithCategoriesWithoutReferences<
/** SCAssessmentCategories,
* Number of attempts SCThingWithCategoriesSpecificValues
* > {
* @integer /**
*/ * Number of attempts
attempt?: number; *
* @integer
*/
attempt?: number;
/** /**
* Date assessment was taken or graded * Date assessment was taken or graded
*/ */
date?: SCISO8601Date; date?: SCISO8601Date;
/** /**
* ECTS (credit-points) * ECTS (credit-points)
* *
* @float * @float
*/ */
ects?: number; ects?: number;
/** /**
* Grade * Grade
*/ */
grade: string; grade: string;
/** /**
* Current status * Current status
*/ */
status?: string; status?: string;
/** /**
* Translated fields of an assessment * Translated fields of an assessment
*/ */
translations?: SCTranslations<SCAssessmentTranslatableProperties>; translations?: SCTranslations<SCAssessmentTranslatableProperties>;
/** /**
* Type of an assessment * Type of an assessment
*/ */
type: SCThingType.Assessment; type: SCThingType.Assessment;
} }
/** /**
@@ -77,9 +85,9 @@ export interface SCAssessmentWithoutReferences
* @validatable * @validatable
*/ */
export interface SCAssessment export interface SCAssessment
extends SCAssessmentWithoutReferences, SCThing, extends SCAssessmentWithoutReferences,
SCThing,
SCThingWithCategories<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Course of study the assessment was taken for * Course of study the assessment was taken for
*/ */
@@ -99,30 +107,28 @@ export interface SCAssessment
* Type of an assessment * Type of an assessment
*/ */
type: SCThingType.Assessment; type: SCThingType.Assessment;
} }
export interface SCAssessmentTranslatableProperties export interface SCAssessmentTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
extends SCThingWithCategoriesTranslatableProperties {
/** /**
* @see SCAssessmentWithoutReferences.status * @see SCAssessmentWithoutReferences.status
*/ */
status?: string; status?: string;
} }
/** /**
* Study module meta data * Study module meta data
*/ */
export class SCAssessmentMeta export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations<SCAssessment> {
extends SCThingMeta
implements SCMetaTranslations<SCAssessment> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
attempt: 'Versuch', attempt: 'Versuch',
courseOfStudy: 'Studiengang', courseOfStudy: 'Studiengang',
date: 'Datum', date: 'Datum',
@@ -132,8 +138,10 @@ export interface SCAssessmentTranslatableProperties
superAssessments: 'übergeordnete Prüfungen', superAssessments: 'übergeordnete Prüfungen',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
attempt: 'attempt', attempt: 'attempt',
courseOfStudy: 'course of study', courseOfStudy: 'course of study',
date: 'date', date: 'date',
@@ -149,13 +157,17 @@ export interface SCAssessmentTranslatableProperties
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
type: 'Prüfung', type: 'Prüfung',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Assessment, type: SCThingType.Assessment,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -20,6 +20,13 @@ import {
SCCreativeWorkWithoutReferences, SCCreativeWorkWithoutReferences,
} from './abstract/creative-work'; } from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
@@ -30,12 +37,15 @@ import {
/** /**
* Categories of a book * Categories of a book
*/ */
export type SCBookCategories = 'audio' export type SCBookCategories =
| 'audio'
| 'audiobook'
| 'book' | 'book'
| 'cd' | 'cd'
| 'dvd' | 'dvd'
| 'ePhoto' | 'eAudiobook'
| 'ebook' | 'ebook'
| 'ePhoto'
| 'hierarchy' | 'hierarchy'
| 'kit' | 'kit'
| 'manuscript' | 'manuscript'
@@ -54,7 +64,8 @@ export type SCBookCategories = 'audio'
*/ */
export interface SCBookWithoutReferences export interface SCBookWithoutReferences
extends SCCreativeWorkWithoutReferences, extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> { SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Categories of a book * Categories of a book
*/ */
@@ -93,7 +104,9 @@ export interface SCBookWithoutReferences
* @indexable * @indexable
*/ */
export interface SCBook export interface SCBook
extends SCCreativeWork, SCBookWithoutReferences { extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCBookWithoutReferences {
/** /**
* Translated properties of a book * Translated properties of a book
*/ */
@@ -109,8 +122,9 @@ export interface SCBook
* Translatable properties of a book * Translatable properties of a book
*/ */
export interface SCBookTranslatableFields export interface SCBookTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties { extends SCThingWithCategoriesTranslatableProperties,
} SCThingThatCanBeOfferedTranslatableProperties,
SCCreativeWorkTranslatableProperties {}
/** /**
* Meta information about a book * Meta information about a book
@@ -121,17 +135,23 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de, ...new SCCreativeWorkMeta().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCBookCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
categories: 'Format', categories: 'Format',
ISBNs: 'ISBN', ISBNs: 'ISBN',
numberOfPages: 'Seitenanzahl', numberOfPages: 'Seitenanzahl',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en, ...new SCCreativeWorkMeta().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCBookCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
categories: 'format', categories: 'format',
ISBNs: 'ISBN', ISBNs: 'ISBN',
numberOfPages: 'number of pages', numberOfPages: 'number of pages',
@@ -143,17 +163,21 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingWithCategoriesWithoutReferencesMeta<
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories, SCBookCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
categories: { categories: {
audio: 'Tonträger', audio: 'Tonträger',
audiobook: 'Hörbuch',
book: 'Buch', book: 'Buch',
cd: 'CD', cd: 'CD',
dvd: 'DVD', dvd: 'DVD',
ePhoto: 'E-Photo', eAudiobook: 'E-Hörbuch',
ebook: 'E-Book', ebook: 'E-Book',
ePhoto: 'E-Photo',
hierarchy: 'mehrteiliges Werk', hierarchy: 'mehrteiliges Werk',
kit: 'Medienkombination', kit: 'Medienkombination',
manuscript: 'Handschrift', manuscript: 'Handschrift',
@@ -170,18 +194,22 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
type: 'Buch', type: 'Buch',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingWithCategoriesWithoutReferencesMeta<
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories, SCBookCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: SCThingType.Book, type: SCThingType.Book,
categories: { categories: {
audio: 'audio material', audio: 'audio material',
audiobook: 'audiobook',
book: 'book', book: 'book',
cd: 'CD', cd: 'CD',
dvd: 'DVD', dvd: 'DVD',
ePhoto: 'E-Photo', eAudiobook: 'E-Audiobook',
ebook: 'E-Book', ebook: 'E-Book',
ePhoto: 'E-Photo',
hierarchy: 'multipart item', hierarchy: 'multipart item',
kit: 'media combination', kit: 'media combination',
manuscript: 'manuscript', manuscript: 'manuscript',

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -29,7 +29,7 @@ import {
} from './abstract/thing-with-categories'; } from './abstract/thing-with-categories';
export type SCBuildingCategories = export type SCBuildingCategories =
'cafe' | 'cafe'
| 'education' | 'education'
| 'library' | 'library'
| 'office' | 'office'
@@ -67,7 +67,8 @@ export interface SCBuildingWithoutReferences
* @indexable * @indexable
*/ */
export interface SCBuilding export interface SCBuilding
extends SCBuildingWithoutReferences, SCPlace, extends SCBuildingWithoutReferences,
SCPlace,
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Translated fields of a building * Translated fields of a building
@@ -81,7 +82,8 @@ export interface SCBuilding
} }
export interface SCBuildingTranslatableProperties export interface SCBuildingTranslatableProperties
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties { extends SCPlaceWithoutReferencesTranslatableProperties,
SCThingWithCategoriesTranslatableProperties {
/** /**
* @see SCBuilding.floors * @see SCBuilding.floors
*/ */
@@ -91,23 +93,25 @@ export interface SCBuildingTranslatableProperties
/** /**
* Meta information about a place * Meta information about a place
*/ */
export class SCBuildingMeta export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SCBuilding> {
extends SCThingMeta
implements SCMetaTranslations<SCBuilding> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCBuildingCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de, SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
floors: 'Etagen', floors: 'Etagen',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCBuildingCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en, SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
floors: 'floors', floors: 'floors',
}, },
}; };
@@ -117,9 +121,11 @@ export class SCBuildingMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCBuildingCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de, SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
categories: { categories: {
'cafe': 'Café', 'cafe': 'Café',
'canteen': 'Kantine', 'canteen': 'Kantine',
@@ -133,9 +139,11 @@ export class SCBuildingMeta
type: 'Gebäude', type: 'Gebäude',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCBuildingCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en, SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
type: SCThingType.Building, type: SCThingType.Building,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -51,7 +51,8 @@ export interface SCCatalogWithoutReferences
* @indexable * @indexable
*/ */
export interface SCCatalog export interface SCCatalog
extends SCCatalogWithoutReferences, SCThing, extends SCCatalogWithoutReferences,
SCThing,
SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Academic term that a catalog belongs to (e.g. semester) * Academic term that a catalog belongs to (e.g. semester)
@@ -82,23 +83,26 @@ export interface SCCatalog
/** /**
* Catalog meta data * Catalog meta data
*/ */
export class SCCatalogMeta export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
academicTerm: 'Semester', academicTerm: 'Semester',
level: 'Ebene', level: 'Ebene',
superCatalog: 'übergeordnetes Verzeichniss', superCatalog: 'übergeordnetes Verzeichniss',
superCatalogs: 'übergeordnete Verzeichnisse', superCatalogs: 'übergeordnete Verzeichnisse',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
academicTerm: 'academic term', academicTerm: 'academic term',
level: 'level', level: 'level',
superCatalog: 'parent catalog', superCatalog: 'parent catalog',
@@ -111,16 +115,20 @@ export class SCCatalogMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
'university events': 'Universitätsveranstaltung', 'university events': 'Universitätsveranstaltung',
}, },
type: 'Verzeichnis', type: 'Verzeichnis',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Catalog, type: SCThingType.Catalog,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -14,19 +14,13 @@
*/ */
import {SCMetaTranslations} from '../general/i18n'; import {SCMetaTranslations} from '../general/i18n';
import { import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
SCThing,
SCThingMeta,
SCThingType,
SCThingWithoutReferences,
} from './abstract/thing';
import {SCRoomWithoutReferences} from './room'; import {SCRoomWithoutReferences} from './room';
/** /**
* A contact point without references * A contact point without references
*/ */
export interface SCContactPointWithoutReferences export interface SCContactPointWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* E-mail at the work location * E-mail at the work location
* *
@@ -73,12 +67,10 @@ export interface SCContactPointWithoutReferences
* A contact point * A contact point
* *
* @see http://schema.org/ContactPoint * @see http://schema.org/ContactPoint
*
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCContactPoint export interface SCContactPoint extends SCContactPointWithoutReferences, SCThing {
extends SCContactPointWithoutReferences, SCThing {
/** /**
* Exact place where work is performed * Exact place where work is performed
*/ */
@@ -93,15 +85,13 @@ export interface SCContactPoint
/** /**
* Meta information about a contact point * Meta information about a contact point
*/ */
export class SCContactPointMeta export class SCContactPointMeta extends SCThingMeta implements SCMetaTranslations<SCContactPoint> {
extends SCThingMeta
implements SCMetaTranslations<SCContactPoint> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
areaServed: 'Arbeitsraum', areaServed: 'Arbeitsraum',
email: 'E-Mail-Addresse', email: 'E-Mail-Addresse',
faxNumber: 'Faxnummer', faxNumber: 'Faxnummer',
@@ -110,7 +100,7 @@ export class SCContactPointMeta
url: 'Link', url: 'Link',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
areaServed: 'location', areaServed: 'location',
email: 'email address', email: 'email address',
faxNumber: 'fax number', faxNumber: 'fax number',
@@ -125,11 +115,11 @@ export class SCContactPointMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
type: 'Kontaktinformation', type: 'Kontaktinformation',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
type: SCThingType.ContactPoint, type: SCThingType.ContactPoint,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,7 +13,11 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from './abstract/academic-degree'; import {
SCAcademicDegree,
SCAcademicDegreeMeta,
SCAcademicDegreeWithoutReferences,
} from './abstract/academic-degree';
import {SCThingMeta, SCThingType} from './abstract/thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
@@ -29,7 +33,8 @@ import {SCOrganizationWithoutReferences} from './organization';
* A course of study without references * A course of study without references
*/ */
export interface SCCourseOfStudyWithoutReferences export interface SCCourseOfStudyWithoutReferences
extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences { extends SCAcademicDegreeWithoutReferences,
SCThingThatCanBeOfferedWithoutReferences {
/** /**
* The main language in which the course of study * The main language in which the course of study
* is beeing offered * is beeing offered
@@ -68,7 +73,9 @@ export interface SCCourseOfStudyWithoutReferences
* @indexable * @indexable
*/ */
export interface SCCourseOfStudy export interface SCCourseOfStudy
extends SCCourseOfStudyWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree { extends SCCourseOfStudyWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCAcademicDegree {
/** /**
* The department that manages the course of study * The department that manages the course of study
*/ */
@@ -99,26 +106,19 @@ export interface SCCourseOfStudy
/** /**
* Translatable properties of a course of study * Translatable properties of a course of study
*/ */
export interface SCCourseOfStudyTranslatableProperties export type SCCourseOfStudyTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
extends SCThingThatCanBeOfferedTranslatableProperties {
// noop
}
/** /**
* Meta information about a course of study * Meta information about a course of study
*/ */
export class SCCourseOfStudyMeta export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslations<SCCourseOfStudy> {
extends SCThingMeta
implements SCMetaTranslations<SCCourseOfStudy> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>() ...new SCAcademicDegreeMeta().fieldTranslations.de,
.fieldTranslations.de, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
department: 'Fachbereich', department: 'Fachbereich',
mainLanguage: 'Unterrichtssprache', mainLanguage: 'Unterrichtssprache',
mode: 'Studiengangsart', mode: 'Studiengangsart',
@@ -127,10 +127,8 @@ export class SCCourseOfStudyMeta
timeMode: 'Zeitmodell', timeMode: 'Zeitmodell',
}, },
en: { en: {
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>() ...new SCAcademicDegreeMeta().fieldTranslations.en,
.fieldTranslations.en, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
department: 'department', department: 'department',
mainLanguage: 'main language', mainLanguage: 'main language',
mode: 'mode', mode: 'mode',
@@ -145,12 +143,12 @@ export class SCCourseOfStudyMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de, ...new SCAcademicDegreeMeta().fieldValueTranslations.de,
modes: { modes: {
combination: 'Kombinationsstudiengang', 'combination': 'Kombinationsstudiengang',
'double-degree': 'Doppelstudium', 'double-degree': 'Doppelstudium',
dual: 'duales Studium', 'dual': 'duales Studium',
standard: 'Studium', 'standard': 'Studium',
}, },
timeMode: { timeMode: {
fulltime: 'Vollzeitstudiengang', fulltime: 'Vollzeitstudiengang',
@@ -159,12 +157,12 @@ export class SCCourseOfStudyMeta
type: 'Studiengang', type: 'Studiengang',
}, },
en: { en: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en, ...new SCAcademicDegreeMeta().fieldValueTranslations.en,
modes: { modes: {
combination: 'combination course of study', 'combination': 'combination course of study',
'double-degree': 'double degree course of study', 'double-degree': 'double degree course of study',
dual: 'dual course of study', 'dual': 'dual course of study',
standard: 'course of study', 'standard': 'course of study',
}, },
timeMode: { timeMode: {
fulltime: 'full-time', fulltime: 'full-time',
@@ -178,13 +176,9 @@ export class SCCourseOfStudyMeta
/** /**
* Types of (german) course of study modes * Types of (german) course of study modes
*/ */
export type SCCourseOfStudyMode = 'combination' export type SCCourseOfStudyMode = 'combination' | 'dual' | 'double-degree' | 'standard';
| 'dual'
| 'double-degree'
| 'standard' ;
/** /**
* Types of (german) course of study time modes * Types of (german) course of study time modes
*/ */
export type SCCourseOfStudyTimeMode = 'fulltime' export type SCCourseOfStudyTimeMode = 'fulltime' | 'parttime';
| 'parttime' ;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -30,8 +30,7 @@ import {SCSportCourseWithoutReferences} from './sport-course';
/** /**
* Price groups for sport courses * Price groups for sport courses
*/ */
export interface SCSportCoursePriceGroup export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
extends SCAcademicPriceGroup {
/** /**
* Price for alumnis * Price for alumnis
* *
@@ -43,8 +42,7 @@ export interface SCSportCoursePriceGroup
/** /**
* A date without references * A date without references
*/ */
export interface SCDateSeriesWithoutReferences export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
extends SCThingThatCanBeOfferedWithoutReferences {
/** /**
* Dates of the date series that are initially planned to be held * Dates of the date series that are initially planned to be held
* *
@@ -93,8 +91,7 @@ export interface SCDateSeries
/** /**
* Event to which the date series belongs * Event to which the date series belongs
*/ */
event: SCAcademicEventWithoutReferences event: SCAcademicEventWithoutReferences | SCSportCourseWithoutReferences;
| SCSportCourseWithoutReferences;
/** /**
* Performers of the date series * Performers of the date series
@@ -115,18 +112,14 @@ export interface SCDateSeries
/** /**
* Meta information about a date series * Meta information about a date series
*/ */
export class SCDateSeriesMeta export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<SCDateSeries> {
extends SCThingMeta
implements SCMetaTranslations<SCDateSeries> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...new SCThingInPlaceMeta().fieldTranslations.de,
.de, ...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldTranslations.de,
dates: 'Einzeltermine', dates: 'Einzeltermine',
duration: 'Dauer', duration: 'Dauer',
event: 'Event', event: 'Event',
@@ -135,10 +128,8 @@ export class SCDateSeriesMeta
performers: 'Vortragende', performers: 'Vortragende',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...new SCThingInPlaceMeta().fieldTranslations.en,
.en, ...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldTranslations.en,
dates: 'dates', dates: 'dates',
duration: 'duration', duration: 'duration',
event: 'event', event: 'event',
@@ -153,17 +144,13 @@ export class SCDateSeriesMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...new SCThingInPlaceMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldValueTranslations.de,
type: 'Terminserie', type: 'Terminserie',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...new SCThingInPlaceMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldValueTranslations.en,
type: SCThingType.DateSeries, type: SCThingType.DateSeries,
}, },
}; };
@@ -172,6 +159,4 @@ export class SCDateSeriesMeta
/** /**
* Translatable properties of date series' * Translatable properties of date series'
*/ */
export interface SCDateSeriesTranslatableProperties export type SCDateSeriesTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
extends SCThingThatCanBeOfferedTranslatableProperties {
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -21,8 +21,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs
/** /**
* A diff without references * A diff without references
*/ */
export interface SCDiffWithoutReferences export interface SCDiffWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Action of the diff * Action of the diff
*/ */
@@ -49,8 +48,7 @@ export interface SCDiffWithoutReferences
* *
* @validatable * @validatable
*/ */
export interface SCDiff export interface SCDiff extends SCDiffWithoutReferences, SCThing {
extends SCDiffWithoutReferences, SCThing {
/** /**
* Original object the diff was generated on * Original object the diff was generated on
*/ */
@@ -65,22 +63,20 @@ export interface SCDiff
/** /**
* Meta information about a diff * Meta information about a diff
*/ */
export class SCDiffMeta export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
extends SCThingMeta
implements SCMetaTranslations<SCDiff> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
action: 'Aktion', action: 'Aktion',
changes: 'Änderungen', changes: 'Änderungen',
dateCreated: 'Erstellungsdatum', dateCreated: 'Erstellungsdatum',
object: 'Objekt', object: 'Objekt',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
action: 'action', action: 'action',
changes: 'changes', changes: 'changes',
dateCreated: 'date created', dateCreated: 'date created',
@@ -93,15 +89,15 @@ export class SCDiffMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
action: { action: {
'changed': 'geändert', changed: 'geändert',
'removed': 'gelöscht', removed: 'gelöscht',
}, },
type: 'Unterschied', type: 'Unterschied',
}, },
en: { en: {
...SCThingMeta.getInstance().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
type: SCThingType.Diff, type: SCThingType.Diff,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -53,6 +53,11 @@ export interface SCDishWithoutReferences
*/ */
nutrition?: SCNutritionInformation; nutrition?: SCNutritionInformation;
/**
* Section of the restaurant menu to which the dish belongs
*/
menuSection?: SCMenuSection;
/** /**
* Translated fields of a dish * Translated fields of a dish
*/ */
@@ -71,7 +76,8 @@ export interface SCDishWithoutReferences
* @indexable * @indexable
*/ */
export interface SCDish export interface SCDish
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, extends SCDishWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCThingWithCategories<SCDishCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCDishCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish) * Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
@@ -90,7 +96,8 @@ export interface SCDish
} }
export interface SCDishTranslatableProperties export interface SCDishTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties { extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {
/** /**
* Additives of the dish * Additives of the dish
* *
@@ -127,13 +134,7 @@ export interface SCDishCharacteristic {
/** /**
* A list of categories for dishes * A list of categories for dishes
*/ */
export type SCDishCategories = export type SCDishCategories = 'appetizer' | 'salad' | 'main dish' | 'dessert' | 'soup' | 'side dish';
| 'appetizer'
| 'salad'
| 'main dish'
| 'dessert'
| 'soup'
| 'side dish';
/** /**
* Type definition for SCNutritionInformation * Type definition for SCNutritionInformation
@@ -191,35 +192,51 @@ export interface SCNutritionInformation {
sugarContent?: number; sugarContent?: number;
} }
export interface SCMenuSection {
/**
* Name of the menu section (mostly to be used as a section title)
*/
name: 'breakfast' | 'lunch' | 'dinner';
/**
* The time span when the dishes from the sections are available.
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
*/
servingHours?: string;
}
/** /**
* Meta information about a dish * Meta information about a dish
*/ */
export class SCDishMeta export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish> {
extends SCThingMeta
implements SCMetaTranslations<SCDish> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCDishCategories,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() SCThingWithCategoriesSpecificValues
.fieldTranslations.de, >().fieldTranslations.de,
additives: 'Zusatzstoffe', ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
additives: 'Allergene und Zusatzstoffe',
characteristics: 'Merkmale', characteristics: 'Merkmale',
dishAddOns: 'Beilagen', dishAddOns: 'Beilagen',
nutrition: 'Nährwertangaben', nutrition: 'Nährwertangaben',
menuSection: 'Menüabschnitt',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCDishCategories,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() SCThingWithCategoriesSpecificValues
.fieldTranslations.en, >().fieldTranslations.en,
additives: 'additives', ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
additives: 'additives and allergens',
characteristics: 'characteristics', characteristics: 'characteristics',
dishAddOns: 'side dishes', dishAddOns: 'side dishes',
nutrition: 'nutrition information', nutrition: 'nutrition information',
menuSection: 'menu section',
}, },
}; };
@@ -228,25 +245,27 @@ export class SCDishMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCDishCategories,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() SCThingWithCategoriesSpecificValues
.fieldValueTranslations.de, >().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
categories: { categories: {
appetizer: 'Vorspeise', 'appetizer': 'Vorspeise',
dessert: 'Nachtisch', 'dessert': 'Nachtisch',
'main dish': 'Hauptgericht', 'main dish': 'Hauptgericht',
salad: 'Salat', 'salad': 'Salat',
'side dish': 'Beilage', 'side dish': 'Beilage',
soup: 'Suppe', 'soup': 'Suppe',
}, },
type: 'Essen', type: 'Essen',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCDishCategories,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() SCThingWithCategoriesSpecificValues
.fieldValueTranslations.en, >().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: SCThingType.Dish, type: SCThingType.Dish,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -18,8 +18,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
/** /**
* A favorite without references * A favorite without references
*/ */
export interface SCFavoriteWithoutReferences export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences {
extends SCSaveableThingWithoutReferences {
/** /**
* Type of a favorite * Type of a favorite
*/ */
@@ -41,6 +40,4 @@ export interface SCFavorite extends SCSaveableThing {
/** /**
* Meta information about a favorite * Meta information about a favorite
*/ */
export class SCFavoriteMeta export class SCFavoriteMeta extends SCThingMeta {}
extends SCThingMeta {
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,10 +12,14 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson'; import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCMetaTranslations, SCTranslations} from '../general/i18n'; import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './abstract/thing'; import {
SCThingMeta,
SCThingTranslatableProperties,
SCThingType,
SCThingWithoutReferences,
} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place'; import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {SCPointOfInterestWithoutReferences} from './point-of-interest'; import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './room'; import {SCRoomWithoutReferences} from './room';
@@ -23,8 +27,7 @@ import {SCRoomWithoutReferences} from './room';
/** /**
* A floor without references * A floor without references
*/ */
export interface SCFloorWithoutReferences export interface SCFloorWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name. * Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
* *
@@ -54,8 +57,7 @@ export interface SCFloorWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCFloor export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
extends SCFloorWithoutReferences, SCThingInPlace {
/** /**
* Translated fields of a floor * Translated fields of a floor
*/ */
@@ -70,8 +72,7 @@ export interface SCFloor
/** /**
* A feature collection * A feature collection
*/ */
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject> export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject> extends FeatureCollection<T> {
extends FeatureCollection<T> {
/** /**
* Features of the collection * Features of the collection
*/ */
@@ -82,7 +83,7 @@ export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
* A feature with a place * A feature with a place
*/ */
export interface SCFloorFeatureWithPlace<T extends GeometryObject> export interface SCFloorFeatureWithPlace<T extends GeometryObject>
// tslint:disable-next-line:no-any TODO // eslint-disable-next-line @typescript-eslint/no-explicit-any
extends Feature<T, any> { extends Feature<T, any> {
/** /**
* The place of the feature * The place of the feature
@@ -93,8 +94,7 @@ export interface SCFloorFeatureWithPlace<T extends GeometryObject>
/** /**
* Translatable properties of a floor * Translatable properties of a floor
*/ */
export interface SCFloorTranslatableProperties export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
extends SCThingTranslatableProperties {
/** /**
* Translation of the floor name * Translation of the floor name
* *
@@ -106,22 +106,18 @@ export interface SCFloorTranslatableProperties
/** /**
* Meta information about floors * Meta information about floors
*/ */
export class SCFloorMeta export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFloor> {
extends SCThingMeta
implements SCMetaTranslations<SCFloor> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...new SCThingInPlaceMeta().fieldTranslations.de,
.de,
floorName: 'Etagenbezeichnung', floorName: 'Etagenbezeichnung',
plan: 'Grundriss', plan: 'Grundriss',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...new SCThingInPlaceMeta().fieldTranslations.en,
.en,
floorName: 'floor name', floorName: 'floor name',
plan: 'plan', plan: 'plan',
}, },
@@ -132,13 +128,11 @@ export class SCFloorMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...new SCThingInPlaceMeta().fieldValueTranslations.de,
.fieldValueTranslations.de,
type: 'Etage', type: 'Etage',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...new SCThingInPlaceMeta().fieldValueTranslations.en,
.fieldValueTranslations.en,
type: SCThingType.Floor, type: SCThingType.Floor,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -24,7 +24,8 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered'; import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from './abstract/thing-with-categories'; } from './abstract/thing-with-categories';
import {SCUserGroup} from './abstract/user-groups'; import {SCUserGroup} from './abstract/user-groups';
import {SCOrganizationWithoutReferences} from './organization'; import {SCOrganizationWithoutReferences} from './organization';
@@ -39,7 +40,7 @@ export type SCMessageCategories = 'news';
*/ */
export interface SCMessageWithoutReferences export interface SCMessageWithoutReferences
extends SCCreativeWorkWithoutReferences, extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Organizational unit for which the message is intended * Organizational unit for which the message is intended
*/ */
@@ -93,8 +94,7 @@ export interface SCMessageWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCMessage export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
extends SCCreativeWork, SCMessageWithoutReferences {
/** /**
* Translated fields of a message * Translated fields of a message
*/ */
@@ -110,7 +110,8 @@ export interface SCMessage
* Translatable properties of a message * Translatable properties of a message
*/ */
export interface SCMessageTranslatableProperties export interface SCMessageTranslatableProperties
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties { extends SCCreativeWorkTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {
/** /**
* Message itself * Message itself
* *
@@ -122,18 +123,17 @@ export interface SCMessageTranslatableProperties
/** /**
* Meta information about messages * Meta information about messages
*/ */
export class SCMessageMeta export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
extends SCThingMeta
implements SCMetaTranslations<SCMessage> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...new SCCreativeWorkMeta().fieldTranslations.de,
.de, ...new SCThingWithCategoriesWithoutReferencesMeta<
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCMessageCategories, SCMessageCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
audienceOrganizations: 'Zielgruppenorganisationen', audienceOrganizations: 'Zielgruppenorganisationen',
audiences: 'Zielgruppen', audiences: 'Zielgruppen',
dateCreated: 'Erstellungsdatum', dateCreated: 'Erstellungsdatum',
@@ -141,10 +141,11 @@ export class SCMessageMeta
sequenceIndex: 'Sequenzindex', sequenceIndex: 'Sequenzindex',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...new SCCreativeWorkMeta().fieldTranslations.en,
.en, ...new SCThingWithCategoriesWithoutReferencesMeta<
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCMessageCategories, SCMessageCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
audienceOrganizations: 'audience organizations', audienceOrganizations: 'audience organizations',
audiences: 'audiences', audiences: 'audiences',
dateCreated: 'date created', dateCreated: 'date created',
@@ -158,8 +159,11 @@ export class SCMessageMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCMessageCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
audiences: { audiences: {
employees: 'Angestellte', employees: 'Angestellte',
guests: 'Gäste', guests: 'Gäste',
@@ -171,8 +175,11 @@ export class SCMessageMeta
type: 'Nachricht', type: 'Nachricht',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCMessageCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Message, type: SCThingType.Message,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -20,8 +20,7 @@ import {SCContactPointWithoutReferences} from './contact-point';
/** /**
* An organization without references * An organization without references
*/ */
export interface SCOrganizationWithoutReferences export interface SCOrganizationWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Type of an organization * Type of an organization
*/ */
@@ -34,8 +33,7 @@ export interface SCOrganizationWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCOrganization export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
extends SCOrganizationWithoutReferences, SCThingInPlace {
/** /**
* A list of contact points concerning the organization * A list of contact points concerning the organization
*/ */
@@ -50,18 +48,17 @@ export interface SCOrganization
/** /**
* Meta information about an organization * Meta information about an organization
*/ */
export class SCOrganizationMeta export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de, ...new SCThingInPlaceMeta().fieldTranslations.de,
contactPoints: 'Kontaktinformationen', contactPoints: 'Kontaktinformationen',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en, ...new SCThingInPlaceMeta().fieldTranslations.en,
contactPoints: 'contact details', contactPoints: 'contact details',
}, },
}; };
@@ -71,11 +68,11 @@ export class SCOrganizationMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.de, ...new SCThingInPlaceMeta().fieldValueTranslations.de,
type: 'Einrichtung', type: 'Einrichtung',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.en, ...new SCThingInPlaceMeta().fieldValueTranslations.en,
type: SCThingType.Organization, type: SCThingType.Organization,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -20,6 +20,13 @@ import {
SCCreativeWorkWithoutReferences, SCCreativeWorkWithoutReferences,
} from './abstract/creative-work'; } from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
@@ -37,7 +44,8 @@ export type SCPeriodicalCategories = 'journal' | 'electronic';
*/ */
export interface SCPeriodicalWithoutReferences export interface SCPeriodicalWithoutReferences
extends SCCreativeWorkWithoutReferences, extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> { SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Categories of a periodical * Categories of a periodical
*/ */
@@ -68,7 +76,9 @@ export interface SCPeriodicalWithoutReferences
* @indexable * @indexable
*/ */
export interface SCPeriodical export interface SCPeriodical
extends SCCreativeWork, SCPeriodicalWithoutReferences { extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCPeriodicalWithoutReferences {
/** /**
* Translated properties of a periodical * Translated properties of a periodical
*/ */
@@ -84,8 +94,9 @@ export interface SCPeriodical
* Translatable properties of a periodical * Translatable properties of a periodical
*/ */
export interface SCPeriodicalTranslatableFields export interface SCPeriodicalTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties { extends SCThingWithCategoriesTranslatableProperties,
} SCThingThatCanBeOfferedTranslatableProperties,
SCCreativeWorkTranslatableProperties {}
/** /**
* Meta information about a periodical * Meta information about a periodical
@@ -96,16 +107,22 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de, ...new SCCreativeWorkMeta().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
categories: 'Format', categories: 'Format',
ISSNs: 'ISSN', ISSNs: 'ISSN',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en, ...new SCCreativeWorkMeta().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
categories: 'format', categories: 'format',
ISSNs: 'ISSN', ISSNs: 'ISSN',
}, },
@@ -116,8 +133,12 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
type: 'Periodikum', type: 'Periodikum',
categories: { categories: {
electronic: 'E-Journal', electronic: 'E-Journal',
@@ -125,8 +146,12 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
}, },
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: 'periodical', type: 'periodical',
categories: { categories: {
electronic: 'E-Journal', electronic: 'E-Journal',

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -24,8 +24,7 @@ import {SCRoomWithoutReferences} from './room';
/** /**
* A person without references * A person without references
*/ */
export interface SCPersonWithoutReferences export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Additional first names of the person. * Additional first names of the person.
* *
@@ -45,7 +44,6 @@ export interface SCPersonWithoutReferences
* The private email address of the person. * The private email address of the person.
* *
* @TJS-format email * @TJS-format email
*
* @filterable * @filterable
* @keyword * @keyword
*/ */
@@ -138,8 +136,7 @@ export interface SCPersonWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCPerson export interface SCPerson extends SCPersonWithoutReferences, SCThing {
extends SCPersonWithoutReferences, SCThing {
/** /**
* Organization the person works for * Organization the person works for
*/ */
@@ -148,9 +145,9 @@ export interface SCPerson
/** /**
* A list of homes of the person * A list of homes of the person
*/ */
homeLocations?: Array<SCBuildingWithoutReferences homeLocations?: Array<
| SCPointOfInterestWithoutReferences SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences
| SCRoomWithoutReferences>; >;
/** /**
* Type of a person * Type of a person
@@ -166,15 +163,13 @@ export interface SCPerson
/** /**
* Meta information about a person * Meta information about a person
*/ */
export class SCPersonMeta export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPerson> {
extends SCThingMeta
implements SCMetaTranslations<SCPerson> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
additionalName: 'Zusatzname', additionalName: 'Zusatzname',
affiliations: 'Zugehörigkeiten', affiliations: 'Zugehörigkeiten',
birthDate: 'Geburtsdatum', birthDate: 'Geburtsdatum',
@@ -192,7 +187,7 @@ export class SCPersonMeta
workLocations: 'Arbeitsstandorte', workLocations: 'Arbeitsstandorte',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
additionalName: 'additional name', additionalName: 'additional name',
affiliations: 'affiliations', affiliations: 'affiliations',
birthDate: 'birth date', birthDate: 'birth date',
@@ -217,17 +212,17 @@ export class SCPersonMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
gender: { gender: {
'female': 'weiblich', female: 'weiblich',
'inter': 'divers', inter: 'divers',
'male': 'männlich', male: 'männlich',
'undefined': 'undefiniert', undefined: 'undefiniert',
}, },
type: 'Person', type: 'Person',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
type: SCThingType.Person, type: SCThingType.Person,
}, },
}; };
@@ -236,8 +231,4 @@ export class SCPersonMeta
/** /**
* Gender of a person * Gender of a person
*/ */
export type SCPersonGender = export type SCPersonGender = 'male' | 'female' | 'inter' | 'undefined';
'male'
| 'female'
| 'inter'
| 'undefined';

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -28,7 +28,10 @@ import {
* A point of interest without references * A point of interest without references
*/ */
export interface SCPointOfInterestWithoutReferences export interface SCPointOfInterestWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>, extends SCThingWithCategoriesWithoutReferences<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>,
SCPlaceWithoutReferences { SCPlaceWithoutReferences {
/** /**
* Translated properties of a point of interest * Translated properties of a point of interest
@@ -48,7 +51,9 @@ export interface SCPointOfInterestWithoutReferences
* @indexable * @indexable
*/ */
export interface SCPointOfInterest export interface SCPointOfInterest
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace, extends SCPointOfInterestWithoutReferences,
SCThingInPlace,
SCPlace,
SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Translated properties of a point of interest * Translated properties of a point of interest
@@ -65,7 +70,7 @@ export interface SCPointOfInterest
* Categories of a point of interest * Categories of a point of interest
*/ */
export type SCPointOfInterestCategories = export type SCPointOfInterestCategories =
'computer' | 'computer'
| 'validator' | 'validator'
| 'card charger' | 'card charger'
| 'printer' | 'printer'
@@ -74,26 +79,26 @@ export type SCPointOfInterestCategories =
/** /**
* Meta information about points of interest * Meta information about points of interest
*/ */
export class SCPointOfInterestMeta export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations<SCPointOfInterest> {
extends SCThingMeta
implements SCMetaTranslations<SCPointOfInterest> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCPointOfInterestCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de, SCThingWithCategoriesSpecificValues
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations >().fieldTranslations.de,
.de, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCPointOfInterestCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en, SCThingWithCategoriesSpecificValues
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations >().fieldTranslations.en,
.en, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
}, },
}; };
@@ -102,9 +107,11 @@ export class SCPointOfInterestMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCPointOfInterestCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de, SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
categories: { categories: {
'card charger': 'Kartenaufwerter', 'card charger': 'Kartenaufwerter',
'computer': 'Computer', 'computer': 'Computer',
@@ -115,9 +122,11 @@ export class SCPointOfInterestMeta
type: 'Sonderziel', type: 'Sonderziel',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCPointOfInterestCategories,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en, SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
type: SCThingType.PointOfInterest, type: SCThingType.PointOfInterest,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 StApps * Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -19,8 +19,7 @@ import {SCThingMeta, SCThingTranslatableProperties, SCThingType} from './abstrac
/** /**
* An publication event without references * An publication event without references
*/ */
export interface SCPublicationEventWithoutReferences export interface SCPublicationEventWithoutReferences extends SCEventWithoutReferences {
extends SCEventWithoutReferences {
/** /**
* All the locations related to the event (e.g. where a creative work was published) * All the locations related to the event (e.g. where a creative work was published)
*/ */
@@ -48,8 +47,7 @@ export interface SCPublicationEventWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCPublicationEvent export interface SCPublicationEvent extends SCEvent, SCPublicationEventWithoutReferences {
extends SCEvent, SCPublicationEventWithoutReferences {
/** /**
* Translated fields of an publication event * Translated fields of an publication event
*/ */
@@ -64,26 +62,23 @@ export interface SCPublicationEvent
/** /**
* Translatable properties of an publication event * Translatable properties of an publication event
*/ */
export interface SCPublicationEventTranslatableProperties extends SCThingTranslatableProperties { export type SCPublicationEventTranslatableProperties = SCThingTranslatableProperties;
}
/** /**
* Meta information about publication events * Meta information about publication events
*/ */
export class SCPublicationEventMeta export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTranslations<SCPublicationEvent> {
extends SCThingMeta
implements SCMetaTranslations<SCPublicationEvent> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de, ...new SCEventMeta().fieldTranslations.de,
locations: 'Erscheinungsorte', locations: 'Erscheinungsorte',
publisher: 'Verlag', publisher: 'Verlag',
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en, ...new SCEventMeta().fieldTranslations.en,
locations: 'places of publication', locations: 'places of publication',
publisher: 'publisher', publisher: 'publisher',
}, },
@@ -94,11 +89,11 @@ export class SCPublicationEventMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de, ...new SCEventMeta().fieldValueTranslations.de,
type: 'Veröffentlichung', type: 'Veröffentlichung',
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en, ...new SCEventMeta().fieldValueTranslations.en,
type: 'publication event', type: 'publication event',
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -35,7 +35,7 @@ import {
* Categories of a room * Categories of a room
*/ */
export type SCRoomCategories = export type SCRoomCategories =
'cafe' | 'cafe'
| 'canteen' | 'canteen'
| 'computer' | 'computer'
| 'education' | 'education'
@@ -53,7 +53,8 @@ export type SCRoomCategories =
* A room without references * A room without references
*/ */
export interface SCRoomWithoutReferences export interface SCRoomWithoutReferences
extends SCPlaceWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferences, extends SCPlaceWithoutReferences,
SCThingThatAcceptsPaymentsWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> { SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
/** /**
* The name of the floor in which the room is in. * The name of the floor in which the room is in.
@@ -88,7 +89,10 @@ export interface SCRoomWithoutReferences
* @indexable * @indexable
*/ */
export interface SCRoom export interface SCRoom
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace, extends SCRoomWithoutReferences,
SCThingInPlace,
SCThingThatAcceptsPayments,
SCPlace,
SCThingWithCategories<SCRoomCategories, SCRoomSpecificValues> { SCThingWithCategories<SCRoomCategories, SCRoomSpecificValues> {
/** /**
* Translations of specific values of the object * Translations of specific values of the object
@@ -106,47 +110,50 @@ export interface SCRoom
/** /**
* Category specific values of a room * Category specific values of a room
*/ */
export interface SCRoomSpecificValues export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
extends SCThingWithCategoriesSpecificValues {
/** /**
* Category specific opening hours of the room * Category specific opening hours of the room
* *
* @keyword * @keyword
*/ */
openingHours?: string; openingHours?: string;
/**
* Category specific service hours of the room (e.g. cooked food serving hours)
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/
serviceHours?: string;
} }
/** /**
* Meta information about a place * Meta information about a place
*/ */
export class SCRoomMeta export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom> {
extends SCThingMeta
implements SCMetaTranslations<SCRoom> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>() ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
.fieldTranslations.de, .fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories, ...new SCThingInPlaceMeta().fieldTranslations.de,
SCRoomSpecificValues>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
floorName: 'Etagenbezeichnung', floorName: 'Etagenbezeichnung',
inventory: 'Bestand', inventory: 'Bestand',
serviceHours: 'Servicezeiten',
}, },
en: { en: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>() ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
.fieldTranslations.en, .fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories, ...new SCThingInPlaceMeta().fieldTranslations.en,
SCRoomSpecificValues>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
floorName: 'floor name', floorName: 'floor name',
inventory: 'inventory', inventory: 'inventory',
serviceHours: 'service hours',
}, },
}; };
@@ -155,13 +162,11 @@ export class SCRoomMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de, ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>() ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de, .fieldValueTranslations.de,
...new SCThingInPlaceMeta().fieldValueTranslations.de,
categories: { categories: {
'cafe': 'Café', 'cafe': 'Café',
'canteen': 'Kantine', 'canteen': 'Kantine',
@@ -180,13 +185,11 @@ export class SCRoomMeta
type: 'Raum', type: 'Raum',
}, },
en: { en: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>() ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en, .fieldValueTranslations.en,
...new SCThingInPlaceMeta().fieldValueTranslations.en,
type: SCThingType.Room, type: SCThingType.Room,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -23,8 +23,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
/** /**
* A semester without references * A semester without references
*/ */
export interface SCSemesterWithoutReferences export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
extends SCAcademicTermWithoutReferences {
/** /**
* The short name of the semester, using the given pattern. * The short name of the semester, using the given pattern.
* *
@@ -46,8 +45,7 @@ export interface SCSemesterWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCSemester export interface SCSemester extends SCSemesterWithoutReferences, SCAcademicTerm {
extends SCSemesterWithoutReferences, SCAcademicTerm {
/** /**
* Type of the semester * Type of the semester
*/ */
@@ -57,15 +55,13 @@ export interface SCSemester
/** /**
* Meta information about a semester * Meta information about a semester
*/ */
export class SCSemesterMeta export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
extends SCThingMeta
implements SCMetaTranslations<SCSemester> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.de, ...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.de,
acronym: 'Abkürzung', acronym: 'Abkürzung',
endDate: 'Ende', endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss', eventsEndDate: 'Vorlesungsschluss',
@@ -73,7 +69,7 @@ export class SCSemesterMeta
startDate: 'Beginn', startDate: 'Beginn',
}, },
en: { en: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.en, ...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.en,
acronym: 'acronym', acronym: 'acronym',
endDate: 'end date', endDate: 'end date',
eventsEndDate: 'semester ending', eventsEndDate: 'semester ending',
@@ -87,13 +83,11 @@ export class SCSemesterMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>() ...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.de,
.fieldValueTranslations.de,
type: 'Semester', type: 'Semester',
}, },
en: { en: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>() ...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.en,
.fieldValueTranslations.en,
type: SCThingType.Semester, type: SCThingType.Semester,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -63,11 +63,7 @@ export interface SCSettingWithoutReferences
/** /**
* A list of categories for settings * A list of categories for settings
*/ */
export type SCSettingCategories = export type SCSettingCategories = 'profile' | 'privacy' | 'credentials' | 'others';
'profile'
| 'privacy'
| 'credentials'
| 'others';
/** /**
* The types of input/value a setting object can carry * The types of input/value a setting object can carry
@@ -86,7 +82,8 @@ export enum SCSettingInputType {
* @validatable * @validatable
*/ */
export interface SCSetting export interface SCSetting
extends SCSettingWithoutReferences, SCThing, extends SCSettingWithoutReferences,
SCThing,
SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> { SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
/** /**
* Translated fields of a setting * Translated fields of a setting
@@ -129,8 +126,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
defaultValue: 'Standard Wert', defaultValue: 'Standard Wert',
inputType: 'Eingabetyp', inputType: 'Eingabetyp',
order: 'Position', order: 'Position',
@@ -138,8 +137,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
values: 'Werte', values: 'Werte',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
defaultValue: 'default value', defaultValue: 'default value',
inputType: 'input type', inputType: 'input type',
order: 'position', order: 'position',
@@ -153,8 +154,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
credentials: 'Anmeldedaten', credentials: 'Anmeldedaten',
others: 'Andere', others: 'Andere',
@@ -163,16 +166,18 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
}, },
inputType: { inputType: {
'multiple choice': 'mehrfach Auswahl', 'multiple choice': 'mehrfach Auswahl',
number: 'Zahl', 'number': 'Zahl',
password: 'Passwort', 'password': 'Passwort',
'single choice': 'einfache Auswahl', 'single choice': 'einfache Auswahl',
text: 'Text', 'text': 'Text',
}, },
type: 'Einstellung', type: 'Einstellung',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories, ...new SCThingWithCategoriesWithoutReferencesMeta<
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Setting, type: SCThingType.Setting,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -19,8 +19,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
/** /**
* A sport course without references * A sport course without references
*/ */
export interface SCSportCourseWithoutReferences export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
extends SCEventWithoutReferences {
/** /**
* Type of a sport course * Type of a sport course
*/ */
@@ -33,8 +32,7 @@ export interface SCSportCourseWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCSportCourse export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
extends SCEvent, SCSportCourseWithoutReferences {
/** /**
* Type of a sport course * Type of a sport course
*/ */
@@ -44,18 +42,16 @@ export interface SCSportCourse
/** /**
* Meta information about a sport course * Meta information about a sport course
*/ */
export class SCSportCourseMeta export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations<SCSportCourse> {
extends SCThingMeta
implements SCMetaTranslations<SCSportCourse> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de, ...new SCEventMeta().fieldTranslations.de,
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en, ...new SCEventMeta().fieldTranslations.en,
}, },
}; };
@@ -64,11 +60,11 @@ export class SCSportCourseMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de, ...new SCEventMeta().fieldValueTranslations.de,
type: 'Sportkurs', type: 'Sportkurs',
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en, ...new SCEventMeta().fieldValueTranslations.en,
type: SCThingType.SportCourse, type: SCThingType.SportCourse,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -29,9 +29,7 @@ import {SCPersonWithoutReferences} from './person';
/** /**
* A study module without references * A study module without references
*/ */
export interface SCStudyModuleWithoutReferences export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
extends SCThingThatCanBeOfferedWithoutReferences {
/** /**
* ECTS points (European Credit Transfer System) * ECTS points (European Credit Transfer System)
* *
@@ -75,7 +73,8 @@ export interface SCStudyModuleWithoutReferences
* @indexable * @indexable
*/ */
export interface SCStudyModule export interface SCStudyModule
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> { extends SCStudyModuleWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* Academic events that make up a study module * Academic events that make up a study module
*/ */
@@ -113,8 +112,7 @@ export interface SCStudyModule
type: SCThingType.StudyModule; type: SCThingType.StudyModule;
} }
export interface SCStudyModuleTranslatableProperties export interface SCStudyModuleTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties {
extends SCThingThatCanBeOfferedTranslatableProperties {
/** /**
* Translations of the majors that this study module is meant for * Translations of the majors that this study module is meant for
* *
@@ -142,17 +140,14 @@ export enum SCStudyModuleNecessity {
/** /**
* Study module meta data * Study module meta data
*/ */
export class SCStudyModuleMeta export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations<SCStudyModule> {
extends SCThingMeta
implements SCMetaTranslations<SCStudyModule> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
.fieldTranslations.de,
academicEvents: 'Veranstaltungen', academicEvents: 'Veranstaltungen',
ects: 'ECTS-Punkte', ects: 'ECTS-Punkte',
faculty: 'Fachbereich', faculty: 'Fachbereich',
@@ -164,9 +159,8 @@ export class SCStudyModuleMeta
secretary: 'Sekretariat', secretary: 'Sekretariat',
}, },
en: { en: {
...SCThingMeta.getInstance().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
.fieldTranslations.en,
academicEvents: 'academic events', academicEvents: 'academic events',
ects: 'ECTS points', ects: 'ECTS points',
faculty: 'faculty', faculty: 'faculty',
@@ -184,20 +178,18 @@ export class SCStudyModuleMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
.fieldValueTranslations.de,
necessity: { necessity: {
'elective': 'Wahlfach', elective: 'Wahlfach',
'optional': 'optional', optional: 'optional',
'required': 'benötigt', required: 'benötigt',
}, },
type: 'Studiengangmodul', type: 'Studiengangmodul',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
.fieldValueTranslations.en,
type: SCThingType.StudyModule, type: SCThingType.StudyModule,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -20,8 +20,7 @@ import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
/** /**
* A ticket without references * A ticket without references
*/ */
export interface SCTicketWithoutReferences export interface SCTicketWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Approximate wait time * Approximate wait time
*/ */
@@ -51,8 +50,7 @@ export interface SCTicketWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCTicket export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
extends SCTicketWithoutReferences, SCThingInPlace {
/** /**
* Type of a ticket * Type of a ticket
*/ */
@@ -62,23 +60,19 @@ export interface SCTicket
/** /**
* Meta information about a ticket * Meta information about a ticket
*/ */
export class SCTicketMeta export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTicket> {
extends SCThingMeta
implements SCMetaTranslations<SCTicket> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...new SCThingInPlaceMeta().fieldTranslations.de,
.de,
approxWaitingTime: 'ungefähre Wartezeit', approxWaitingTime: 'ungefähre Wartezeit',
currentTicketNumber: 'aktuelle Ticketnummer', currentTicketNumber: 'aktuelle Ticketnummer',
serviceType: 'Service Kategorie', serviceType: 'Service Kategorie',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...new SCThingInPlaceMeta().fieldTranslations.en,
.en,
approxWaitingTime: 'approximate waiting time', approxWaitingTime: 'approximate waiting time',
currentTicketNumber: 'current ticket number', currentTicketNumber: 'current ticket number',
serviceType: 'type of service', serviceType: 'type of service',
@@ -90,13 +84,11 @@ export class SCTicketMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...new SCThingInPlaceMeta().fieldValueTranslations.de,
.fieldValueTranslations.de,
type: 'Ticket', type: 'Ticket',
}, },
en: { en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...new SCThingInPlaceMeta().fieldValueTranslations.en,
.fieldValueTranslations.en,
type: SCThingType.Ticket, type: SCThingType.Ticket,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -58,7 +58,9 @@ export interface SCToDoWithoutReferences
* @indexable * @indexable
*/ */
export interface SCToDo export interface SCToDo
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> { extends SCToDoWithoutReferences,
SCThing,
SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
/** /**
* Translated fields of a thing with categories * Translated fields of a thing with categories
*/ */
@@ -88,15 +90,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string, ...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, .fieldTranslations.de,
done: 'Erledigt', done: 'Erledigt',
dueDate: 'Fälligkeitsdatum', dueDate: 'Fälligkeitsdatum',
priority: 'Priorität', priority: 'Priorität',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string, ...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, .fieldTranslations.en,
done: 'done', done: 'done',
dueDate: 'due date', dueDate: 'due date',
priority: 'priority', priority: 'priority',
@@ -108,13 +110,13 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string, ...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, .fieldValueTranslations.de,
type: 'ToDo', type: 'ToDo',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string, ...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, .fieldValueTranslations.en,
type: SCThingType.ToDo, type: SCThingType.ToDo,
}, },
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs
/** /**
* A tour without references * A tour without references
*/ */
export interface SCTourWithoutReferences export interface SCTourWithoutReferences extends SCThingWithoutReferences {
extends SCThingWithoutReferences {
/** /**
* Init script for the tour * Init script for the tour
* *
@@ -46,8 +45,7 @@ export interface SCTourWithoutReferences
* @validatable * @validatable
* @indexable * @indexable
*/ */
export interface SCTour export interface SCTour extends SCTourWithoutReferences, SCThing {
extends SCTourWithoutReferences, SCThing {
/** /**
* Type of a tour * Type of a tour
*/ */
@@ -57,20 +55,18 @@ export interface SCTour
/** /**
* Meta information about a tour * Meta information about a tour
*/ */
export class SCTourMeta export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour> {
extends SCThingMeta
implements SCMetaTranslations<SCTour> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...new SCThingMeta().fieldTranslations.de,
init: 'Initiales Skript', init: 'Initiales Skript',
steps: 'Schritte', steps: 'Schritte',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...new SCThingMeta().fieldTranslations.en,
init: 'initial script', init: 'initial script',
steps: 'steps', steps: 'steps',
}, },
@@ -81,11 +77,11 @@ export class SCTourMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...new SCThingMeta().fieldValueTranslations.de,
type: 'Tour', type: 'Tour',
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en, ...new SCThingMeta().fieldValueTranslations.en,
type: SCThingType.Tour, type: SCThingType.Tour,
}, },
}; };
@@ -94,10 +90,7 @@ export class SCTourMeta
/** /**
* A step in a tour * A step in a tour
*/ */
export type SCTourStep = export type SCTourStep = SCTourStepMenu | SCTourStepLocation | SCTourStepTooltip;
SCTourStepMenu
| SCTourStepLocation
| SCTourStepTooltip;
/** /**
* A location of a tour step * A location of a tour step

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,17 +12,30 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCLanguage, SCMetaTranslations} from '../general/i18n'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Duration} from '../general/time'; import {SCISO8601Duration} from '../general/time';
import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from './abstract/creative-work'; import {
SCCreativeWork,
SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import {SCPersonWithoutReferences} from './person'; import {SCPersonWithoutReferences} from './person';
/** /**
* A video without references * A video without references
*/ */
export interface SCVideoWithoutReferences export interface SCVideoWithoutReferences
extends SCCreativeWorkWithoutReferences { extends SCCreativeWorkWithoutReferences,
SCThingThatCanBeOfferedWithoutReferences {
/** /**
* The Duration of the Video * The Duration of the Video
*/ */
@@ -52,6 +65,11 @@ export interface SCVideoWithoutReferences
*/ */
transcript?: string; transcript?: string;
/**
* Translated fields of a video
*/
translations?: SCTranslations<SCVideoTranslatableFields>;
/** /**
* Type of an Video * Type of an Video
*/ */
@@ -123,31 +141,43 @@ export interface SCVideoTrack {
* @indexable * @indexable
*/ */
export interface SCVideo export interface SCVideo
extends SCCreativeWork, SCVideoWithoutReferences { extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCVideoWithoutReferences {
/** /**
* Persons acting in the Video * Persons acting in the Video
*/ */
actors?: SCPersonWithoutReferences[]; actors?: SCPersonWithoutReferences[];
/**
* Translated fields of a video
*/
translations?: SCTranslations<SCVideoTranslatableFields>;
/** /**
* Type of a video * Type of a video
*/ */
type: SCThingType.Video; type: SCThingType.Video;
} }
/**
* Translatable properties of a video
*/
export interface SCVideoTranslatableFields
extends SCCreativeWorkTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {}
/** /**
* Meta information about a video * Meta information about a video
*/ */
export class SCVideoMeta export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVideo> {
extends SCThingMeta
implements SCMetaTranslations<SCVideo> {
/** /**
* Translations of fields * Translations of fields
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...new SCCreativeWorkMeta().fieldTranslations.de,
.de, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
actors: 'Darsteller', actors: 'Darsteller',
duration: 'Dauer', duration: 'Dauer',
sources: 'Quellen', sources: 'Quellen',
@@ -156,8 +186,8 @@ export class SCVideoMeta
transcript: 'Transkript', transcript: 'Transkript',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...new SCCreativeWorkMeta().fieldTranslations.en,
.en, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
actors: 'actors', actors: 'actors',
duration: 'duration', duration: 'duration',
sources: 'sources', sources: 'sources',
@@ -172,13 +202,13 @@ export class SCVideoMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.de,
.fieldValueTranslations.de, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
type: 'Video', type: 'Video',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...new SCCreativeWorkMeta().fieldValueTranslations.en,
.fieldValueTranslations.en, ...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: SCThingType.Video, type: SCThingType.Video,
}, },
}; };
@@ -188,7 +218,7 @@ export class SCVideoMeta
* Video Encoding Formats * Video Encoding Formats
*/ */
export type SCVideoMimeType = export type SCVideoMimeType =
'video/mp4' | 'video/mp4'
| 'video/ogg' | 'video/ogg'
| 'video/webm' | 'video/webm'
| 'application/vnd.apple.mpegurl' | 'application/vnd.apple.mpegurl'
@@ -197,9 +227,4 @@ export type SCVideoMimeType =
/** /**
* Video Track Types * Video Track Types
*/ */
export type SCVideoTrackTypes = export type SCVideoTrackTypes = 'closed captions' | 'chapters' | 'description' | 'metadata' | 'subtitles';
'closed captions'
| 'chapters'
| 'description'
| 'metadata'
| 'subtitles';

View File

@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2019-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,22 +13,21 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import clone = require('fast-clone');
import equal = require('fast-deep-equal/es6'); import equal = require('fast-deep-equal/es6');
import clone = require('rfdc');
import {Defined, TSOCType} from 'ts-optchain'; import {Defined, TSOCType} from 'ts-optchain';
import {SCLanguageCode} from './general/i18n'; import {SCLanguageCode} from './general/i18n';
import {isThing} from './guards'; import {isThing} from './guards';
import {SCClasses} from './meta'; import {SCClasses} from './meta';
import {SCThing, SCThingType} from './things/abstract/thing'; import {SCThing, SCThingType} from './things/abstract/thing';
// tslint:disable:no-any // eslint disable @typescript-eslint/no-explicit-any
const standardCacheSize = 200; const standardCacheSize = 200;
/** /**
* SCThingTranslator class * SCThingTranslator class
*/ */
export class SCThingTranslator { export class SCThingTranslator {
/** /**
* Getter for language property * Getter for language property
*/ */
@@ -77,6 +77,13 @@ export class SCThingTranslator {
this.sourceCache = new LRUCache(cacheCapacity); this.sourceCache = new LRUCache(cacheCapacity);
this._language = language; this._language = language;
this.metaClasses = SCClasses; this.metaClasses = SCClasses;
// Initalize all meta classes once
if (typeof (this.metaClasses as any)[Object.keys(this.metaClasses)[0]] === 'function') {
for (const metaClass of Object.keys(this.metaClasses)) {
(this.metaClasses as any)[metaClass] = new (SCClasses as any)[metaClass]();
}
}
} }
/** /**
@@ -85,15 +92,14 @@ export class SCThingTranslator {
* @param data The intermediate object / primitive returned by the Proxys get() method * @param data The intermediate object / primitive returned by the Proxys get() method
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s) * @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
*/ */
// tslint:disable-next-line:prefer-function-over-method
private deeptranslate<T>(data?: T): TSOCType<T> { private deeptranslate<T>(data?: T): TSOCType<T> {
const proxy = new Proxy( const proxy = new Proxy(
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as TSOCType<T>, ((defaultValue?: Defined<T>) => (data == undefined ? defaultValue : data)) as TSOCType<T>,
{ {
get: (target, key) => { get: (target, key) => {
const obj: any = target(); const object: any = target();
return this.deeptranslate(obj[key]); return this.deeptranslate(object[key]);
}, },
}, },
); );
@@ -108,28 +114,25 @@ export class SCThingTranslator {
* @param language The language the thing property values are translated to * @param language The language the thing property values are translated to
* @returns The thing with all known meta values translated * @returns The thing with all known meta values translated
*/ */
private getAllMetaFieldTranslations(thingType: SCThingType, private getAllMetaFieldTranslations(thingType: SCThingType, language: SCLanguageCode): object | undefined {
language: SCLanguageCode): object | undefined {
const fieldTranslations = {}; const fieldTranslations = {};
const metaClass = this.getMetaClassInstance(thingType); const metaClass = this.getMetaClassInstance(thingType);
if (typeof metaClass === 'undefined') { if (metaClass === undefined) {
return undefined; return undefined;
} }
// Assigns every property in fieldTranslations to the known base language translation // Assigns every property in fieldTranslations to the known base language translation
if (typeof metaClass.fieldTranslations.en !== 'undefined') { if (metaClass.fieldTranslations.en !== undefined) {
Object.keys(metaClass.fieldTranslations.en) for (const key of Object.keys(metaClass.fieldTranslations.en)) {
.forEach((key) => { (fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key]; }
});
} }
// Assigns every property in fieldTranslations to the known translation in given language // Assigns every property in fieldTranslations to the known translation in given language
if (typeof metaClass.fieldTranslations[language] !== 'undefined') { if (metaClass.fieldTranslations[language] !== undefined) {
Object.keys(metaClass.fieldTranslations[language]) for (const key of Object.keys(metaClass.fieldTranslations[language])) {
.forEach((key) => { (fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key]; }
});
} }
return fieldTranslations; return fieldTranslations;
@@ -143,7 +146,7 @@ export class SCThingTranslator {
*/ */
private getMetaClassInstance(thingType: SCThingType): any { private getMetaClassInstance(thingType: SCThingType): any {
if (thingType in this.metaClasses) { if (thingType in this.metaClasses) {
return new (this.metaClasses as any)[thingType](); return this.metaClasses[thingType];
} }
return undefined; return undefined;
@@ -157,32 +160,33 @@ export class SCThingTranslator {
* @param language The language the thing / object is translated to * @param language The language the thing / object is translated to
* @returns The thing with translated meta field values * @returns The thing with translated meta field values
*/ */
private replaceAvailableMetaFieldValueTranslations(instance: any, private replaceAvailableMetaFieldValueTranslations(instance: any, language: SCLanguageCode): any {
language: SCLanguageCode): any {
const metaClass = this.getMetaClassInstance(instance.type); const metaClass = this.getMetaClassInstance(instance.type);
if (typeof metaClass === 'undefined') { if (metaClass === undefined) {
return instance; return instance;
} }
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') { if (metaClass.fieldValueTranslations[language] !== undefined) {
Object.keys(metaClass.fieldValueTranslations[language]) for (const key of Object.keys(metaClass.fieldValueTranslations[language])) {
.forEach((key) => { if (
if (metaClass.fieldValueTranslations[language][key] instanceof Object metaClass.fieldValueTranslations[language][key] instanceof Object &&
&& (instance as any)[key] instanceof Object) { (instance as any)[key] instanceof Object
// Assigns known translations of subproperties to property in given language (e.g. categories) ) {
Object.keys((instance as any)[key]) // Assigns known translations of subproperties to property in given language (e.g. categories)
.forEach((subKey) => { for (const subKey of Object.keys((instance as any)[key])) {
(instance as any)[key][subKey] = (instance as any)[key][subKey] =
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]]; metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
});
} else if (metaClass.fieldValueTranslations[language][key] instanceof Object
&& typeof (instance as any)[key] === 'string') {
// Assigns known translations of enum to property in given language (e.g. SCSettingInputType)
(instance as any)[key] = metaClass.fieldValueTranslations[language][key][(instance as any)[key]];
} else {
// Assigns property to known translation of fieldValueTranslations in given language
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
} }
}); } else if (
metaClass.fieldValueTranslations[language][key] instanceof Object &&
typeof (instance as any)[key] === 'string'
) {
// Assigns known translations of enum to property in given language (e.g. SCSettingInputType)
(instance as any)[key] = metaClass.fieldValueTranslations[language][key][(instance as any)[key]];
} else {
// Assigns property to known translation of fieldValueTranslations in given language
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
}
}
} }
return instance; return instance;
@@ -200,18 +204,18 @@ export class SCThingTranslator {
let nextInstance = instance as any; let nextInstance = instance as any;
// Recursively call this function on all nested SCThings, arrays and objects // Recursively call this function on all nested SCThings, arrays and objects
Object.keys(nextInstance) for (const key of Object.keys(nextInstance)) {
.forEach((key) => { if (
if ( isThing(nextInstance[key]) ||
isThing(nextInstance[key]) || Array.isArray(nextInstance[key]) ||
nextInstance[key] instanceof Array || nextInstance[key] instanceof Object
nextInstance[key] instanceof Object) { ) {
nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]); nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]);
} }
}); }
// Spread variable translations given by the connector into thing // Spread variable translations given by the connector into thing
if (typeof nextInstance.translations?.[targetLanguage] !== 'undefined') { if (nextInstance.translations?.[targetLanguage] !== undefined) {
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as T; nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as T;
} }
// Spread known translations from meta classes into (partly) translated thing // Spread known translations from meta classes into (partly) translated thing
@@ -224,17 +228,17 @@ export class SCThingTranslator {
* Recursively translates the given object in-place * Recursively translates the given object in-place
* Translated values overwrite current values (destructive) * Translated values overwrite current values (destructive)
* *
* @param instance The thing / object that will be translated * @param thing The thing / object that will be translated
* @returns The thing translated * @returns The thing translated
*/ */
public translate<T extends SCThing>(thing: T): T { public translate<T extends SCThing>(thing: T): T {
if (equal(this.sourceCache.get(thing), thing)) { if (equal(this.sourceCache.get(thing), thing)) {
const cachedInstance = this.cache.get(thing); const cachedInstance = this.cache.get(thing);
if (typeof cachedInstance !== 'undefined') { if (cachedInstance !== undefined) {
return cachedInstance as T; return cachedInstance as T;
} }
} }
const translatedInstance = this.translateThingInPlaceDestructively(clone(thing)); const translatedInstance = this.translateThingInPlaceDestructively(clone()(thing));
delete translatedInstance.translations; delete translatedInstance.translations;
this.cache.putObject(translatedInstance); this.cache.putObject(translatedInstance);
this.sourceCache.putObject(thing); this.sourceCache.putObject(thing);
@@ -244,6 +248,7 @@ export class SCThingTranslator {
/** /**
* Get field value translation recursively * Get field value translation recursively
*
* @example * @example
* const dish: SCDish = {...}; * const dish: SCDish = {...};
* translator.translate(dish).offers[0].inPlace.categories[1]()); * translator.translate(dish).offers[0].inPlace.categories[1]());
@@ -257,21 +262,21 @@ export class SCThingTranslator {
*/ */
public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> { public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> {
return new Proxy( return new Proxy(
((defaultValue?: Defined<T>) => (thing == null ? defaultValue : thing)) as TSOCType<T>, ((defaultValue?: Defined<T>) => (thing == undefined ? defaultValue : thing)) as TSOCType<T>,
{ {
get: (target, key) => { get: (target, key) => {
const obj: any = target(); const object: any = target();
if (equal(this.sourceCache.get(thing), thing)) { if (equal(this.sourceCache.get(thing), thing)) {
const objTranslatedFromCache = this.cache.get(thing); const objectTranslatedFromCache = this.cache.get(thing);
if (typeof objTranslatedFromCache !== 'undefined') { if (objectTranslatedFromCache !== undefined) {
return this.deeptranslate((objTranslatedFromCache as any)[key]); return this.deeptranslate((objectTranslatedFromCache as any)[key]);
} }
} }
const objTranslated = this.translateThingInPlaceDestructively(clone(obj)); const objectTranslated = this.translateThingInPlaceDestructively(clone()(object));
this.cache.putObject(objTranslated); this.cache.putObject(objectTranslated);
this.sourceCache.putObject(thing); this.sourceCache.putObject(thing);
return this.deeptranslate(objTranslated[key]); return this.deeptranslate(objectTranslated[key]);
}, },
}, },
); );
@@ -280,6 +285,7 @@ export class SCThingTranslator {
/** /**
* Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing * 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 * All the values will be set to the known translations of the property/key name
*
* @example * @example
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudy>(SCThingType.CourseOfStudy); * const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudy>(SCThingType.CourseOfStudy);
* @param type The type whose property names will be translated * @param type The type whose property names will be translated
@@ -292,6 +298,7 @@ export class SCThingTranslator {
/** /**
* Given a SCThingType and a corresponding property name it returns the known property value translation * Given a SCThingType and a corresponding property name it returns the known property value translation
* Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional * Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional
*
* @example * @example
* const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish'); * const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish');
* @param type The type for whose property values a translation is required * @param type The type for whose property values a translation is required
@@ -299,11 +306,10 @@ export class SCThingTranslator {
* @param key If specified tries to access the field with this key * @param key If specified tries to access the field with this key
* @returns Known translation for the property * @returns Known translation for the property
*/ */
public translatedPropertyValue(type: SCThingType, public translatedPropertyValue(type: SCThingType, field: string, key?: string): string | undefined {
field: string, const fieldValueTranslations =
key?: string): string | undefined { this.getMetaClassInstance(type).fieldValueTranslations[this.language] ??
const fieldValueTranslations = this.getMetaClassInstance(type).fieldValueTranslations[this.language] ?? this.getMetaClassInstance(type).fieldValueTranslations.en;
this.getMetaClassInstance(type).fieldValueTranslations.en;
const fieldTranslation = fieldValueTranslations?.[field]; const fieldTranslation = fieldValueTranslations?.[field];
return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation; return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation;
@@ -368,7 +374,7 @@ class LRUCache<T> {
} }
const entry = this.entries.get(key); const entry = this.entries.get(key);
if (typeof entry !== 'undefined') { if (entry !== undefined) {
// LRU behavior // LRU behavior
this.entries.delete(key); this.entries.delete(key);
this.entries.set(key, entry); this.entries.set(key, entry);
@@ -386,8 +392,7 @@ class LRUCache<T> {
public put(key: string, content: T) { public put(key: string, content: T) {
if (this.entries.size >= this.maxEntries) { if (this.entries.size >= this.maxEntries) {
// LRU behavior // LRU behavior
const keyToDelete = this.entries.keys() const keyToDelete = this.entries.keys().next().value;
.next().value;
this.entries.delete(keyToDelete); this.entries.delete(keyToDelete);
} }
this.entries.set(key, content); this.entries.set(key, content);
@@ -399,6 +404,6 @@ class LRUCache<T> {
* @param something The object that should be cached under something.uid * @param something The object that should be cached under something.uid
*/ */
public putObject<U extends SCThing>(something: U) { public putObject<U extends SCThing>(something: U) {
this.put(something.uid, (something as any) as T); this.put(something.uid, something as any as T);
} }
} }

View File

@@ -47,7 +47,6 @@ describe('Features', () => {
referenceName: 'SCDiff', referenceName: 'SCDiff',
}); });
// tslint:disable-next-line:no-unused-expression
expect(thingsReflection.type?.specificationTypes?.every(it => typeof it.referenceName !== 'undefined')).to.be.true; expect(thingsReflection.type?.specificationTypes?.every(it => typeof it.referenceName !== 'undefined')).to.be.true;
thingNames = thingsReflection.type?.specificationTypes?.map(type => type.referenceName!) ?? []; thingNames = thingsReflection.type?.specificationTypes?.map(type => type.referenceName!) ?? [];
things = thingNames things = thingNames

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {expect} from 'chai'; import {expect} from 'chai';
import clone = require('fast-clone'); import clone from 'rfdc';
import {slow, suite, test, timeout} from '@testdeck/mocha'; import {slow, suite, test, timeout} from '@testdeck/mocha';
import {SCThingOriginType, SCThingType, SCThingRemoteOrigin} from '../src/things/abstract/thing'; import {SCThingOriginType, SCThingType, SCThingRemoteOrigin} from '../src/things/abstract/thing';
import {SCBuildingWithoutReferences} from '../src/things/building'; import {SCBuildingWithoutReferences} from '../src/things/building';
@@ -112,7 +112,6 @@ const translatorWithFallback = new SCThingTranslator('tt');
const translatedThingDE = translator.translate(dish); const translatedThingDE = translator.translate(dish);
const translatedThingFallback = translatorWithFallback.translate(dish); const translatedThingFallback = translatorWithFallback.translate(dish);
// tslint:disable:max-line-length member-ordering newline-per-chained-call prefer-function-over-method completed-docs TranslationSpecInplace
@suite(timeout(10000), slow(5000)) @suite(timeout(10000), slow(5000))
export class TranslationSpecInplace { export class TranslationSpecInplace {
@test @test
@@ -244,7 +243,6 @@ export class TranslationSpecInplace {
@test @test
public directStringLiteralTypeUndefined() { public directStringLiteralTypeUndefined() {
// tslint:disable-next-line:no-eval
const undefinedThing = eval('(x) => undefined;'); const undefinedThing = eval('(x) => undefined;');
expect(translator.translatedAccess(undefinedThing())('defaultValue')).to.equal('defaultValue'); expect(translator.translatedAccess(undefinedThing())('defaultValue')).to.equal('defaultValue');
expect(translator.translatedAccess(dish).name('defaultValue')).to.not.equal('defaultValue'); expect(translator.translatedAccess(dish).name('defaultValue')).to.not.equal('defaultValue');
@@ -252,9 +250,7 @@ export class TranslationSpecInplace {
@test @test
public nestedMetaArrayOfStringSubscriptUndefined() { public nestedMetaArrayOfStringSubscriptUndefined() {
// tslint:disable-next-line: no-eval
const workingTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1](\'printer\');'); const workingTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1](\'printer\');');
// tslint:disable-next-line: no-eval
const defaultValueTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1234](\'printer\');'); const defaultValueTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1234](\'printer\');');
expect(defaultValueTranslation).to.equal('printer'); expect(defaultValueTranslation).to.equal('printer');
@@ -264,7 +260,7 @@ export class TranslationSpecInplace {
@test @test
public reaccessWithChangedSourceOmitsLRUCache() { public reaccessWithChangedSourceOmitsLRUCache() {
const translatorDE = new SCThingTranslator('de'); const translatorDE = new SCThingTranslator('de');
const dishCopy = clone(dish); const dishCopy = clone()(dish);
const translatedDish = translatorDE.translatedAccess(dish); const translatedDish = translatorDE.translatedAccess(dish);
const distructivelyTranslatedDish = translatorDE.translate(dish); const distructivelyTranslatedDish = translatorDE.translate(dish);
@@ -295,7 +291,6 @@ export class TranslationSpecInplace {
} }
} }
// tslint:disable:member-ordering no-eval no-unused-expression TranslationSpec
@suite(timeout(10000), slow(5000)) @suite(timeout(10000), slow(5000))
export class MetaTranslationSpec { export class MetaTranslationSpec {
@@ -304,8 +299,8 @@ export class MetaTranslationSpec {
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish.type); const dishMetaTranslationsDE = translator.translatedPropertyNames(dish.type);
const dishMetaTranslationsEN = translatorEN.translatedPropertyNames(dish.type); const dishMetaTranslationsEN = translatorEN.translatedPropertyNames(dish.type);
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE); expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de); expect(dishMetaTranslationsDE).to.deep.equal(new SCDishMeta().fieldTranslations.de);
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en); expect(dishMetaTranslationsEN).to.deep.equal(new SCDishMeta().fieldTranslations.en);
} }
@test @test
@@ -313,9 +308,9 @@ export class MetaTranslationSpec {
const dishTypeDE = translator.translatedPropertyValue(dish.type, 'type'); const dishTypeDE = translator.translatedPropertyValue(dish.type, 'type');
const dishTypeEN = translatorEN.translatedPropertyValue(dish.type, 'type', undefined); const dishTypeEN = translatorEN.translatedPropertyValue(dish.type, 'type', undefined);
const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'type'); const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'type');
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.de.type); expect(dishTypeDE).to.deep.equal(new SCDishMeta().fieldValueTranslations.de.type);
expect(dishTypeEN).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type); expect(dishTypeEN).to.deep.equal(new SCDishMeta().fieldValueTranslations.en.type);
expect(dishTypeBASE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type); expect(dishTypeBASE).to.deep.equal(new SCDishMeta().fieldValueTranslations.en.type);
} }
@test @test
@@ -323,14 +318,14 @@ export class MetaTranslationSpec {
const dishTypeDE = translator.translatedPropertyValue(dish.type, 'categories', 'main dish'); const dishTypeDE = translator.translatedPropertyValue(dish.type, 'categories', 'main dish');
const dishTypeEN = translatorEN.translatedPropertyValue(dish.type, 'categories', 'main dish'); const dishTypeEN = translatorEN.translatedPropertyValue(dish.type, 'categories', 'main dish');
const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'categories', 'main dish'); const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'categories', 'main dish');
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance<SCDishMeta>().fieldValueTranslations.de.categories['main dish']); expect(dishTypeDE).to.deep.equal(new SCDishMeta().fieldValueTranslations.de.categories['main dish']);
expect(dishTypeEN).to.deep.equal(dish.categories[0]); expect(dishTypeEN).to.deep.equal(dish.categories[0]);
expect(dishTypeBASE).to.deep.equal(dish.categories[0]); expect(dishTypeBASE).to.deep.equal(dish.categories[0]);
} }
@test @test
public thingWithoutMetaClass() { public thingWithoutMetaClass() {
const dishCopy = clone(dish); const dishCopy = clone()(dish);
const typeNonExistant = eval("(x) => x + 'typeNonExistant';"); const typeNonExistant = eval("(x) => x + 'typeNonExistant';");
// this will assign a non existant SCThingType to dishCopy // this will assign a non existant SCThingType to dishCopy
dishCopy.type = typeNonExistant(); dishCopy.type = typeNonExistant();

View File

@@ -43,9 +43,6 @@ import {SCVideo, SCVideoWithoutReferences} from '../src/things/video';
import {SCPeriodical, SCPeriodicalWithoutReferences} from '../src/things/periodical'; import {SCPeriodical, SCPeriodicalWithoutReferences} from '../src/things/periodical';
import {SCPublicationEvent, SCPublicationEventWithoutReferences} from '../src/things/publication-event'; import {SCPublicationEvent, SCPublicationEventWithoutReferences} from '../src/things/publication-event';
// tslint:disable:no-any
// tslint:disable:completed-docs
/** /**
* Check if E extends T * Check if E extends T
*/ */

View File

@@ -1,7 +0,0 @@
{
"extends": "./node_modules/@openstapps/configuration/tslint.json",
"rules": {
"no-empty-interface": false,
"no-redundant-jsdoc": false
}
}