Compare commits

..

62 Commits

Author SHA1 Message Date
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
Rainer Killinger
6fd8c5adf3 0.64.0 2022-03-21 11:05:25 +01:00
Rainer Killinger
db24b41d99 test: adjust HDS samples to production version 2022-03-21 11:00:11 +01:00
Rainer Killinger
b1fcd22ab2 refactor: update dependencies 2022-03-17 12:44:59 +01:00
Rainer Killinger
268588fb6f docs: update changelog 2022-01-24 14:47:04 +01:00
Rainer Killinger
d3048a12d8 0.63.0 2022-01-24 14:47:02 +01:00
Rainer Killinger
e14993114f fix: add auth object to index route 2022-01-24 14:45:17 +01:00
Rainer Killinger
4237f6ad60 docs: update changelog 2022-01-21 17:15:16 +01:00
Rainer Killinger
e7c1000bc4 0.62.0 2022-01-21 17:15:14 +01:00
Rainer Killinger
e0adb2332e fix: add missing lastPublished to SCCreativeWork 2022-01-21 17:14:16 +01:00
Rainer Killinger
e5696b23e7 docs: update changelog 2022-01-21 15:07:16 +01:00
Rainer Killinger
659d0974f7 0.61.0 2022-01-21 15:07:14 +01:00
Rainer Killinger
e8304eeeb4 refactor: remove unused auth provider properties 2022-01-21 15:06:11 +01:00
Rainer Killinger
dca9d26c66 docs: update changelog 2022-01-21 12:29:55 +01:00
Rainer Killinger
852e0f5373 0.60.0 2022-01-21 12:29:52 +01:00
Rainer Killinger
26dd531d24 refactor: split up SCUserConfiguration type 2022-01-21 12:22:13 +01:00
Rainer Killinger
52bdf93356 docs: update changelog 2022-01-20 14:20:17 +01:00
Rainer Killinger
7509610145 0.59.0 2022-01-20 14:20:15 +01:00
Rainer Killinger
972cdf392d refactor: make config auth provides be optional 2022-01-20 14:18:50 +01:00
Rainer Killinger
4f758f7d0c docs: update changelog 2022-01-18 15:13:06 +01:00
Rainer Killinger
980e899807 0.58.0 2022-01-18 15:13:04 +01:00
Rainer Killinger
d1c5bb9595 refactor: use SCMap for feature configurations 2022-01-18 15:12:05 +01:00
Rainer Killinger
dc9c0f528f docs: update changelog 2022-01-18 11:06:18 +01:00
Rainer Killinger
66d64e0858 0.57.0 2022-01-18 11:06:16 +01:00
Rainer Killinger
06339786c2 refactor: update dependencies 2022-01-18 11:01:01 +01:00
Rainer Killinger
8ed68481fa refactor: rename urlFragment in routes 2022-01-18 09:50:46 +01:00
Rainer Killinger
e26042957c refactor: remodel features in app config 2022-01-18 09:50:44 +01:00
Rainer Killinger
7553620a5d feat: extend config to describe auth providers 2022-01-18 09:50:00 +01:00
Rainer Killinger
322c001e70 docs: update changelog 2021-12-17 10:35:53 +01:00
Rainer Killinger
830e249ac4 0.56.0 2021-12-17 10:35:50 +01:00
Rainer Killinger
8c9df3ea9a test: adjust testing resources 2021-12-17 10:34:03 +01:00
Rainer Killinger
f85768d32e refactor: update dependencies 2021-12-17 10:33:20 +01:00
Rainer Killinger
580ace368f docs: update changelog 2021-12-15 13:15:12 +01:00
Rainer Killinger
522be6643a 0.55.0 2021-12-15 13:15:10 +01:00
Rainer Killinger
8784309ddb refactor: update dependencies 2021-12-15 13:03:57 +01:00
Rainer Killinger
3d8f996690 refactor: make offer price property optional 2021-11-30 12:27:40 +01:00
Rainer Killinger
36a4bfcbbc docs: update changelog 2021-11-17 11:38:00 +01:00
106 changed files with 4926 additions and 3918 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
*.seed
*.pid.lock
.DS_Store
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

View File

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

View File

@@ -1,3 +1,96 @@
# [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)
### Bug Fixes
* add auth object to index route ([e149931](https://gitlab.com/openstapps/core/commit/e14993114f0ec370775010eee4ad0d302a0beebb))
# [0.62.0](https://gitlab.com/openstapps/core/compare/v0.61.0...v0.62.0) (2022-01-21)
### Bug Fixes
* add missing lastPublished to SCCreativeWork ([e0adb23](https://gitlab.com/openstapps/core/commit/e0adb2332ec24ce388c4c008b51b7aa941948532))
# [0.61.0](https://gitlab.com/openstapps/core/compare/v0.60.0...v0.61.0) (2022-01-21)
# [0.60.0](https://gitlab.com/openstapps/core/compare/v0.59.0...v0.60.0) (2022-01-21)
# [0.59.0](https://gitlab.com/openstapps/core/compare/v0.58.0...v0.59.0) (2022-01-20)
# [0.58.0](https://gitlab.com/openstapps/core/compare/v0.57.0...v0.58.0) (2022-01-18)
# [0.57.0](https://gitlab.com/openstapps/core/compare/v0.56.0...v0.57.0) (2022-01-18)
### Features
* extend config to describe auth providers ([7553620](https://gitlab.com/openstapps/core/commit/7553620a5d330ebfb66461afeab700e36bd37165))
# [0.56.0](https://gitlab.com/openstapps/core/compare/v0.55.0...v0.56.0) (2021-12-17)
# [0.55.0](https://gitlab.com/openstapps/core/compare/v0.54.0...v0.55.0) (2021-12-15)
# [0.54.0](https://gitlab.com/openstapps/core/compare/v0.53.0...v0.54.0) (2021-11-17)
### Features
* add SCAssessment ([7a2e0f2](https://gitlab.com/openstapps/core/commit/7a2e0f20d1c64ab1deb7ab30bfb4bab4daaabd6d))
# [0.53.0](https://gitlab.com/openstapps/core/compare/v0.52.0...v0.53.0) (2021-10-19)

4379
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/core",
"version": "0.54.0",
"version": "0.69.0",
"description": "StAppsCore - Generalized model of data",
"keywords": [
"Model",
@@ -14,11 +14,11 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run 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'",
"check-configuration": "openstapps-configuration",
"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",
"postversion": "npm run changelog",
"prepublishOnly": "npm ci && npm run build",
@@ -27,8 +27,8 @@
"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-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'",
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
"test": "nyc mocha --recursive 'test/*.spec.ts'",
"lint": "eslint --ext .ts src/"
},
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"contributors": [
@@ -42,43 +42,51 @@
"Rainer Killinger <mail-openstapps@killinger.co>",
"Roman Klopsch",
"Sebastian Lange",
"Wieland Schöbl"
"Thea Schöbl"
],
"dependencies": {
"@openstapps/core-tools": "0.25.0",
"@openstapps/core-tools": "0.32.0",
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.9",
"@types/node": "14.17.9",
"fast-clone": "1.5.13",
"@types/json-schema": "7.0.11",
"@types/node": "14.18.24",
"fast-deep-equal": "3.1.3",
"http-status-codes": "2.1.4",
"http-status-codes": "2.2.0",
"json-patch": "0.7.0",
"json-schema": "0.3.0",
"json-schema": "0.4.0",
"rfdc": "1.3.0",
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@openstapps/configuration": "0.27.0",
"@openstapps/es-mapping-generator": "0.0.3",
"@openstapps/logger": "0.7.0",
"@testdeck/mocha": "0.1.2",
"@types/lodash": "4.14.172",
"@types/chai": "4.2.21",
"@types/rimraf": "3.0.1",
"@types/mocha": "8.2.3",
"chai": "4.3.4",
"conditional-type-checks": "1.0.5",
"conventional-changelog-cli": "2.1.1",
"@openstapps/configuration": "0.33.0",
"@openstapps/es-mapping-generator": "0.3.0",
"@openstapps/eslint-config": "1.1.0",
"@openstapps/logger": "1.0.0",
"@testdeck/mocha": "0.2.0",
"@types/chai": "4.3.3",
"@types/lodash": "4.14.182",
"@types/mocha": "9.1.1",
"@types/rimraf": "3.0.2",
"@typescript-eslint/eslint-plugin": "5.33.1",
"@typescript-eslint/parser": "5.33.1",
"chai": "4.3.6",
"conditional-type-checks": "1.0.6",
"conventional-changelog-cli": "2.2.2",
"eslint": "8.22.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jsdoc": "39.3.6",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "43.0.2",
"lodash": "4.17.21",
"mocha": "8.4.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"source-map-support": "0.5.19",
"surge": "0.23.0",
"ts-node": "9.1.1",
"tslint": "6.1.3",
"typedoc": "0.21.6",
"typescript": "4.3.5"
"source-map-support": "0.5.21",
"surge": "0.23.1",
"ts-node": "10.9.1",
"typedoc": "0.22.18",
"typescript": "4.4.4"
},
"nyc": {
"all": true,
@@ -100,6 +108,7 @@
"lines": 95,
"per-file": true,
"reporter": [
"cobertura",
"html",
"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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson';
import {SCTranslations} from '../general/i18n';
import {SCMap} from '../general/map';
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
import {SCFeatureConfiguration} from './feature';
/**
* An app configuration menu item
@@ -55,11 +55,7 @@ export interface SCAppConfigurationMenuCategory {
/**
* ID of the menu category
*/
id:
'main'
| 'meta'
| 'personal'
| 'external';
id: 'main' | 'meta' | 'personal' | 'external';
/**
* A list of items that belong to the category
@@ -94,9 +90,9 @@ export interface SCAppConfiguration {
campusPolygon: Polygon;
/**
* A list of features to en- or disable
* Maps of enabled features (plugins and external services)
*/
features: SCAppConfigurationFeature;
features: SCFeatureConfiguration;
/**
* A URL where images are available
@@ -135,16 +131,6 @@ export interface SCAppConfiguration {
url?: string;
}
/**
* Map of features
*/
export interface SCAppConfigurationFeature {
/**
* Whether or not widgets are enabled
*/
widgets: boolean;
}
/**
* URLs of published apps
*/

View File

@@ -0,0 +1,96 @@
/*
* Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCUserConfigurationMap} from './user';
/**
* Supported authorization provider types
*
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1
* @see https://github.com/gbv/paia
*/
export type SCAuthorizationProviderType = 'default' | 'paia';
/**
* An authorization provider complete configuration
*/
export interface SCAuthorizationProvider {
/**
* An authorization provider client configuration
*/
client: SCAuthorizationProviderClient;
/**
* An authorization provider endpoints configuration
*/
endpoints: SCAuthorizationProviderEndpoints;
}
/**
* An authorization provider client configuration
*/
export interface SCAuthorizationProviderClient {
/**
* Client ID
*/
clientId: string;
/**
* Scopes to request
*/
scopes: string;
/**
* Main url to reach authorization provider
*/
url: string;
}
/**
* An authorization provider endpoints configuration
*/
export interface SCAuthorizationProviderEndpoints {
/**
* URL to start authentication flow
*/
authorization: string;
/**
* URL to end current session
*/
endSession?: string;
/**
* Mapping of how to create SCUser from userinfo endpoint response (using JSONPath syntax)
*
* @see https://www.npmjs.com/package/jsonpath
*/
mapping: SCUserConfigurationMap;
/**
* URL to revoke a token
*/
revoke?: string;
/**
* URL to get access Token
*/
token: string;
/**
* URL to general user info endpoint
*/
userinfo: string;
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -95,29 +95,25 @@ export interface SCBackendConfigurationSortableField {
* A list of supported sorts on this field
*/
sortTypes: SCSearchSortType[];
}
/**
* Possible context names to be used by the search request
*/
export type SCSearchContext =
| 'default'
| 'dining'
| 'place';
export type SCSearchContext = 'default' | 'dining' | 'place';
/**
* A boosting configuration for one context
*/
export type SCBackendConfigurationSearchBoostingContext =
SCRestrictedMap<SCSearchContext,
SCBackendConfigurationSearchBoostingType[]>;
export type SCBackendConfigurationSearchBoostingContext = SCRestrictedMap<
SCSearchContext,
SCBackendConfigurationSearchBoostingType[]
>;
/**
* A boosting configuration for one SCType
*/
export interface SCBackendConfigurationSearchBoostingType {
/**
* The factor of which the scores matching this type should be multiplied by
*/

48
src/config/feature.ts Normal file
View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2022 Open StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMap} from '../general/map';
import {SCAuthorizationProviderType} from './authorization';
export interface SCFeatureConfiguration {
/**
* Map of extern services mapped by their name (statically)
*/
extern?: SCMap<SCFeatureConfigurationExtern>;
/**
* Map of plugins registered with the backend mapped by their name.
*/
plugins?: SCMap<SCFeatureConfigurationPlugin>;
}
export interface SCFeatureConfigurationPlugin {
/**
* URL path registered with the backend
*/
urlPath: string;
}
export interface SCFeatureConfigurationExtern {
/**
* Key of authorization provider available in SCConfigFile
*/
authProvider?: SCAuthorizationProviderType;
/**
* URL of extern service
*/
url: string;
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,19 +14,25 @@
*/
import {SCLicensePlate} from '../general/namespaces';
import {SCAppConfiguration} from './app';
import {SCAuthorizationProvider, SCAuthorizationProviderType} from './authorization';
import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend';
/**
* A configuration file that configures app and backend
*
* @validatable
*/
export interface SCConfigFile {
/**
* Configuration for the app that is visible to clients
*/
app: SCAppConfiguration;
/**
* Configuration for the supported authorization providers
*/
auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider};
/**
* Configuration for the backend that is visible to clients
*/

66
src/config/user.ts Normal file
View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2021-2022 Open StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* User configuration keys mapped to string type while including their requiredness
*/
export type SCUserConfigurationMap = {[K in keyof SCUserConfigurationOptional]?: string} & {
[K in keyof SCUserConfigurationRequired]: string;
};
/**
* A user configuration
*/
export type SCUserConfiguration = SCUserConfigurationRequired & SCUserConfigurationOptional;
/**
* A user configurations required properties
*/
interface SCUserConfigurationRequired {
/**
* ID given to the user
*/
id: string;
/**
* The complete name of the user combining all the parts of the name into one
*/
name: string;
}
/**
* A user configurations optional properties
*/
interface SCUserConfigurationOptional {
/**
* User's e-mail
*/
email?: string;
/**
* User's family name
*/
familyName?: string;
/**
* User's given name
*/
givenName?: string;
/**
* Role assigned to the user
*/
role?: string;
/**
* Student ID given to the user
*/
studentId?: string;
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -37,7 +37,7 @@ export interface SCLanguage {
* @see https://en.wikipedia.org/wiki/ISO_639-1
*/
export type SCLanguageName =
'afar'
| 'afar'
| 'abkhazian'
| 'avestan'
| 'afrikaans'
@@ -229,7 +229,7 @@ export type SCLanguageName =
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export type SCLanguageCode =
'aa'
| 'aa'
| 'ab'
| 'ae'
| 'af'
@@ -421,7 +421,7 @@ export type SCLanguageCode =
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*/
export type SCNationality =
'Afghanistan'
| 'Afghanistan'
| 'Åland Islands'
| 'Albania'
| 'Algeria'
@@ -475,7 +475,7 @@ export type SCNationality =
| 'Congo (Democratic Republic of the)'
| 'Cook Islands'
| 'Costa Rica'
| 'Côte d\'Ivoire'
| "Côte d'Ivoire"
| 'Croatia'
| 'Cuba'
| 'Curaçao'
@@ -538,11 +538,11 @@ export type SCNationality =
| 'Kazakhstan'
| 'Kenya'
| 'Kiribati'
| 'Korea (Democratic People\'s Republic of)'
| "Korea (Democratic People's Republic of)"
| 'Korea (Republic of)'
| 'Kuwait'
| 'Kyrgyzstan'
| 'Lao People\'s Democratic Republic'
| "Lao People's Democratic Republic"
| 'Latvia'
| 'Lebanon'
| 'Lesotho'
@@ -694,10 +694,11 @@ export interface SCTranslations<T> {
* (Source: https://stackoverflow.com/a/51365037)
*/
type RecursivePartial<T> = {
[P in keyof T]-?:
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
T[P] extends object ? RecursivePartial<T[P]> :
T[P];
[P in keyof T]-?: T[P] extends Array<infer U>
? Array<RecursivePartial<U>>
: T[P] extends object
? 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -42,5 +42,5 @@ export type SCRestrictedMap<U extends string | number, T> = {
/**
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,19 +12,15 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* tslint:disable:max-line-length */
/**
* An ISO8601 date
*
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
* @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
*
* @date
*/
export type SCISO8601Date = string;
/* tslint:enable */
/* tslint:disable:max-line-length */
/**
* An ISO8601 duration
*
@@ -32,11 +28,10 @@ export type SCISO8601Date = string;
* @see https://gist.github.com/philipashlock/8830168
*/
export type SCISO8601Duration = string;
/* tslint:enable */
/**
* An ISO8601 time
*
* @pattern \d{2}:\d{2}(:\d{2})?
* @pattern ^(2[0-3]|[01][0-9]):?([0-5][0-9]):?([0-5][0-9])$
*/
export type SCISO8601Time = string;

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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -16,7 +16,12 @@ import {SCTranslations} from './general/i18n';
import {SCBulkResponse} from './protocol/routes/bulk-request';
import {SCSearchResponse} from './protocol/routes/search';
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
@@ -32,16 +37,13 @@ export function isThing(something: unknown): something is SCThing {
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') {
return false;
}
return Object
.values(SCThingType)
.indexOf(type as SCThingType) >= 0;
return Object.values(SCThingType).includes(type as SCThingType);
}
/**
@@ -49,9 +51,9 @@ export function isThing(something: unknown): something is SCThing {
*
* @param thing Thing to check
*/
export function isThingWithTranslations(thing: SCThingWithoutReferences)
// tslint:disable-next-line:completed-docs
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
export function isThingWithTranslations(
thing: SCThingWithoutReferences,
): thing is SCThingWithoutReferences & {translations: SCTranslations<SCThingTranslatableProperties>} {
return typeof thing.translations !== 'undefined';
}
@@ -65,29 +67,31 @@ export function isBulkResponse(something: unknown): something is SCBulkResponse
return false;
}
if (!('expiration' in something)
|| !('source' in something)
|| !('state' in something)
|| !('type' in something)
|| !('uid' in something)) {
if (
!('expiration' in something) ||
!('source' in something) ||
!('state' in something) ||
!('type' in something) ||
!('uid' in something)
) {
return false;
}
const {expiration, source, state, type, uid} = something as {
// tslint:disable:completed-docs
expiration: unknown;
source: unknown;
state: unknown;
type: unknown;
uid: unknown;
// tslint:enable
};
return typeof expiration === 'string'
&& typeof source === 'string'
&& typeof state === 'string'
&& typeof type === 'string'
&& typeof uid === 'string';
return (
typeof expiration === 'string' &&
typeof source === 'string' &&
typeof state === '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) {
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)
&& Array.isArray(somethingObject.facets)
&& typeof somethingObject.pagination !== 'undefined'
&& typeof somethingObject.pagination.count === 'number'
&& typeof somethingObject.pagination.offset === 'number'
&& typeof somethingObject.pagination.total === 'number'
&& typeof somethingObject.stats !== 'undefined'
&& typeof somethingObject.stats.time === 'number';
return (
Array.isArray(somethingObject.data) &&
Array.isArray(somethingObject.facets) &&
typeof somethingObject.pagination !== 'undefined' &&
typeof somethingObject.pagination.count === 'number' &&
typeof somethingObject.pagination.offset === 'number' &&
typeof somethingObject.pagination.total === 'number' &&
typeof somethingObject.stats !== 'undefined' &&
typeof somethingObject.stats.time === 'number'
);
}
/**
@@ -117,10 +123,10 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
* @param something Something to check
*/
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; })
.reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
}, initialValue as boolean);
// eslint-disable-next-line unicorn/no-array-reduce
return Object.keys(something as {[key: string]: string}).reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse((something as {[key: string]: string})[key]);
}, 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,14 +13,22 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
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 {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment';
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
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 {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
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 {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical';
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 {
SCPublicationEvent,
SCPublicationEventMeta,
@@ -46,12 +58,10 @@ import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
/* tslint:disable:variable-name */
/**
* A map of things, from type to meta data
*/
export const SCClasses: { [K in SCThingType]: object } = {
/* tslint:enable */
export const SCClasses: {[K in SCThingType]: object} = {
'assessment': SCAssessmentMeta,
'academic event': SCAcademicEventMeta,
'article': SCArticleMeta,
@@ -83,7 +93,7 @@ export const SCClasses: { [K in SCThingType]: object } = {
};
export type SCIndexableThings =
SCAssessment
| SCAssessment
| SCAcademicEvent
| SCArticle
| SCBook
@@ -112,9 +122,7 @@ export type SCIndexableThings =
/**
* An object that exists in the StAppsCore
*/
export type SCThings =
SCIndexableThings
| SCDiff | SCFavorite | SCSetting;
export type SCThings = SCIndexableThings | SCDiff | SCFavorite | SCSetting;
/**
* A field of a thing
@@ -124,67 +132,121 @@ export type SCThingsField = keyof SCThings | string;
/**
* Thing without references for a thing
*/
export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
THING extends SCAssessment ? SCAssessmentWithoutReferences :
THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences :
THING extends SCArticle ? SCArticleWithoutReferences :
THING extends SCBook ? SCBookWithoutReferences :
THING extends SCBuilding ? SCBuildingWithoutReferences :
THING extends SCCatalog ? SCCatalogWithoutReferences :
THING extends SCContactPoint ? SCContactPointWithoutReferences :
THING extends SCCourseOfStudy ? SCCourseOfStudyWithoutReferences :
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
THING extends SCDiff ? SCDiffWithoutReferences :
THING extends SCDish ? SCDishWithoutReferences :
THING extends SCFavorite ? SCFavoriteWithoutReferences :
THING extends SCFloor ? SCFloorWithoutReferences :
THING extends SCMessage ? SCMessageWithoutReferences :
THING extends SCOrganization ? 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;
export type SCAssociatedThingWithoutReferences<THING extends SCThings> = THING extends SCAssessment
? SCAssessmentWithoutReferences
: THING extends SCAcademicEvent
? SCAcademicEventWithoutReferences
: THING extends SCArticle
? SCArticleWithoutReferences
: THING extends SCBook
? SCBookWithoutReferences
: THING extends SCBuilding
? SCBuildingWithoutReferences
: THING extends SCCatalog
? SCCatalogWithoutReferences
: THING extends SCContactPoint
? SCContactPointWithoutReferences
: THING extends SCCourseOfStudy
? SCCourseOfStudyWithoutReferences
: THING extends SCDateSeries
? SCDateSeriesWithoutReferences
: THING extends SCDiff
? SCDiffWithoutReferences
: THING extends SCDish
? SCDishWithoutReferences
: THING extends SCFavorite
? SCFavoriteWithoutReferences
: THING extends SCFloor
? SCFloorWithoutReferences
: THING extends SCMessage
? SCMessageWithoutReferences
: THING extends SCOrganization
? 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
*/
export type SCAssociatedThing<THING extends SCThings> =
THING extends SCAssessmentWithoutReferences ? SCAssessment :
THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent :
THING extends SCArticleWithoutReferences ? SCArticle :
THING extends SCBookWithoutReferences ? SCBook :
THING extends SCBuildingWithoutReferences ? SCBuilding :
THING extends SCCatalogWithoutReferences ? SCCatalog :
THING extends SCContactPointWithoutReferences ? SCContactPoint :
THING extends SCCourseOfStudyWithoutReferences ? SCCourseOfStudy :
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
THING extends SCDiffWithoutReferences ? SCDiff :
THING extends SCDishWithoutReferences ? SCDish :
THING extends SCFavoriteWithoutReferences ? SCFavorite :
THING extends SCFloorWithoutReferences ? SCFloor :
THING extends SCMessageWithoutReferences ? SCMessage :
THING extends SCOrganizationWithoutReferences ? 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;
export type SCAssociatedThing<THING extends SCThings> = THING extends SCAssessmentWithoutReferences
? SCAssessment
: THING extends SCAcademicEventWithoutReferences
? SCAcademicEvent
: THING extends SCArticleWithoutReferences
? SCArticle
: THING extends SCBookWithoutReferences
? SCBook
: THING extends SCBuildingWithoutReferences
? SCBuilding
: THING extends SCCatalogWithoutReferences
? SCCatalog
: THING extends SCContactPointWithoutReferences
? SCContactPoint
: THING extends SCCourseOfStudyWithoutReferences
? SCCourseOfStudy
: THING extends SCDateSeriesWithoutReferences
? SCDateSeries
: THING extends SCDiffWithoutReferences
? SCDiff
: THING extends SCDishWithoutReferences
? SCDish
: THING extends SCFavoriteWithoutReferences
? SCFavorite
: THING extends SCFloorWithoutReferences
? SCFloor
: THING extends SCMessageWithoutReferences
? SCMessage
: THING extends SCOrganizationWithoutReferences
? 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
* under the terms of the GNU General Public License as published by the Free
* 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) {
// generate stacktrace if needed
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -29,15 +29,15 @@ export class SCInternalServerErrorResponse extends SCError {
/**
* 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
* 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);
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
* under the terms of the GNU General Public License as published by the Free
* 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
*/
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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -40,8 +40,8 @@ export enum SCRouteHttpVerbs {
/**
* The constructor of an error response
*/
// tslint:disable-next-line:no-any
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type SCErrorResponseConstructor = new (...arguments_: any[]) => SCErrorResponse;
/**
* A description of a route
@@ -78,9 +78,9 @@ export interface SCRoute {
statusCodeSuccess: number;
/**
* URL fragment of the route
* URL path of the route
*/
urlFragment: string;
urlPath: string;
}
/**
@@ -91,37 +91,43 @@ export abstract class SCAbstractRoute implements SCRoute {
* @see SCRoute.errorNames
*/
errorNames: SCErrorResponseConstructor[] = [];
/**
* @see SCRoute.method
*/
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
/**
* @see SCRoute.obligatoryParameters
*/
obligatoryParameters?: SCMap<string>;
/**
* @see SCRoute.requestBodyName
*/
requestBodyName = 'any';
/**
* @see SCRoute.responseBodyName
*/
responseBodyName = 'any';
/**
* @see SCRoute.statusCodeSuccess
*/
statusCodeSuccess = 200;
/**
* @see SCRoute.urlFragment
*/
urlFragment = '/';
/**
* Get "compiled" URL fragment
*
* @param parameters Parameters to compile URL fragment with
* @see SCRoute.urlPath
*/
public getUrlFragment(parameters: SCMap<string> = {}): string {
urlPath = '/';
/**
* Get "compiled" URL path
*
* @param parameters Parameters to compile URL path with
*/
public getUrlPath(parameters: SCMap<string> = {}): string {
let obligatoryParameters: string[] = [];
if (typeof this.obligatoryParameters === 'object') {
@@ -132,17 +138,17 @@ export abstract class SCAbstractRoute implements SCRoute {
throw new Error('Extraneous parameters provided.');
}
return this.urlFragment
return this.urlPath
.split('/')
.map((part) => {
.map(part => {
if (part.indexOf(':') !== 0) {
return part;
}
const parameter = part.substr(1);
const parameter = part.slice(1);
if (typeof parameters[parameter] === 'undefined') {
throw new Error(`Parameter '${parameter}' not provided.`);
throw new TypeError(`Parameter '${parameter}' not provided.`);
}
return parameters[parameter];
@@ -155,7 +161,7 @@ export abstract class SCAbstractRoute implements SCRoute {
* Possible requests
*/
export type SCRequests =
SCBookAvailabilityRequest
| SCBookAvailabilityRequest
| SCBulkRequest
| SCBulkAddRequest
| SCBulkDoneRequest
@@ -169,7 +175,7 @@ export type SCRequests =
* Possible responses
*/
export type SCResponses =
SCBookAvailabilityResponse
| SCBookAvailabilityResponse
| SCBulkResponse
| SCBulkAddResponse
| SCBulkDoneResponse
@@ -182,59 +188,91 @@ export type SCResponses =
/**
* Associated response for a request
*/
export type SCAssociatedResponse<REQUEST> =
REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse :
REQUEST extends SCBulkRequest ? SCBulkResponse :
REQUEST extends SCBulkAddRequest ? SCBulkAddResponse :
REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse :
REQUEST extends SCFeedbackRequest ? SCFeedbackResponse :
REQUEST extends SCIndexRequest ? SCIndexResponse :
REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse :
REQUEST extends SCSearchRequest ? SCSearchResponse :
REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse :
never;
export type SCAssociatedResponse<REQUEST> = REQUEST extends SCBookAvailabilityRequest
? SCBookAvailabilityResponse
: REQUEST extends SCBulkRequest
? SCBulkResponse
: REQUEST extends SCBulkAddRequest
? SCBulkAddResponse
: REQUEST extends SCBulkDoneRequest
? SCBulkDoneResponse
: REQUEST extends SCFeedbackRequest
? SCFeedbackResponse
: REQUEST extends SCIndexRequest
? SCIndexResponse
: REQUEST extends SCMultiSearchRequest
? SCMultiSearchResponse
: REQUEST extends SCSearchRequest
? SCSearchResponse
: REQUEST extends SCThingUpdateRequest
? SCThingUpdateResponse
: never;
/**
* Associated request for a response
*/
export type SCAssociatedRequest<RESPONSE> =
RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest :
RESPONSE extends SCBulkResponse ? SCBulkRequest :
RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest :
RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest :
RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest :
RESPONSE extends SCIndexResponse ? SCIndexRequest :
RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest :
RESPONSE extends SCSearchResponse ? SCSearchRequest :
RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest :
never;
export type SCAssociatedRequest<RESPONSE> = RESPONSE extends SCBookAvailabilityResponse
? SCBookAvailabilityRequest
: RESPONSE extends SCBulkResponse
? SCBulkRequest
: RESPONSE extends SCBulkAddResponse
? SCBulkAddRequest
: RESPONSE extends SCBulkDoneResponse
? SCBulkDoneRequest
: RESPONSE extends SCFeedbackResponse
? SCFeedbackRequest
: RESPONSE extends SCIndexResponse
? SCIndexRequest
: RESPONSE extends SCMultiSearchResponse
? SCMultiSearchRequest
: RESPONSE extends SCSearchResponse
? SCSearchRequest
: RESPONSE extends SCThingUpdateResponse
? SCThingUpdateRequest
: never;
/**
* Associated request for a route
*/
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> =
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityRequest :
ROUTE extends SCBulkRoute ? SCBulkRequest :
ROUTE extends SCBulkAddRoute ? SCBulkAddRequest :
ROUTE extends SCBulkDoneRoute ? SCBulkDoneRequest :
ROUTE extends SCFeedbackRoute ? SCFeedbackRequest :
ROUTE extends SCIndexRoute ? SCIndexRequest :
ROUTE extends SCMultiSearchRoute ? SCMultiSearchRequest :
ROUTE extends SCSearchRoute ? SCSearchRequest :
ROUTE extends SCThingUpdateRoute ? SCThingUpdateRequest :
never;
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> = ROUTE extends SCBookAvailabilityRoute
? SCBookAvailabilityRequest
: ROUTE extends SCBulkRoute
? SCBulkRequest
: ROUTE extends SCBulkAddRoute
? SCBulkAddRequest
: ROUTE extends SCBulkDoneRoute
? SCBulkDoneRequest
: ROUTE extends SCFeedbackRoute
? SCFeedbackRequest
: ROUTE extends SCIndexRoute
? SCIndexRequest
: ROUTE extends SCMultiSearchRoute
? SCMultiSearchRequest
: ROUTE extends SCSearchRoute
? SCSearchRequest
: ROUTE extends SCThingUpdateRoute
? SCThingUpdateRequest
: never;
/**
* Associated response for a route
*/
export type SCAssignedResponse<ROUTE extends SCAbstractRoute> =
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityResponse :
ROUTE extends SCBulkRoute ? SCBulkResponse :
ROUTE extends SCBulkAddRoute ? SCBulkAddResponse :
ROUTE extends SCBulkDoneRoute ? SCBulkDoneResponse :
ROUTE extends SCFeedbackRoute ? SCFeedbackResponse :
ROUTE extends SCIndexRoute ? SCIndexResponse :
ROUTE extends SCMultiSearchRoute ? SCMultiSearchResponse :
ROUTE extends SCSearchRoute ? SCSearchResponse :
ROUTE extends SCThingUpdateRoute ? SCThingUpdateResponse :
never;
export type SCAssignedResponse<ROUTE extends SCAbstractRoute> = ROUTE extends SCBookAvailabilityRoute
? SCBookAvailabilityResponse
: ROUTE extends SCBulkRoute
? SCBulkResponse
: ROUTE extends SCBulkAddRoute
? SCBulkAddResponse
: ROUTE extends SCBulkDoneRoute
? SCBulkDoneResponse
: ROUTE extends SCFeedbackRoute
? SCFeedbackResponse
: 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,7 +14,10 @@
*/
import {StatusCodes} from 'http-status-codes';
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 {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
@@ -89,6 +92,6 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
this.requestBodyName = 'SCBookAvailabilityRequest';
this.responseBodyName = 'SCBookAvailabilityResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/bookAvailability';
this.urlPath = '/bookAvailability';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -35,8 +35,7 @@ export type SCBulkAddRequest = SCThings;
*
* @validatable
*/
export interface SCBulkAddResponse {
}
export interface SCBulkAddResponse {}
/**
* Route for indexing SC things in a bulk
@@ -60,6 +59,6 @@ export class SCBulkAddRoute extends SCAbstractRoute {
this.requestBodyName = 'SCBulkAddRequest';
this.responseBodyName = 'SCBulkAddResponse';
this.statusCodeSuccess = StatusCodes.CREATED;
this.urlFragment = '/bulk/:UID';
this.urlPath = '/bulk/:UID';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -27,16 +27,14 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
*
* @validatable
*/
export interface SCBulkDoneRequest {
}
export interface SCBulkDoneRequest {}
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {
}
export interface SCBulkDoneResponse {}
/**
* Route for closing bulks
@@ -60,6 +58,6 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
this.requestBodyName = 'SCBulkDoneRequest';
this.responseBodyName = 'SCBulkDoneResponse';
this.statusCodeSuccess = StatusCodes.NO_CONTENT;
this.urlFragment = '/bulk/:UID/done';
this.urlPath = '/bulk/:UID/done';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -31,8 +31,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
*
* @validatable
*/
export interface SCBulkRequest extends SCBulkParameters {
}
export type SCBulkRequest = SCBulkParameters;
/**
* Parameters for a bulk
@@ -99,6 +98,6 @@ export class SCBulkRoute extends SCAbstractRoute {
this.requestBodyName = 'SCBulkRequest';
this.responseBodyName = 'SCBulkResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/bulk';
this.urlPath = '/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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -39,8 +39,7 @@ export interface SCFeedbackRequest extends SCMessage {
*
* @validatable
*/
export interface SCFeedbackResponse {
}
export interface SCFeedbackResponse {}
/**
* Route for feedback submission
@@ -60,7 +59,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
this.requestBodyName = 'SCFeedbackRequest';
this.responseBodyName = 'SCFeedbackResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/feedback';
this.urlPath = '/feedback';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,6 +14,7 @@
*/
import {StatusCodes} from 'http-status-codes';
import {SCAppConfiguration} from '../../config/app';
import {SCAuthorizationProvider, SCAuthorizationProviderType} from '../../config/authorization';
import {SCBackendConfiguration} from '../../config/backend';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
@@ -28,8 +29,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
*
* @validatable
*/
export interface SCIndexRequest {
}
export interface SCIndexRequest {}
/**
* A response to an index request
@@ -42,6 +42,11 @@ export interface SCIndexResponse {
*/
app: SCAppConfiguration;
/**
* @see SCAuthorizationProvider
*/
auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider};
/**
* @see SCBackendConfiguration
*/
@@ -66,6 +71,6 @@ export class SCIndexRoute extends SCAbstractRoute {
this.requestBodyName = 'SCIndexRequest';
this.responseBodyName = 'SCIndexResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/';
this.urlPath = '/';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -123,6 +123,6 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
this.requestBodyName = 'SCPluginRegisterRequest';
this.responseBodyName = 'SCPluginRegisterResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/plugin/register';
this.urlPath = '/plugin/register';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -64,6 +64,6 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
this.requestBodyName = 'SCMultiSearchRequest';
this.responseBodyName = 'SCMultiSearchResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/search/multi';
this.urlPath = '/search/multi';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -28,16 +28,14 @@ import {SCSearchResult} from '../search/result';
*
* @validatable
*/
export interface SCSearchRequest extends SCSearchQuery {
}
export type SCSearchRequest = SCSearchQuery;
/**
* A search response
*
* @validatable
*/
export interface SCSearchResponse extends SCSearchResult {
}
export type SCSearchResponse = SCSearchResult;
/**
* Route for searching things
@@ -57,6 +55,6 @@ export class SCSearchRoute extends SCAbstractRoute {
this.requestBodyName = 'SCSearchRequest';
this.responseBodyName = 'SCSearchResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/search';
this.urlPath = '/search';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -35,8 +35,7 @@ export type SCThingUpdateRequest = SCThings;
*
* @validatable
*/
export interface SCThingUpdateResponse {
}
export interface SCThingUpdateResponse {}
/**
* Route for updating existing things
@@ -61,6 +60,6 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
this.requestBodyName = 'SCThingUpdateRequest';
this.responseBodyName = 'SCThingUpdateResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/:TYPE/:UID';
this.urlPath = '/:TYPE/:UID';
}
}

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -27,7 +27,7 @@ import {SCSearchValueFilter} from './filters/value';
* Filter instruction types
*/
export type SCSearchFilterType =
'availability'
| 'availability'
| 'boolean'
| 'distance'
| 'value'
@@ -59,7 +59,7 @@ export type SCSearchAbstractFilterArguments = SCMap<unknown>;
* Available filter instructions
*/
export type SCSearchFilter =
SCSearchAvailabilityFilter
| SCSearchAvailabilityFilter
| SCSearchBooleanFilter
| SCSearchDistanceFilter
| 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCThingsField} from '../../../meta';
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson';
import {Polygon, Position} from 'geojson';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
@@ -29,6 +28,24 @@ export interface SCGeoFilter extends SCSearchAbstractFilter<SCGeoFilterArguments
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
*/
@@ -41,7 +58,7 @@ export interface SCGeoFilterArguments extends SCSearchAbstractFilterArguments {
/**
* Geo data to check up on
*/
shape: Polygon;
shape: Polygon | Envelope;
/**
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -47,6 +47,7 @@ export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter<SCNum
* Additional arguments for date range filters
*
* 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
*/
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
* under the terms of the GNU General Public License as published by the Free
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* An academic degree without references
*/
export interface SCAcademicDegreeWithoutReferences
extends SCThingWithoutReferences {
export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences {
/**
* The achievable academic degree
*
@@ -46,28 +45,26 @@ export interface SCAcademicDegreeWithoutReferences
/**
* An academic degree
*/
export interface SCAcademicDegree
extends SCAcademicDegreeWithoutReferences, SCThing {
export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences, SCThing {
// noop
}
/**
* Meta information about academic degrees
*/
export class SCAcademicDegreeMeta
extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
academicDegree: 'Abschlussgrad',
academicDegreewithField: 'Abschlussbezeichnung',
academicDegreewithFieldShort: 'Abschlussbezeichnung (kurz)',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
academicDegree: 'academic degree',
academicDegreewithField: 'acedemic degree and discipline',
academicDegreewithFieldShort: 'acedemic degree and discipline (short)',
@@ -79,10 +76,10 @@ export class SCAcademicDegreeMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -19,8 +19,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* An academic term without references
*/
export interface SCAcademicTermWithoutReferences
extends SCThingWithoutReferences {
export interface SCAcademicTermWithoutReferences extends SCThingWithoutReferences {
/**
* Short name of the academic term, using the given pattern
*
@@ -62,22 +61,20 @@ export interface SCAcademicTermWithoutReferences
/**
* An academic term
*/
export interface SCAcademicTerm
extends SCAcademicTermWithoutReferences, SCThing {
export interface SCAcademicTerm extends SCAcademicTermWithoutReferences, SCThing {
// noop
}
/**
* Meta information about academic terms
*/
export class SCAcademicTermWithoutReferencesMeta
extends SCThingMeta implements SCMetaTranslations<SCThing> {
export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCThing> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
acronym: 'Akronym',
endDate: 'Enddatum',
eventsEndDate: 'Enddatum der Veranstaltungen',
@@ -85,7 +82,7 @@ export class SCAcademicTermWithoutReferencesMeta
startDate: 'Startdatum',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
acronym: 'acronym',
endDate: 'end date',
eventsEndDate: 'end date of events',
@@ -99,10 +96,10 @@ export class SCAcademicTermWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -17,20 +17,12 @@ import {SCISO8601Date} from '../../general/time';
import {SCOrganizationWithoutReferences} from '../organization';
import {SCPersonWithoutReferences} from '../person';
import {SCPublicationEventWithoutReferences} from '../publication-event';
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './thing-that-can-be-offered';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
/**
* A creative work without references
*/
export interface SCCreativeWorkWithoutReferences
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReferences {
/**
* Languages this creative work is available in
*/
@@ -71,6 +63,13 @@ export interface SCCreativeWorkWithoutReferences
*/
keywords?: string[];
/**
* Date (in text form) the creative work was most recently
*
* @keyword
*/
lastPublished?: string;
/**
* Translated fields of the creative work
*/
@@ -80,8 +79,7 @@ export interface SCCreativeWorkWithoutReferences
/**
* A creative work
*/
export interface SCCreativeWork
extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThing {
/**
* Authors of the creative work
*/
@@ -116,8 +114,7 @@ export interface SCCreativeWork
/**
* Translatable properties of creative works
*/
export interface SCCreativeWorkTranslatableProperties
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
export interface SCCreativeWorkTranslatableProperties extends SCThingTranslatableProperties {
/**
* Translation of the keywords of the creative work
*
@@ -129,15 +126,13 @@ export interface SCCreativeWorkTranslatableProperties
/**
* Meta information about creative works
*/
export class SCCreativeWorkMeta
extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
name: 'Titel',
authors: 'beteiligte Personen',
availableLanguages: 'verfügbare Übersetzungen',
@@ -153,8 +148,7 @@ export class SCCreativeWorkMeta
sourceOrganization: 'Körperschaft',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
name: 'title',
authors: 'involved persons',
availableLanguages: 'available languages',
@@ -176,12 +170,10 @@ export class SCCreativeWorkMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -22,8 +22,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* An event without references
*/
export interface SCEventWithoutReferences
extends SCThingWithoutReferences {
export interface SCEventWithoutReferences extends SCThingWithoutReferences {
/**
* Maximum number of participants of the event
*
@@ -46,8 +45,7 @@ export interface SCEventWithoutReferences
/**
* An event
*/
export interface SCEvent
extends SCEventWithoutReferences, SCThing {
export interface SCEvent extends SCEventWithoutReferences, SCThing {
/**
* Academic terms that an event belongs to, e.g. semester(s).
*/
@@ -79,14 +77,13 @@ export interface SCEvent
/**
* Meta information about events
*/
export class SCEventMeta
extends SCThingMeta implements SCMetaTranslations<SCEvent> {
export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEvent> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
academicTerms: 'Semester',
catalogs: 'Verzeichnis',
creativeWorks: 'begleitende Werke',
@@ -96,7 +93,7 @@ export class SCEventMeta
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
academicTerms: 'academic terms',
catalogs: 'catalogs',
creativeWorks: 'related material',
@@ -112,10 +109,10 @@ export class SCEventMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Point, Polygon} from 'geojson';
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCBuildingWithoutReferences} from '../building';
@@ -84,8 +83,7 @@ export interface SCPostalAddress {
/**
* A place without references
*/
export interface SCPlaceWithoutReferences
extends SCThingWithoutReferences {
export interface SCPlaceWithoutReferences extends SCThingWithoutReferences {
/**
* Address of the place
*/
@@ -116,8 +114,7 @@ export interface SCPlaceWithoutReferences
/**
* A place
*/
export interface SCPlace
extends SCPlaceWithoutReferences, SCThing {
export interface SCPlace extends SCPlaceWithoutReferences, SCThing {
/**
* Translated fields of a place
*/
@@ -127,8 +124,7 @@ export interface SCPlace
/**
* Translatable properties of a place without references
*/
export interface SCPlaceWithoutReferencesTranslatableProperties
extends SCThingTranslatableProperties {
export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties {
/**
* Address of a place
*/
@@ -139,19 +135,21 @@ export interface SCPlaceWithoutReferencesTranslatableProperties
* Meta information about creative works
*/
export class SCPlaceWithoutReferencesMeta
extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> {
extends SCThingMeta
implements SCMetaTranslations<SCPlaceWithoutReferences>
{
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
address: 'Adresse',
geo: 'Geoinformation',
openingHours: 'Öffnungszeiten',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
address: 'address',
geo: 'geographic information',
openingHours: 'opening hours',
@@ -163,10 +161,10 @@ export class SCPlaceWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...new SCThingMeta().fieldValueTranslations.en,
},
};
}
@@ -181,8 +179,5 @@ export interface SCInPlace {
/**
* Place the thing is or happens in
*/
inPlace?:
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
inPlace?: 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -24,41 +24,43 @@ export type SCISO8601DateRange = SCRange<SCISO8601Date>;
/**
* Generic range type
*/
export type SCRange<T> = {
/**
* Greater than value
*/
gt?: never;
export type SCRange<T> =
| {
/**
* Greater than value
*/
gt?: never;
/**
* Greater or equal to value
*/
gte?: T;
/**
* Greater or equal to value
*/
gte?: T;
/**
* Greater than value
*/
lt?: never;
/**
* Greater than value
*/
lt?: never;
/**
* Greater or equal to value
*/
lte?: T;
} | {
// tslint:disable:completed-docs
gt?: T;
gte?: never;
lt?: T;
lte?: never;
} | {
gt?: T;
gte?: never;
lt?: never;
lte?: T;
} | {
gt?: never;
gte?: T;
lt?: T;
lte?: never;
// tslint:enable:completed-docs
};
/**
* Greater or equal to value
*/
lte?: T;
}
| {
gt?: T;
gte?: never;
lt?: T;
lte?: never;
}
| {
gt?: T;
gte?: never;
lt?: never;
lte?: T;
}
| {
gt?: never;
gte?: T;
lt?: T;
lte?: never;
};

View File

@@ -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
* under the terms of the GNU General Public License as published by the Free
* 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.
*/
export interface SCSaveableThingWithoutReferences
extends SCThingWithoutReferences {
}
export type SCSaveableThingWithoutReferences = SCThingWithoutReferences;
/**
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
*/
export interface SCSaveableThing
extends SCSaveableThingWithoutReferences, SCThing {
export interface SCSaveableThing extends SCSaveableThingWithoutReferences, SCThing {
/**
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -19,26 +19,24 @@ import {SCThing, SCThingMeta} from './thing';
/**
* A thing that is or happens in a place
*/
export interface SCThingInPlace
extends SCThing, SCInPlace {
export interface SCThingInPlace extends SCThing, SCInPlace {
// noop
}
/**
* Meta information about thing in a place
*/
export class SCThingInPlaceMeta
extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
inPlace: 'Ort',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
inPlace: 'location',
},
};
@@ -48,10 +46,10 @@ export class SCThingInPlaceMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -18,16 +18,12 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* Types of payment that are accepted at a place.
*/
export type SCThingThatAcceptsPaymentsAcceptedPayments =
'cash'
| 'credit'
| 'cafeteria card';
export type SCThingThatAcceptsPaymentsAcceptedPayments = 'cash' | 'credit' | 'cafeteria card';
/**
* A thing without references that accepts payments
*/
export interface SCThingThatAcceptsPaymentsWithoutReferences
extends SCThingWithoutReferences {
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThingWithoutReferences {
/**
* Accepted payments of the place
*
@@ -39,8 +35,7 @@ export interface SCThingThatAcceptsPaymentsWithoutReferences
/**
* A thing that accepts payments
*/
export interface SCThingThatAcceptsPayments
extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
export interface SCThingThatAcceptsPayments extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
// noop
}
@@ -48,17 +43,19 @@ export interface SCThingThatAcceptsPayments
* Meta information about a thing without references that accepts payments
*/
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
extends SCThingMeta implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> {
extends SCThingMeta
implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences>
{
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
paymentsAccepted: 'Bezahlmethoden',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
paymentsAccepted: 'accepted payment methods',
},
};
@@ -68,7 +65,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
paymentsAccepted: {
'cafeteria card': 'Mensakarte',
'cash': 'Bar',
@@ -76,7 +73,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
},
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -35,8 +35,7 @@ export interface SCPriceGroup {
/**
* Price distinctions for academic context
*/
export interface SCAcademicPriceGroup
extends SCPriceGroup {
export interface SCAcademicPriceGroup extends SCPriceGroup {
/**
* Price for employees
*
@@ -65,8 +64,7 @@ export interface SCAcademicPriceGroup
/**
* A thing without references that can be offered
*/
export interface SCThingThatCanBeOfferedWithoutReferences
extends SCThingWithoutReferences {
export interface SCThingThatCanBeOfferedWithoutReferences extends SCThingWithoutReferences {
/**
* Translations of a thing that can be offered
*/
@@ -77,7 +75,8 @@ export interface SCThingThatCanBeOfferedWithoutReferences
* A thing that can be offered
*/
export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
extends SCThing, SCThingThatCanBeOfferedWithoutReferences {
extends SCThing,
SCThingThatCanBeOfferedWithoutReferences {
/**
* List of offers for that thing
*/
@@ -92,8 +91,7 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
/**
* Offer of a thing
*/
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
extends SCInPlace {
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> extends SCInPlace {
/**
* Availability of an offer
*/
@@ -107,7 +105,7 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
/**
* List of prices that are distinct for specific groups
*/
prices: T;
prices?: T;
/**
* Provider of an offer
@@ -118,8 +116,7 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
/**
* Translatable properties of a thing that can be offered
*/
export interface SCThingThatCanBeOfferedTranslatableProperties
extends SCThingTranslatableProperties {
export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
/**
* Availability of an offer
*
@@ -131,9 +128,7 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
/**
* Entity responsible for the offer
*/
export type SCThingThatCanBeOfferedProvider =
| SCOrganizationWithoutReferences
| SCPersonWithoutReferences;
export type SCThingThatCanBeOfferedProvider = SCOrganizationWithoutReferences | SCPersonWithoutReferences;
/**
* Availability of an Offer
@@ -148,23 +143,18 @@ export type SCThingThatCanBeOfferedAvailability =
* Meta information about a thing without references that accepts payments
*/
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
implements SCMetaTranslations<SCThingThatCanBeOffered<T>> {
/**
* Instance
*/
protected static _instance = new Map<string, unknown>();
implements SCMetaTranslations<SCThingThatCanBeOffered<T>>
{
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
offers: 'Angebote',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
offers: 'offers',
},
};
@@ -174,26 +164,10 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -50,7 +50,8 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
* A thing with categories
*/
export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecificValues>
extends SCThing, SCThingWithCategoriesWithoutReferences<T, U> {
extends SCThing,
SCThingWithCategoriesWithoutReferences<T, U> {
/**
* 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
*/
export interface SCThingWithCategoriesTranslatableProperties
extends SCThingTranslatableProperties {
export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
/**
* translations of the categories of a thing with categories
*
@@ -118,24 +118,19 @@ export interface SCThingWithCategoriesSpecificValues {
* It intentionally does not extend the SCThingMeta implementation to be able to include generics.
*/
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
/**
* Instance
*/
protected static _instance = new Map<string, unknown>();
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>>
{
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
categories: 'Kategorien',
categorySpecificValues: 'besondere Kategorien',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
categories: 'categories',
categorySpecificValues: 'category with specific values',
},
@@ -146,27 +141,10 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
},
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -269,11 +269,6 @@ export interface SCThingTranslatablePropertyOrigin {
* Meta information about things
*/
export class SCThingMeta implements SCMetaTranslations<SCThing> {
/**
* Set type definition for singleton instance
*/
protected static _instance = new Map<string, unknown>();
/**
* Translations of fields
*/
@@ -315,19 +310,4 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -15,7 +15,4 @@
/**
* Types of data consumers
*/
export type SCUserGroup =
'students'
| 'employees'
| 'guests';
export type SCUserGroup = '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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -64,7 +64,8 @@ export interface SCAcademicEventWithoutReferences
* @indexable
*/
export interface SCAcademicEvent
extends SCEvent, SCAcademicEventWithoutReferences,
extends SCEvent,
SCAcademicEventWithoutReferences,
SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
/**
* Translated fields of an academic event
@@ -81,7 +82,7 @@ export interface SCAcademicEvent
* Categories of academic events
*/
export type SCAcademicEventCategories =
'lecture'
| 'lecture'
| 'seminar'
| 'integrated course'
| 'written exam'
@@ -100,8 +101,7 @@ export type SCAcademicEventCategories =
/**
* Translatable properties of an academic event
*/
export interface SCAcademicEventTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties {
export interface SCAcademicEventTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
/**
* 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
*/
export class SCAcademicEventMeta
extends SCThingMeta
implements SCMetaTranslations<SCAcademicEvent> {
export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicEvent> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCEventMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
majors: 'Hauptfächer',
originalCategory: 'ursprüngliche Kategorie',
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCEventMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
majors: 'majors',
originalCategory: 'original category',
},
@@ -148,9 +150,11 @@ export class SCAcademicEventMeta
*/
fieldValueTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...new SCEventMeta().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
'colloquium': 'Kolloquium',
'course': 'Kurs',
@@ -171,9 +175,11 @@ export class SCAcademicEventMeta
type: 'akademische Veranstaltung',
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...new SCEventMeta().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -20,6 +20,13 @@ import {
SCCreativeWorkWithoutReferences,
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
@@ -31,16 +38,15 @@ import {SCPeriodicalWithoutReferences} from './periodical';
/**
* Categories of an article
*/
export type SCArticleCategories = 'unipedia'
| 'article'
| 'eArticle';
export type SCArticleCategories = 'unipedia' | 'article' | 'eArticle';
/**
* An article without references
*/
export interface SCArticleWithoutReferences
extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
/**
* Article itself as markdown
*
@@ -71,7 +77,9 @@ export interface SCArticleWithoutReferences
* @indexable
*/
export interface SCArticle
extends SCCreativeWork, SCArticleWithoutReferences {
extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCArticleWithoutReferences {
/**
* A periodical to which this article belongs
*/
@@ -96,7 +104,9 @@ export interface SCArticle
* Translatable properties of an article
*/
export interface SCArticleTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties,
SCCreativeWorkTranslatableProperties {
/**
* Translation of the article itself as markdown
*
@@ -108,26 +118,29 @@ export interface SCArticleTranslatableProperties
/**
* Meta information about an article
*/
export class SCArticleMeta
extends SCThingMeta implements SCMetaTranslations<SCArticle> {
export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCArticle> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCCreativeWorkMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
categories: 'Format',
reference: 'Referenz',
articleBody: 'Artikelinhalt',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCCreativeWorkMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
categories: 'format',
reference: 'reference',
articleBody: 'article body',
@@ -139,8 +152,12 @@ export class SCArticleMeta
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...new SCCreativeWorkMeta().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
article: 'Artikel',
eArticle: 'E-Aufsatz',
@@ -149,8 +166,12 @@ export class SCArticleMeta
type: 'Artikel',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...new SCCreativeWorkMeta().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Article,
categories: {
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -16,59 +16,67 @@
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
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';
/**
* Categories of assessments
*/
export type SCAssessmentCategories = 'university assessment';
export type SCAssessmentCategories = 'university assessment';
/**
* An assessment without references
*
*/
export interface SCAssessmentWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> {
/**
* Number of attempts
*
* @integer
*/
attempt?: number;
extends SCThingWithCategoriesWithoutReferences<
SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
> {
/**
* Number of attempts
*
* @integer
*/
attempt?: number;
/**
* Date assessment was taken or graded
*/
date?: SCISO8601Date;
/**
* Date assessment was taken or graded
*/
date?: SCISO8601Date;
/**
* ECTS (credit-points)
*
* @float
*/
ects?: number;
/**
* ECTS (credit-points)
*
* @float
*/
ects?: number;
/**
* Grade
*/
grade: string;
/**
* Grade
*/
grade: string;
/**
* Current status
*/
status?: string;
/**
* Current status
*/
status?: string;
/**
* Translated fields of an assessment
*/
translations?: SCTranslations<SCAssessmentTranslatableProperties>;
/**
* Translated fields of an assessment
*/
translations?: SCTranslations<SCAssessmentTranslatableProperties>;
/**
* Type of an assessment
*/
type: SCThingType.Assessment;
/**
* Type of an assessment
*/
type: SCThingType.Assessment;
}
/**
@@ -77,9 +85,9 @@ export interface SCAssessmentWithoutReferences
* @validatable
*/
export interface SCAssessment
extends SCAssessmentWithoutReferences, SCThing,
extends SCAssessmentWithoutReferences,
SCThing,
SCThingWithCategories<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> {
/**
* Course of study the assessment was taken for
*/
@@ -99,30 +107,28 @@ export interface SCAssessment
* Type of an assessment
*/
type: SCThingType.Assessment;
}
export interface SCAssessmentTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties {
export interface SCAssessmentTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
/**
* @see SCAssessmentWithoutReferences.status
*/
status?: string;
status?: string;
}
/**
* Study module meta data
*/
export class SCAssessmentMeta
extends SCThingMeta
implements SCMetaTranslations<SCAssessment> {
export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations<SCAssessment> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
attempt: 'Versuch',
courseOfStudy: 'Studiengang',
date: 'Datum',
@@ -132,8 +138,10 @@ export interface SCAssessmentTranslatableProperties
superAssessments: 'übergeordnete Prüfungen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
attempt: 'attempt',
courseOfStudy: 'course of study',
date: 'date',
@@ -149,13 +157,17 @@ export interface SCAssessmentTranslatableProperties
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
type: 'Prüfung',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAssessmentCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCAssessmentCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -20,6 +20,13 @@ import {
SCCreativeWorkWithoutReferences,
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
@@ -30,7 +37,8 @@ import {
/**
* Categories of a book
*/
export type SCBookCategories = 'audio'
export type SCBookCategories =
| 'audio'
| 'book'
| 'cd'
| 'dvd'
@@ -54,7 +62,8 @@ export type SCBookCategories = 'audio'
*/
export interface SCBookWithoutReferences
extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> {
SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> {
/**
* Categories of a book
*/
@@ -93,7 +102,9 @@ export interface SCBookWithoutReferences
* @indexable
*/
export interface SCBook
extends SCCreativeWork, SCBookWithoutReferences {
extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCBookWithoutReferences {
/**
* Translated properties of a book
*/
@@ -109,8 +120,9 @@ export interface SCBook
* Translatable properties of a book
*/
export interface SCBookTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
}
extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties,
SCCreativeWorkTranslatableProperties {}
/**
* Meta information about a book
@@ -121,17 +133,23 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCCreativeWorkMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBookCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
categories: 'Format',
ISBNs: 'ISBN',
numberOfPages: 'Seitenanzahl',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCCreativeWorkMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBookCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
categories: 'format',
ISBNs: 'ISBN',
numberOfPages: 'number of pages',
@@ -143,10 +161,12 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...new SCCreativeWorkMeta().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBookCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
categories: {
audio: 'Tonträger',
book: 'Buch',
@@ -170,10 +190,12 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
type: 'Buch',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...new SCCreativeWorkMeta().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBookCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: SCThingType.Book,
categories: {
audio: 'audio material',

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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -29,7 +29,7 @@ import {
} from './abstract/thing-with-categories';
export type SCBuildingCategories =
'cafe'
| 'cafe'
| 'education'
| 'library'
| 'office'
@@ -67,7 +67,8 @@ export interface SCBuildingWithoutReferences
* @indexable
*/
export interface SCBuilding
extends SCBuildingWithoutReferences, SCPlace,
extends SCBuildingWithoutReferences,
SCPlace,
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
/**
* Translated fields of a building
@@ -81,7 +82,8 @@ export interface SCBuilding
}
export interface SCBuildingTranslatableProperties
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
extends SCPlaceWithoutReferencesTranslatableProperties,
SCThingWithCategoriesTranslatableProperties {
/**
* @see SCBuilding.floors
*/
@@ -91,23 +93,25 @@ export interface SCBuildingTranslatableProperties
/**
* Meta information about a place
*/
export class SCBuildingMeta
extends SCThingMeta
implements SCMetaTranslations<SCBuilding> {
export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SCBuilding> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
floors: 'Etagen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
floors: 'floors',
},
};
@@ -117,9 +121,11 @@ export class SCBuildingMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
@@ -133,9 +139,11 @@ export class SCBuildingMeta
type: 'Gebäude',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -51,7 +51,8 @@ export interface SCCatalogWithoutReferences
* @indexable
*/
export interface SCCatalog
extends SCCatalogWithoutReferences, SCThing,
extends SCCatalogWithoutReferences,
SCThing,
SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
/**
* Academic term that a catalog belongs to (e.g. semester)
@@ -82,23 +83,26 @@ export interface SCCatalog
/**
* Catalog meta data
*/
export class SCCatalogMeta
extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
academicTerm: 'Semester',
level: 'Ebene',
superCatalog: 'übergeordnetes Verzeichniss',
superCatalogs: 'übergeordnete Verzeichnisse',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
academicTerm: 'academic term',
level: 'level',
superCatalog: 'parent catalog',
@@ -111,16 +115,20 @@ export class SCCatalogMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
'university events': 'Universitätsveranstaltung',
},
type: 'Verzeichnis',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,19 +14,13 @@
*/
import {SCMetaTranslations} from '../general/i18n';
import {
SCThing,
SCThingMeta,
SCThingType,
SCThingWithoutReferences,
} from './abstract/thing';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCRoomWithoutReferences} from './room';
/**
* A contact point without references
*/
export interface SCContactPointWithoutReferences
extends SCThingWithoutReferences {
export interface SCContactPointWithoutReferences extends SCThingWithoutReferences {
/**
* E-mail at the work location
*
@@ -73,12 +67,10 @@ export interface SCContactPointWithoutReferences
* A contact point
*
* @see http://schema.org/ContactPoint
*
* @validatable
* @indexable
*/
export interface SCContactPoint
extends SCContactPointWithoutReferences, SCThing {
export interface SCContactPoint extends SCContactPointWithoutReferences, SCThing {
/**
* Exact place where work is performed
*/
@@ -93,15 +85,13 @@ export interface SCContactPoint
/**
* Meta information about a contact point
*/
export class SCContactPointMeta
extends SCThingMeta
implements SCMetaTranslations<SCContactPoint> {
export class SCContactPointMeta extends SCThingMeta implements SCMetaTranslations<SCContactPoint> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
areaServed: 'Arbeitsraum',
email: 'E-Mail-Addresse',
faxNumber: 'Faxnummer',
@@ -110,7 +100,7 @@ export class SCContactPointMeta
url: 'Link',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
areaServed: 'location',
email: 'email address',
faxNumber: 'fax number',
@@ -125,11 +115,11 @@ export class SCContactPointMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
type: 'Kontaktinformation',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...new SCThingMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,7 +13,11 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
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 {
SCAcademicPriceGroup,
@@ -29,7 +33,8 @@ import {SCOrganizationWithoutReferences} from './organization';
* A course of study without references
*/
export interface SCCourseOfStudyWithoutReferences
extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
extends SCAcademicDegreeWithoutReferences,
SCThingThatCanBeOfferedWithoutReferences {
/**
* The main language in which the course of study
* is beeing offered
@@ -68,7 +73,9 @@ export interface SCCourseOfStudyWithoutReferences
* @indexable
*/
export interface SCCourseOfStudy
extends SCCourseOfStudyWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
extends SCCourseOfStudyWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCAcademicDegree {
/**
* The department that manages the course of study
*/
@@ -99,26 +106,19 @@ export interface SCCourseOfStudy
/**
* Translatable properties of a course of study
*/
export interface SCCourseOfStudyTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
// noop
}
export type SCCourseOfStudyTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
/**
* Meta information about a course of study
*/
export class SCCourseOfStudyMeta
extends SCThingMeta
implements SCMetaTranslations<SCCourseOfStudy> {
export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslations<SCCourseOfStudy> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
.fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
...new SCAcademicDegreeMeta().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
department: 'Fachbereich',
mainLanguage: 'Unterrichtssprache',
mode: 'Studiengangsart',
@@ -127,10 +127,8 @@ export class SCCourseOfStudyMeta
timeMode: 'Zeitmodell',
},
en: {
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
.fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
...new SCAcademicDegreeMeta().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
department: 'department',
mainLanguage: 'main language',
mode: 'mode',
@@ -145,12 +143,12 @@ export class SCCourseOfStudyMeta
*/
fieldValueTranslations = {
de: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
...new SCAcademicDegreeMeta().fieldValueTranslations.de,
modes: {
combination: 'Kombinationsstudiengang',
'combination': 'Kombinationsstudiengang',
'double-degree': 'Doppelstudium',
dual: 'duales Studium',
standard: 'Studium',
'dual': 'duales Studium',
'standard': 'Studium',
},
timeMode: {
fulltime: 'Vollzeitstudiengang',
@@ -159,12 +157,12 @@ export class SCCourseOfStudyMeta
type: 'Studiengang',
},
en: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
...new SCAcademicDegreeMeta().fieldValueTranslations.en,
modes: {
combination: 'combination course of study',
'combination': 'combination course of study',
'double-degree': 'double degree course of study',
dual: 'dual course of study',
standard: 'course of study',
'dual': 'dual course of study',
'standard': 'course of study',
},
timeMode: {
fulltime: 'full-time',
@@ -178,13 +176,9 @@ export class SCCourseOfStudyMeta
/**
* Types of (german) course of study modes
*/
export type SCCourseOfStudyMode = 'combination'
| 'dual'
| 'double-degree'
| 'standard' ;
export type SCCourseOfStudyMode = 'combination' | 'dual' | 'double-degree' | 'standard';
/**
* Types of (german) course of study time modes
*/
export type SCCourseOfStudyTimeMode = 'fulltime'
| 'parttime' ;
export type SCCourseOfStudyTimeMode = 'fulltime' | '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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -30,8 +30,7 @@ import {SCSportCourseWithoutReferences} from './sport-course';
/**
* Price groups for sport courses
*/
export interface SCSportCoursePriceGroup
extends SCAcademicPriceGroup {
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/**
* Price for alumnis
*
@@ -43,8 +42,7 @@ export interface SCSportCoursePriceGroup
/**
* A date without references
*/
export interface SCDateSeriesWithoutReferences
extends SCThingThatCanBeOfferedWithoutReferences {
export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
/**
* Dates of the date series that are initially planned to be held
*
@@ -93,8 +91,7 @@ export interface SCDateSeries
/**
* Event to which the date series belongs
*/
event: SCAcademicEventWithoutReferences
| SCSportCourseWithoutReferences;
event: SCAcademicEventWithoutReferences | SCSportCourseWithoutReferences;
/**
* Performers of the date series
@@ -115,18 +112,14 @@ export interface SCDateSeries
/**
* Meta information about a date series
*/
export class SCDateSeriesMeta
extends SCThingMeta
implements SCMetaTranslations<SCDateSeries> {
export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<SCDateSeries> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldTranslations.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.de,
dates: 'Einzeltermine',
duration: 'Dauer',
event: 'Event',
@@ -135,10 +128,8 @@ export class SCDateSeriesMeta
performers: 'Vortragende',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldTranslations.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.en,
dates: 'dates',
duration: 'duration',
event: 'event',
@@ -153,17 +144,13 @@ export class SCDateSeriesMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldValueTranslations.de,
...new SCThingInPlaceMeta().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.de,
type: 'Terminserie',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldValueTranslations.en,
...new SCThingInPlaceMeta().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.en,
type: SCThingType.DateSeries,
},
};
@@ -172,6 +159,4 @@ export class SCDateSeriesMeta
/**
* Translatable properties of date series'
*/
export interface SCDateSeriesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
}
export type SCDateSeriesTranslatableProperties = 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -21,8 +21,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs
/**
* A diff without references
*/
export interface SCDiffWithoutReferences
extends SCThingWithoutReferences {
export interface SCDiffWithoutReferences extends SCThingWithoutReferences {
/**
* Action of the diff
*/
@@ -49,8 +48,7 @@ export interface SCDiffWithoutReferences
*
* @validatable
*/
export interface SCDiff
extends SCDiffWithoutReferences, SCThing {
export interface SCDiff extends SCDiffWithoutReferences, SCThing {
/**
* Original object the diff was generated on
*/
@@ -65,22 +63,20 @@ export interface SCDiff
/**
* Meta information about a diff
*/
export class SCDiffMeta
extends SCThingMeta
implements SCMetaTranslations<SCDiff> {
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
action: 'Aktion',
changes: 'Änderungen',
dateCreated: 'Erstellungsdatum',
object: 'Objekt',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
action: 'action',
changes: 'changes',
dateCreated: 'date created',
@@ -93,15 +89,15 @@ export class SCDiffMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
action: {
'changed': 'geändert',
'removed': 'gelöscht',
changed: 'geändert',
removed: 'gelöscht',
},
type: 'Unterschied',
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...new SCThingMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -71,7 +71,8 @@ export interface SCDishWithoutReferences
* @indexable
*/
export interface SCDish
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
extends SCDishWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCThingWithCategories<SCDishCategories, SCThingWithCategoriesSpecificValues> {
/**
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
@@ -90,7 +91,8 @@ export interface SCDish
}
export interface SCDishTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {
/**
* Additives of the dish
*
@@ -127,13 +129,7 @@ export interface SCDishCharacteristic {
/**
* A list of categories for dishes
*/
export type SCDishCategories =
| 'appetizer'
| 'salad'
| 'main dish'
| 'dessert'
| 'soup'
| 'side dish';
export type SCDishCategories = 'appetizer' | 'salad' | 'main dish' | 'dessert' | 'soup' | 'side dish';
/**
* Type definition for SCNutritionInformation
@@ -194,28 +190,28 @@ export interface SCNutritionInformation {
/**
* Meta information about a dish
*/
export class SCDishMeta
extends SCThingMeta
implements SCMetaTranslations<SCDish> {
export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
additives: 'Zusatzstoffe',
characteristics: 'Merkmale',
dishAddOns: 'Beilagen',
nutrition: 'Nährwertangaben',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
additives: 'additives',
characteristics: 'characteristics',
dishAddOns: 'side dishes',
@@ -228,25 +224,27 @@ export class SCDishMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
categories: {
appetizer: 'Vorspeise',
dessert: 'Nachtisch',
'appetizer': 'Vorspeise',
'dessert': 'Nachtisch',
'main dish': 'Hauptgericht',
salad: 'Salat',
'salad': 'Salat',
'side dish': 'Beilage',
soup: 'Suppe',
'soup': 'Suppe',
},
type: 'Essen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -18,8 +18,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
/**
* A favorite without references
*/
export interface SCFavoriteWithoutReferences
extends SCSaveableThingWithoutReferences {
export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences {
/**
* Type of a favorite
*/
@@ -41,6 +40,4 @@ export interface SCFavorite extends SCSaveableThing {
/**
* Meta information about a favorite
*/
export class SCFavoriteMeta
extends SCThingMeta {
}
export class SCFavoriteMeta 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,10 +12,14 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
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 {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './room';
@@ -23,8 +27,7 @@ import {SCRoomWithoutReferences} from './room';
/**
* A floor without references
*/
export interface SCFloorWithoutReferences
extends SCThingWithoutReferences {
export interface SCFloorWithoutReferences extends SCThingWithoutReferences {
/**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
*
@@ -54,8 +57,7 @@ export interface SCFloorWithoutReferences
* @validatable
* @indexable
*/
export interface SCFloor
extends SCFloorWithoutReferences, SCThingInPlace {
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
/**
* Translated fields of a floor
*/
@@ -70,8 +72,7 @@ export interface SCFloor
/**
* A feature collection
*/
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
extends FeatureCollection<T> {
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject> extends FeatureCollection<T> {
/**
* Features of the collection
*/
@@ -82,7 +83,7 @@ export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
* A feature with a place
*/
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> {
/**
* The place of the feature
@@ -93,8 +94,7 @@ export interface SCFloorFeatureWithPlace<T extends GeometryObject>
/**
* Translatable properties of a floor
*/
export interface SCFloorTranslatableProperties
extends SCThingTranslatableProperties {
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
/**
* Translation of the floor name
*
@@ -106,22 +106,18 @@ export interface SCFloorTranslatableProperties
/**
* Meta information about floors
*/
export class SCFloorMeta
extends SCThingMeta
implements SCMetaTranslations<SCFloor> {
export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFloor> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
floorName: 'Etagenbezeichnung',
plan: 'Grundriss',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
floorName: 'floor name',
plan: 'plan',
},
@@ -132,13 +128,11 @@ export class SCFloorMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
...new SCThingInPlaceMeta().fieldValueTranslations.de,
type: 'Etage',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
...new SCThingInPlaceMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -24,7 +24,8 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from './abstract/thing-with-categories';
import {SCUserGroup} from './abstract/user-groups';
import {SCOrganizationWithoutReferences} from './organization';
@@ -39,7 +40,7 @@ export type SCMessageCategories = 'news';
*/
export interface SCMessageWithoutReferences
extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> {
SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> {
/**
* Organizational unit for which the message is intended
*/
@@ -93,8 +94,7 @@ export interface SCMessageWithoutReferences
* @validatable
* @indexable
*/
export interface SCMessage
extends SCCreativeWork, SCMessageWithoutReferences {
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
/**
* Translated fields of a message
*/
@@ -110,7 +110,8 @@ export interface SCMessage
* Translatable properties of a message
*/
export interface SCMessageTranslatableProperties
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
extends SCCreativeWorkTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {
/**
* Message itself
*
@@ -122,18 +123,17 @@ export interface SCMessageTranslatableProperties
/**
* Meta information about messages
*/
export class SCMessageMeta
extends SCThingMeta
implements SCMetaTranslations<SCMessage> {
export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCMessageCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCCreativeWorkMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCMessageCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
audienceOrganizations: 'Zielgruppenorganisationen',
audiences: 'Zielgruppen',
dateCreated: 'Erstellungsdatum',
@@ -141,10 +141,11 @@ export class SCMessageMeta
sequenceIndex: 'Sequenzindex',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCMessageCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCCreativeWorkMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCMessageCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
audienceOrganizations: 'audience organizations',
audiences: 'audiences',
dateCreated: 'date created',
@@ -158,8 +159,11 @@ export class SCMessageMeta
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...new SCCreativeWorkMeta().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCMessageCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
audiences: {
employees: 'Angestellte',
guests: 'Gäste',
@@ -171,8 +175,11 @@ export class SCMessageMeta
type: 'Nachricht',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...new SCCreativeWorkMeta().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCMessageCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -20,8 +20,7 @@ import {SCContactPointWithoutReferences} from './contact-point';
/**
* An organization without references
*/
export interface SCOrganizationWithoutReferences
extends SCThingWithoutReferences {
export interface SCOrganizationWithoutReferences extends SCThingWithoutReferences {
/**
* Type of an organization
*/
@@ -34,8 +33,7 @@ export interface SCOrganizationWithoutReferences
* @validatable
* @indexable
*/
export interface SCOrganization
extends SCOrganizationWithoutReferences, SCThingInPlace {
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
/**
* A list of contact points concerning the organization
*/
@@ -50,18 +48,17 @@ export interface SCOrganization
/**
* Meta information about an organization
*/
export class SCOrganizationMeta
extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
contactPoints: 'Kontaktinformationen',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
contactPoints: 'contact details',
},
};
@@ -71,11 +68,11 @@ export class SCOrganizationMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.de,
...new SCThingInPlaceMeta().fieldValueTranslations.de,
type: 'Einrichtung',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.en,
...new SCThingInPlaceMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -20,6 +20,13 @@ import {
SCCreativeWorkWithoutReferences,
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
@@ -37,7 +44,8 @@ export type SCPeriodicalCategories = 'journal' | 'electronic';
*/
export interface SCPeriodicalWithoutReferences
extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
SCThingThatCanBeOfferedWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
/**
* Categories of a periodical
*/
@@ -68,7 +76,9 @@ export interface SCPeriodicalWithoutReferences
* @indexable
*/
export interface SCPeriodical
extends SCCreativeWork, SCPeriodicalWithoutReferences {
extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCPeriodicalWithoutReferences {
/**
* Translated properties of a periodical
*/
@@ -84,8 +94,9 @@ export interface SCPeriodical
* Translatable properties of a periodical
*/
export interface SCPeriodicalTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
}
extends SCThingWithCategoriesTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties,
SCCreativeWorkTranslatableProperties {}
/**
* Meta information about a periodical
@@ -96,16 +107,22 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCCreativeWorkMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
categories: 'Format',
ISSNs: 'ISSN',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCCreativeWorkMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
categories: 'format',
ISSNs: 'ISSN',
},
@@ -116,8 +133,12 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...new SCCreativeWorkMeta().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
type: 'Periodikum',
categories: {
electronic: 'E-Journal',
@@ -125,8 +146,12 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
},
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...new SCCreativeWorkMeta().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPeriodicalCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: 'periodical',
categories: {
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -24,8 +24,7 @@ import {SCRoomWithoutReferences} from './room';
/**
* A person without references
*/
export interface SCPersonWithoutReferences
extends SCThingWithoutReferences {
export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* Additional first names of the person.
*
@@ -45,7 +44,6 @@ export interface SCPersonWithoutReferences
* The private email address of the person.
*
* @TJS-format email
*
* @filterable
* @keyword
*/
@@ -138,8 +136,7 @@ export interface SCPersonWithoutReferences
* @validatable
* @indexable
*/
export interface SCPerson
extends SCPersonWithoutReferences, SCThing {
export interface SCPerson extends SCPersonWithoutReferences, SCThing {
/**
* Organization the person works for
*/
@@ -148,9 +145,9 @@ export interface SCPerson
/**
* A list of homes of the person
*/
homeLocations?: Array<SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences>;
homeLocations?: Array<
SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences
>;
/**
* Type of a person
@@ -166,15 +163,13 @@ export interface SCPerson
/**
* Meta information about a person
*/
export class SCPersonMeta
extends SCThingMeta
implements SCMetaTranslations<SCPerson> {
export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPerson> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
additionalName: 'Zusatzname',
affiliations: 'Zugehörigkeiten',
birthDate: 'Geburtsdatum',
@@ -192,7 +187,7 @@ export class SCPersonMeta
workLocations: 'Arbeitsstandorte',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
additionalName: 'additional name',
affiliations: 'affiliations',
birthDate: 'birth date',
@@ -217,17 +212,17 @@ export class SCPersonMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
gender: {
'female': 'weiblich',
'inter': 'divers',
'male': 'männlich',
'undefined': 'undefiniert',
female: 'weiblich',
inter: 'divers',
male: 'männlich',
undefined: 'undefiniert',
},
type: 'Person',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...new SCThingMeta().fieldValueTranslations.en,
type: SCThingType.Person,
},
};
@@ -236,8 +231,4 @@ export class SCPersonMeta
/**
* Gender of a person
*/
export type SCPersonGender =
'male'
| 'female'
| 'inter'
| 'undefined';
export type SCPersonGender = '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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -28,7 +28,10 @@ import {
* A point of interest without references
*/
export interface SCPointOfInterestWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>,
extends SCThingWithCategoriesWithoutReferences<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>,
SCPlaceWithoutReferences {
/**
* Translated properties of a point of interest
@@ -48,7 +51,9 @@ export interface SCPointOfInterestWithoutReferences
* @indexable
*/
export interface SCPointOfInterest
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
extends SCPointOfInterestWithoutReferences,
SCThingInPlace,
SCPlace,
SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> {
/**
* Translated properties of a point of interest
@@ -65,7 +70,7 @@ export interface SCPointOfInterest
* Categories of a point of interest
*/
export type SCPointOfInterestCategories =
'computer'
| 'computer'
| 'validator'
| 'card charger'
| 'printer'
@@ -74,26 +79,26 @@ export type SCPointOfInterestCategories =
/**
* Meta information about points of interest
*/
export class SCPointOfInterestMeta
extends SCThingMeta
implements SCMetaTranslations<SCPointOfInterest> {
export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations<SCPointOfInterest> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
},
};
@@ -102,9 +107,11 @@ export class SCPointOfInterestMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
categories: {
'card charger': 'Kartenaufwerter',
'computer': 'Computer',
@@ -115,9 +122,11 @@ export class SCPointOfInterestMeta
type: 'Sonderziel',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -19,8 +19,7 @@ import {SCThingMeta, SCThingTranslatableProperties, SCThingType} from './abstrac
/**
* An publication event without references
*/
export interface SCPublicationEventWithoutReferences
extends SCEventWithoutReferences {
export interface SCPublicationEventWithoutReferences extends SCEventWithoutReferences {
/**
* All the locations related to the event (e.g. where a creative work was published)
*/
@@ -48,8 +47,7 @@ export interface SCPublicationEventWithoutReferences
* @validatable
* @indexable
*/
export interface SCPublicationEvent
extends SCEvent, SCPublicationEventWithoutReferences {
export interface SCPublicationEvent extends SCEvent, SCPublicationEventWithoutReferences {
/**
* Translated fields of an publication event
*/
@@ -64,26 +62,23 @@ export interface SCPublicationEvent
/**
* Translatable properties of an publication event
*/
export interface SCPublicationEventTranslatableProperties extends SCThingTranslatableProperties {
}
export type SCPublicationEventTranslatableProperties = SCThingTranslatableProperties;
/**
* Meta information about publication events
*/
export class SCPublicationEventMeta
extends SCThingMeta
implements SCMetaTranslations<SCPublicationEvent> {
export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTranslations<SCPublicationEvent> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
...new SCEventMeta().fieldTranslations.de,
locations: 'Erscheinungsorte',
publisher: 'Verlag',
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
...new SCEventMeta().fieldTranslations.en,
locations: 'places of publication',
publisher: 'publisher',
},
@@ -94,11 +89,11 @@ export class SCPublicationEventMeta
*/
fieldValueTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
...new SCEventMeta().fieldValueTranslations.de,
type: 'Veröffentlichung',
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
...new SCEventMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -35,7 +35,7 @@ import {
* Categories of a room
*/
export type SCRoomCategories =
'cafe'
| 'cafe'
| 'canteen'
| 'computer'
| 'education'
@@ -53,7 +53,8 @@ export type SCRoomCategories =
* A room without references
*/
export interface SCRoomWithoutReferences
extends SCPlaceWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferences,
extends SCPlaceWithoutReferences,
SCThingThatAcceptsPaymentsWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
/**
* The name of the floor in which the room is in.
@@ -88,7 +89,10 @@ export interface SCRoomWithoutReferences
* @indexable
*/
export interface SCRoom
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
extends SCRoomWithoutReferences,
SCThingInPlace,
SCThingThatAcceptsPayments,
SCPlace,
SCThingWithCategories<SCRoomCategories, SCRoomSpecificValues> {
/**
* Translations of specific values of the object
@@ -106,8 +110,7 @@ export interface SCRoom
/**
* Category specific values of a room
*/
export interface SCRoomSpecificValues
extends SCThingWithCategoriesSpecificValues {
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
/**
* Category specific opening hours of the room
*
@@ -119,32 +122,26 @@ export interface SCRoomSpecificValues
/**
* Meta information about a place
*/
export class SCRoomMeta
extends SCThingMeta
implements SCMetaTranslations<SCRoom> {
export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
.fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
floorName: 'Etagenbezeichnung',
inventory: 'Bestand',
},
en: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
.fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
floorName: 'floor name',
inventory: 'inventory',
},
@@ -155,13 +152,11 @@ export class SCRoomMeta
*/
fieldValueTranslations = {
de: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
.fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
.fieldValueTranslations.de,
...new SCThingInPlaceMeta().fieldValueTranslations.de,
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
@@ -180,13 +175,11 @@ export class SCRoomMeta
type: 'Raum',
},
en: {
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
.fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
.fieldValueTranslations.en,
...new SCThingInPlaceMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -23,8 +23,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
/**
* A semester without references
*/
export interface SCSemesterWithoutReferences
extends SCAcademicTermWithoutReferences {
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
/**
* The short name of the semester, using the given pattern.
*
@@ -46,8 +45,7 @@ export interface SCSemesterWithoutReferences
* @validatable
* @indexable
*/
export interface SCSemester
extends SCSemesterWithoutReferences, SCAcademicTerm {
export interface SCSemester extends SCSemesterWithoutReferences, SCAcademicTerm {
/**
* Type of the semester
*/
@@ -57,15 +55,13 @@ export interface SCSemester
/**
* Meta information about a semester
*/
export class SCSemesterMeta
extends SCThingMeta
implements SCMetaTranslations<SCSemester> {
export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.de,
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.de,
acronym: 'Abkürzung',
endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss',
@@ -73,7 +69,7 @@ export class SCSemesterMeta
startDate: 'Beginn',
},
en: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.en,
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.en,
acronym: 'acronym',
endDate: 'end date',
eventsEndDate: 'semester ending',
@@ -87,13 +83,11 @@ export class SCSemesterMeta
*/
fieldValueTranslations = {
de: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
.fieldValueTranslations.de,
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.de,
type: 'Semester',
},
en: {
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
.fieldValueTranslations.en,
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -63,11 +63,7 @@ export interface SCSettingWithoutReferences
/**
* A list of categories for settings
*/
export type SCSettingCategories =
'profile'
| 'privacy'
| 'credentials'
| 'others';
export type SCSettingCategories = 'profile' | 'privacy' | 'credentials' | 'others';
/**
* The types of input/value a setting object can carry
@@ -86,7 +82,8 @@ export enum SCSettingInputType {
* @validatable
*/
export interface SCSetting
extends SCSettingWithoutReferences, SCThing,
extends SCSettingWithoutReferences,
SCThing,
SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
/**
* Translated fields of a setting
@@ -129,8 +126,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
defaultValue: 'Standard Wert',
inputType: 'Eingabetyp',
order: 'Position',
@@ -138,8 +137,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
values: 'Werte',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
defaultValue: 'default value',
inputType: 'input type',
order: 'position',
@@ -153,8 +154,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
credentials: 'Anmeldedaten',
others: 'Andere',
@@ -163,16 +166,18 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
},
inputType: {
'multiple choice': 'mehrfach Auswahl',
number: 'Zahl',
password: 'Passwort',
'number': 'Zahl',
'password': 'Passwort',
'single choice': 'einfache Auswahl',
text: 'Text',
'text': 'Text',
},
type: 'Einstellung',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -19,8 +19,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
/**
* A sport course without references
*/
export interface SCSportCourseWithoutReferences
extends SCEventWithoutReferences {
export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
/**
* Type of a sport course
*/
@@ -33,8 +32,7 @@ export interface SCSportCourseWithoutReferences
* @validatable
* @indexable
*/
export interface SCSportCourse
extends SCEvent, SCSportCourseWithoutReferences {
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
/**
* Type of a sport course
*/
@@ -44,18 +42,16 @@ export interface SCSportCourse
/**
* Meta information about a sport course
*/
export class SCSportCourseMeta
extends SCThingMeta
implements SCMetaTranslations<SCSportCourse> {
export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations<SCSportCourse> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
...new SCEventMeta().fieldTranslations.de,
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
...new SCEventMeta().fieldTranslations.en,
},
};
@@ -64,11 +60,11 @@ export class SCSportCourseMeta
*/
fieldValueTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
...new SCEventMeta().fieldValueTranslations.de,
type: 'Sportkurs',
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
...new SCEventMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -29,9 +29,7 @@ import {SCPersonWithoutReferences} from './person';
/**
* A study module without references
*/
export interface SCStudyModuleWithoutReferences
extends SCThingThatCanBeOfferedWithoutReferences {
export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
/**
* ECTS points (European Credit Transfer System)
*
@@ -75,7 +73,8 @@ export interface SCStudyModuleWithoutReferences
* @indexable
*/
export interface SCStudyModule
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
extends SCStudyModuleWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/**
* Academic events that make up a study module
*/
@@ -113,8 +112,7 @@ export interface SCStudyModule
type: SCThingType.StudyModule;
}
export interface SCStudyModuleTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
export interface SCStudyModuleTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translations of the majors that this study module is meant for
*
@@ -142,17 +140,14 @@ export enum SCStudyModuleNecessity {
/**
* Study module meta data
*/
export class SCStudyModuleMeta
extends SCThingMeta
implements SCMetaTranslations<SCStudyModule> {
export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations<SCStudyModule> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
academicEvents: 'Veranstaltungen',
ects: 'ECTS-Punkte',
faculty: 'Fachbereich',
@@ -164,9 +159,8 @@ export class SCStudyModuleMeta
secretary: 'Sekretariat',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
academicEvents: 'academic events',
ects: 'ECTS points',
faculty: 'faculty',
@@ -184,20 +178,18 @@ export class SCStudyModuleMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
necessity: {
'elective': 'Wahlfach',
'optional': 'optional',
'required': 'benötigt',
elective: 'Wahlfach',
optional: 'optional',
required: 'benötigt',
},
type: 'Studiengangmodul',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.en,
...new SCThingMeta().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -20,8 +20,7 @@ import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
/**
* A ticket without references
*/
export interface SCTicketWithoutReferences
extends SCThingWithoutReferences {
export interface SCTicketWithoutReferences extends SCThingWithoutReferences {
/**
* Approximate wait time
*/
@@ -51,8 +50,7 @@ export interface SCTicketWithoutReferences
* @validatable
* @indexable
*/
export interface SCTicket
extends SCTicketWithoutReferences, SCThingInPlace {
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
/**
* Type of a ticket
*/
@@ -62,23 +60,19 @@ export interface SCTicket
/**
* Meta information about a ticket
*/
export class SCTicketMeta
extends SCThingMeta
implements SCMetaTranslations<SCTicket> {
export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTicket> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
...new SCThingInPlaceMeta().fieldTranslations.de,
approxWaitingTime: 'ungefähre Wartezeit',
currentTicketNumber: 'aktuelle Ticketnummer',
serviceType: 'Service Kategorie',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
...new SCThingInPlaceMeta().fieldTranslations.en,
approxWaitingTime: 'approximate waiting time',
currentTicketNumber: 'current ticket number',
serviceType: 'type of service',
@@ -90,13 +84,11 @@ export class SCTicketMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
...new SCThingInPlaceMeta().fieldValueTranslations.de,
type: 'Ticket',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
...new SCThingInPlaceMeta().fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -58,7 +58,9 @@ export interface SCToDoWithoutReferences
* @indexable
*/
export interface SCToDo
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
extends SCToDoWithoutReferences,
SCThing,
SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
/**
* Translated fields of a thing with categories
*/
@@ -88,15 +90,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
.fieldTranslations.de,
done: 'Erledigt',
dueDate: 'Fälligkeitsdatum',
priority: 'Priorität',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
.fieldTranslations.en,
done: 'done',
dueDate: 'due date',
priority: 'priority',
@@ -108,13 +110,13 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
.fieldValueTranslations.de,
type: 'ToDo',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
.fieldValueTranslations.en,
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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs
/**
* A tour without references
*/
export interface SCTourWithoutReferences
extends SCThingWithoutReferences {
export interface SCTourWithoutReferences extends SCThingWithoutReferences {
/**
* Init script for the tour
*
@@ -46,8 +45,7 @@ export interface SCTourWithoutReferences
* @validatable
* @indexable
*/
export interface SCTour
extends SCTourWithoutReferences, SCThing {
export interface SCTour extends SCTourWithoutReferences, SCThing {
/**
* Type of a tour
*/
@@ -57,20 +55,18 @@ export interface SCTour
/**
* Meta information about a tour
*/
export class SCTourMeta
extends SCThingMeta
implements SCMetaTranslations<SCTour> {
export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...new SCThingMeta().fieldTranslations.de,
init: 'Initiales Skript',
steps: 'Schritte',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...new SCThingMeta().fieldTranslations.en,
init: 'initial script',
steps: 'steps',
},
@@ -81,11 +77,11 @@ export class SCTourMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...new SCThingMeta().fieldValueTranslations.de,
type: 'Tour',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...new SCThingMeta().fieldValueTranslations.en,
type: SCThingType.Tour,
},
};
@@ -94,10 +90,7 @@ export class SCTourMeta
/**
* A step in a tour
*/
export type SCTourStep =
SCTourStepMenu
| SCTourStepLocation
| SCTourStepTooltip;
export type SCTourStep = SCTourStepMenu | SCTourStepLocation | SCTourStepTooltip;
/**
* 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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,17 +12,30 @@
* 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 {SCLanguage, SCMetaTranslations} from '../general/i18n';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
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 {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import {SCPersonWithoutReferences} from './person';
/**
* A video without references
*/
export interface SCVideoWithoutReferences
extends SCCreativeWorkWithoutReferences {
extends SCCreativeWorkWithoutReferences,
SCThingThatCanBeOfferedWithoutReferences {
/**
* The Duration of the Video
*/
@@ -52,6 +65,11 @@ export interface SCVideoWithoutReferences
*/
transcript?: string;
/**
* Translated fields of a video
*/
translations?: SCTranslations<SCVideoTranslatableFields>;
/**
* Type of an Video
*/
@@ -123,31 +141,43 @@ export interface SCVideoTrack {
* @indexable
*/
export interface SCVideo
extends SCCreativeWork, SCVideoWithoutReferences {
extends SCCreativeWork,
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
SCVideoWithoutReferences {
/**
* Persons acting in the Video
*/
actors?: SCPersonWithoutReferences[];
/**
* Translated fields of a video
*/
translations?: SCTranslations<SCVideoTranslatableFields>;
/**
* Type of a video
*/
type: SCThingType.Video;
}
/**
* Translatable properties of a video
*/
export interface SCVideoTranslatableFields
extends SCCreativeWorkTranslatableProperties,
SCThingThatCanBeOfferedTranslatableProperties {}
/**
* Meta information about a video
*/
export class SCVideoMeta
extends SCThingMeta
implements SCMetaTranslations<SCVideo> {
export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVideo> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
...new SCCreativeWorkMeta().fieldTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
actors: 'Darsteller',
duration: 'Dauer',
sources: 'Quellen',
@@ -156,8 +186,8 @@ export class SCVideoMeta
transcript: 'Transkript',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
...new SCCreativeWorkMeta().fieldTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
actors: 'actors',
duration: 'duration',
sources: 'sources',
@@ -172,13 +202,13 @@ export class SCVideoMeta
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...new SCCreativeWorkMeta().fieldValueTranslations.de,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
type: 'Video',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...new SCCreativeWorkMeta().fieldValueTranslations.en,
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
type: SCThingType.Video,
},
};
@@ -188,7 +218,7 @@ export class SCVideoMeta
* Video Encoding Formats
*/
export type SCVideoMimeType =
'video/mp4'
| 'video/mp4'
| 'video/ogg'
| 'video/webm'
| 'application/vnd.apple.mpegurl'
@@ -197,9 +227,4 @@ export type SCVideoMimeType =
/**
* Video Track Types
*/
export type SCVideoTrackTypes =
'closed captions'
| 'chapters'
| 'description'
| 'metadata'
| 'subtitles';
export type SCVideoTrackTypes = '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
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,22 +13,21 @@
* 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 clone = require('fast-clone');
import equal = require('fast-deep-equal/es6');
import clone = require('rfdc');
import {Defined, TSOCType} from 'ts-optchain';
import {SCLanguageCode} from './general/i18n';
import {isThing} from './guards';
import {SCClasses} from './meta';
import {SCThing, SCThingType} from './things/abstract/thing';
// tslint:disable:no-any
// eslint disable @typescript-eslint/no-explicit-any
const standardCacheSize = 200;
/**
* SCThingTranslator class
*/
export class SCThingTranslator {
/**
* Getter for language property
*/
@@ -77,6 +77,13 @@ export class SCThingTranslator {
this.sourceCache = new LRUCache(cacheCapacity);
this._language = language;
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
* @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> {
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) => {
const obj: any = target();
const object: any = target();
return this.deeptranslate(obj[key]);
return this.deeptranslate(object[key]);
},
},
);
@@ -108,8 +114,7 @@ export class SCThingTranslator {
* @param language The language the thing property values are translated to
* @returns The thing with all known meta values translated
*/
private getAllMetaFieldTranslations(thingType: SCThingType,
language: SCLanguageCode): object | undefined {
private getAllMetaFieldTranslations(thingType: SCThingType, language: SCLanguageCode): object | undefined {
const fieldTranslations = {};
const metaClass = this.getMetaClassInstance(thingType);
if (typeof metaClass === 'undefined') {
@@ -118,18 +123,16 @@ export class SCThingTranslator {
// Assigns every property in fieldTranslations to the known base language translation
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
Object.keys(metaClass.fieldTranslations.en)
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
});
for (const key of Object.keys(metaClass.fieldTranslations.en)) {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
}
}
// Assigns every property in fieldTranslations to the known translation in given language
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldTranslations[language])
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
});
for (const key of Object.keys(metaClass.fieldTranslations[language])) {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
}
}
return fieldTranslations;
@@ -143,7 +146,7 @@ export class SCThingTranslator {
*/
private getMetaClassInstance(thingType: SCThingType): any {
if (thingType in this.metaClasses) {
return new (this.metaClasses as any)[thingType]();
return this.metaClasses[thingType];
}
return undefined;
@@ -157,32 +160,33 @@ export class SCThingTranslator {
* @param language The language the thing / object is translated to
* @returns The thing with translated meta field values
*/
private replaceAvailableMetaFieldValueTranslations(instance: any,
language: SCLanguageCode): any {
private replaceAvailableMetaFieldValueTranslations(instance: any, language: SCLanguageCode): any {
const metaClass = this.getMetaClassInstance(instance.type);
if (typeof metaClass === 'undefined') {
return instance;
}
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldValueTranslations[language])
.forEach((key) => {
if (metaClass.fieldValueTranslations[language][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])
.forEach((subKey) => {
(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];
for (const key of Object.keys(metaClass.fieldValueTranslations[language])) {
if (
metaClass.fieldValueTranslations[language][key] instanceof Object &&
(instance as any)[key] instanceof Object
) {
// Assigns known translations of subproperties to property in given language (e.g. categories)
for (const subKey of Object.keys((instance as any)[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];
}
}
}
return instance;
@@ -200,15 +204,15 @@ export class SCThingTranslator {
let nextInstance = instance as any;
// Recursively call this function on all nested SCThings, arrays and objects
Object.keys(nextInstance)
.forEach((key) => {
if (
isThing(nextInstance[key]) ||
nextInstance[key] instanceof Array ||
nextInstance[key] instanceof Object) {
nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]);
}
});
for (const key of Object.keys(nextInstance)) {
if (
isThing(nextInstance[key]) ||
Array.isArray(nextInstance[key]) ||
nextInstance[key] instanceof Object
) {
nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]);
}
}
// Spread variable translations given by the connector into thing
if (typeof nextInstance.translations?.[targetLanguage] !== 'undefined') {
@@ -224,7 +228,7 @@ export class SCThingTranslator {
* Recursively translates the given object in-place
* 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
*/
public translate<T extends SCThing>(thing: T): T {
@@ -234,7 +238,7 @@ export class SCThingTranslator {
return cachedInstance as T;
}
}
const translatedInstance = this.translateThingInPlaceDestructively(clone(thing));
const translatedInstance = this.translateThingInPlaceDestructively(clone()(thing));
delete translatedInstance.translations;
this.cache.putObject(translatedInstance);
this.sourceCache.putObject(thing);
@@ -244,6 +248,7 @@ export class SCThingTranslator {
/**
* Get field value translation recursively
*
* @example
* const dish: SCDish = {...};
* translator.translate(dish).offers[0].inPlace.categories[1]());
@@ -257,21 +262,21 @@ export class SCThingTranslator {
*/
public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> {
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) => {
const obj: any = target();
const object: any = target();
if (equal(this.sourceCache.get(thing), thing)) {
const objTranslatedFromCache = this.cache.get(thing);
if (typeof objTranslatedFromCache !== 'undefined') {
return this.deeptranslate((objTranslatedFromCache as any)[key]);
const objectTranslatedFromCache = this.cache.get(thing);
if (typeof objectTranslatedFromCache !== 'undefined') {
return this.deeptranslate((objectTranslatedFromCache as any)[key]);
}
}
const objTranslated = this.translateThingInPlaceDestructively(clone(obj));
this.cache.putObject(objTranslated);
const objectTranslated = this.translateThingInPlaceDestructively(clone()(object));
this.cache.putObject(objectTranslated);
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
* All the values will be set to the known translations of the property/key name
*
* @example
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudy>(SCThingType.CourseOfStudy);
* @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
* Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional
*
* @example
* const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish');
* @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
* @returns Known translation for the property
*/
public translatedPropertyValue(type: SCThingType,
field: string,
key?: string): string | undefined {
const fieldValueTranslations = this.getMetaClassInstance(type).fieldValueTranslations[this.language] ??
this.getMetaClassInstance(type).fieldValueTranslations.en;
public translatedPropertyValue(type: SCThingType, field: string, key?: string): string | undefined {
const fieldValueTranslations =
this.getMetaClassInstance(type).fieldValueTranslations[this.language] ??
this.getMetaClassInstance(type).fieldValueTranslations.en;
const fieldTranslation = fieldValueTranslations?.[field];
return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation;
@@ -386,8 +392,7 @@ class LRUCache<T> {
public put(key: string, content: T) {
if (this.entries.size >= this.maxEntries) {
// LRU behavior
const keyToDelete = this.entries.keys()
.next().value;
const keyToDelete = this.entries.keys().next().value;
this.entries.delete(keyToDelete);
}
this.entries.set(key, content);
@@ -399,6 +404,6 @@ class LRUCache<T> {
* @param something The object that should be cached under something.uid
*/
public putObject<U extends SCThing>(something: U) {
this.put(something.uid, (something as any) as T);
this.put(something.uid, something as any as T);
}
}

View File

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

View File

@@ -16,13 +16,13 @@
}
],
"firstPublished": "2008",
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB198305427",
"sameAs": "https://ubffm.hds.hebis.de/Record/HEB198305427",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "HeBIS HDS",
"originalId": "HEB198305427",
"type": "remote",
"url": "https://hds2.hebis.de/ubffm/"
"url": "https://ubffm.hds.hebis.de"
},
"isPartOf": {
"uid": "bc5e5399-a24c-5c01-9c1b-0c8b83272087",

View File

@@ -16,13 +16,13 @@
}
],
"firstPublished": "2002",
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB107025590",
"sameAs": "https://ubffm.hds.hebis.de/Record/HEB107025590",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "HeBIS HDS",
"originalId": "HEB107025590",
"type": "remote",
"url": "https://hds2.hebis.de/ubffm/"
"url": "https://ubffm.hds.hebis.de"
},
"isPartOf": {
"uid": "f84c1851-042e-542f-ba7a-158b32dfb82f",

View File

@@ -16,6 +16,7 @@
}
],
"firstPublished": "[ca. 1991]",
"lastPublished": "2000 Q1",
"publications": [
{
"uid": "603a6574-8910-588a-9e83-cd26e6988c74",
@@ -27,13 +28,13 @@
"name": "VDI"
}
],
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB022992618",
"sameAs": "https://ubffm.hds.hebis.de/Record/HEB022992618",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "HeBIS HDS",
"originalId": "HEB022992618",
"type": "remote",
"url": "https://hds2.hebis.de/ubffm/"
"url": "https://ubffm.hds.hebis.de"
}
},
"schema": "SCBook"

View File

@@ -27,7 +27,7 @@
"name": "Belles Lettres"
}
],
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB102248788",
"sameAs": "https://ubffm.hds.hebis.de/Record/HEB102248788",
"ISBNs": [
"2251760385"
],
@@ -36,7 +36,7 @@
"name": "HeBIS HDS",
"originalId": "HEB102248788",
"type": "remote",
"url": "https://hds2.hebis.de/ubffm/"
"url": "https://ubffm.hds.hebis.de"
}
},
"schema": "SCBook"

View File

@@ -5,13 +5,16 @@
"instance": {
"type": "message",
"invalid-non-existing-key-in-schema": 1,
"uid": "4706ef24-b631-5c20-91d1-3c627decca5a",
"uid": "4706ef24-b631-5c20-91d1-3c627deccf5a",
"image": "https://backend/res/img/message_small.png",
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
"messageBody": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
"audiences": [
"students"
],
"categories": [
"news"
],
"audienceOrganizations": [{
"name": "TU Berlin",
"type": "organization",

View File

@@ -0,0 +1,28 @@
{
"errorNames": [
"required"
],
"instance": {
"type": "message",
"invalid-non-existing-key-in-schema": 1,
"uid": "4706ef24-b631-5c20-91d1-3c627deccfff",
"image": "https://backend/res/img/message_small.png",
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
"messageBody": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
"audiences": [
"students"
],
"audienceOrganizations": [{
"name": "TU Berlin",
"type": "organization",
"uid": "4806ef14-b631-5c20-91d1-3c627decca5a"
}],
"sequenceIndex": 1005,
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
}
},
"schema": "SCMessage"
}

Some files were not shown because too many files have changed in this diff Show More