Compare commits

..

14 Commits

Author SHA1 Message Date
Karl-Philipp Wulfert
3a84d12f26 0.21.0 2019-06-19 14:21:48 +02:00
Karl-Philipp Wulfert
b621a12689 refactor: adjust to new tslint settings 2019-06-18 17:26:54 +02:00
Karl-Philipp Wulfert
6ffa4efbaf build: add automatic publishing
Fixes #72
2019-06-17 15:40:40 +02:00
Karl-Philipp Wulfert
e41169a9c7 refactor: adjust model to not contain any 2019-06-17 10:06:38 +00:00
Karl-Philipp Wulfert
46194b177b test: walk along dependency chains 2019-06-17 10:06:38 +00:00
Karl-Philipp Wulfert
ff1f554e0b feat: add static typed test for consistency
Fixes #71
2019-06-17 10:06:38 +00:00
Benjamin Jöckel
9c424b0f96 feat: add ES annotations 2019-06-11 16:42:52 +02:00
Jovan Krunić
55b5248660 docs: update changelog 2019-06-11 16:21:56 +02:00
Jovan Krunić
961103c4e8 0.20.0 2019-06-11 16:21:37 +02:00
Rainer Killinger
771c417db8 docs: extend discription of getInstance() 2019-06-05 13:07:07 +00:00
Rainer Killinger
f847a2aa0c fix: add translations for every SCThing
fix: add field translations for  basic interfaces

fix: add translations for Message, Ticket & Video

fix: add translations for AcademicEvent, Article, Book and Building

fix: add translations

fix: add translations for Dish, Floor, Person and Room

fix: finalize  known translations

fix: add translations for setting

fix: add empty translations for fieldValues

style: applied tslint rules

fix: add missing fieldValueTranslations

fix: remove illegal nested translations
2019-06-05 12:31:48 +00:00
Wieland Schöbl
78b64bae08 fix: rename properties floor and message so that they are not identical to SCThingTypes 2019-05-29 14:02:27 +02:00
Jovan Krunić
e3ea846470 refactor: unify plugin conflict errors
Closes #58
2019-05-17 14:15:11 +02:00
Jovan Krunić
3f10129356 docs: update changelog 2019-05-17 12:34:01 +02:00
88 changed files with 1983 additions and 476 deletions

View File

@@ -50,6 +50,21 @@ test:
- report
- coverage
package:
dependencies:
- build
tags:
- secrecy
stage: deploy
script:
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
- npm publish
only:
- /^v[0-9]+.[0-9]+.[0-9]+$/
artifacts:
paths:
- lib
pages:
stage: deploy
script:

View File

@@ -1,3 +1,24 @@
# [0.20.0](https://gitlab.com/openstapps/core/compare/v0.19.0...v0.20.0) (2019-06-11)
### Bug Fixes
* add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2a))
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64ba))
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
### Bug Fixes
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507e)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
# [0.18.0](https://gitlab.com/openstapps/core/compare/v0.17.0...v0.18.0) (2019-05-14)

View File

@@ -29,3 +29,21 @@ To generate a documentation for the routes use the following command.
```shell
node --require ts-node/register src/cli.ts routes PATH/TO/ROUTES.md
```
### Annotations
Annotations are used to add additional informations to fields, which are used to autogenerate mappings from the core objects.
External dependencies can not be covered by the annotations. Documentation about some of the annotations can be found in: [typedoc](https://typedoc.org/guides/doccomments/)
| annotation | description | parameters |
|-------------------|-------------------------------------------|---------------|
| `@aggregatable` | used for generating of aggregations of the field if the core schema is used to put data into a database/key-value store | |
| `@float` | number field is interpreted as float | |
| `@indexable` | marks the type as indexable if the core schema is used to put data into a database/key-value store| |
| `@integer` | number field is interpreted as integer | |
| `@keyword` | string field is interpreted as keyword | |
| `@sortable` | field is sortable if the core schema is used to put data into a database/key-value store | sort method to be used: ducet, price, distance |
| `@text` | string field is interpreted as text | |
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |

201
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/core",
"version": "0.19.0",
"version": "0.21.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -81,9 +81,9 @@
"dev": true
},
"@babel/runtime": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.4.tgz",
"integrity": "sha512-w0+uT71b6Yi7i5SE0co4NioIpSYS6lLiXvCzWzGSKvpK5vdQtCbICHMj+gbAKAOtxiV6HsVh/MBdaF9EQ6faSg==",
"version": "7.4.5",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz",
"integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.2"
@@ -146,27 +146,62 @@
"dev": true
},
"@openstapps/configuration": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.14.0.tgz",
"integrity": "sha512-0eiupryX/yOD76Q/aNgY//0uoJ0v2OEGRunqQjfAXW5humTRH2wUKv89IdqbhqV+w2At0Qlg0xd8SvfSNL43JQ==",
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.18.0.tgz",
"integrity": "sha512-Ufi3jzCozVqCymNeaeRzuOHO2Yd5qXJ10uF4xNHk6Q4LFD9NAMMBkYbawkjmecZoNR+Llqs4AnwSxIkuEAxcxA==",
"dev": true,
"requires": {
"@types/node": "10.14.4",
"@types/node": "10.14.7",
"@types/semver": "6.0.0",
"@types/yaml": "1.0.2",
"chalk": "2.4.2",
"commander": "2.20.0",
"semver": "6.0.0",
"semver": "6.1.0",
"tslint": "5.16.0",
"tslint-eslint-rules": "5.4.0",
"yaml": "1.5.0"
"yaml": "1.6.0"
},
"dependencies": {
"@types/node": {
"version": "10.14.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz",
"integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==",
"version": "10.14.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz",
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==",
"dev": true
},
"semver": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz",
"integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==",
"dev": true
},
"tslint": {
"version": "5.16.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz",
"integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"builtin-modules": "^1.1.1",
"chalk": "^2.3.0",
"commander": "^2.12.1",
"diff": "^3.2.0",
"glob": "^7.1.1",
"js-yaml": "^3.13.0",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tsutils": "^2.29.0"
},
"dependencies": {
"semver": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
"dev": true
}
}
}
}
},
@@ -241,26 +276,45 @@
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"ts-node": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.1.0.tgz",
"integrity": "sha512-34jpuOrxDuf+O6iW1JpgTRDFynUZ1iEqtYruBqh35gICNjN8x+LpVcPAcwzLPi9VU6mdA3ym+x233nZmZp445A==",
"dev": true,
"requires": {
"arg": "^4.1.0",
"diff": "^3.1.0",
"make-error": "^1.1.1",
"source-map-support": "^0.5.6",
"yn": "^3.0.0"
}
}
}
},
"@openstapps/logger": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-0.1.0.tgz",
"integrity": "sha512-5z7Yf3WrzayEVNPp1TBoGiCVgPlQtqzOFh0yQ06gac/vFedWLPLBmENGDdRoEKar8bXzghkxDLy6Rvj/8HEQaQ==",
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-0.2.1.tgz",
"integrity": "sha512-6+F1nxEBuNTrd3hhBxKnvkH8B84HvB/dVmoMP9Pmv2g3mL3pYJ9l2BBGaACDRA7oUCyLpbNQw+4Kf+VdyzOttw==",
"dev": true,
"requires": {
"@types/node": "10.14.6",
"@types/nodemailer": "4.6.8",
"@types/node": "10.14.7",
"@types/nodemailer": "6.1.0",
"chalk": "2.4.2",
"flatted": "2.0.0",
"nodemailer": "6.1.1"
},
"dependencies": {
"@types/node": {
"version": "10.14.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz",
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==",
"dev": true
},
"@types/nodemailer": {
"version": "4.6.8",
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-4.6.8.tgz",
"integrity": "sha512-IX1P3bxDP1VIdZf6/kIWYNmSejkYm9MOyMEtoDFi4DVzKjJ3kY4GhOcOAKs6lZRjqVVmF9UjPOZXuQczlpZThw==",
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.1.0.tgz",
"integrity": "sha512-WysSJ4sGW2Aum1Cs6HFosZdlR3WUzX0XoSLsI53q77gLd4wDfE84OXffZu5/nLIjeKh4SwfTsdrKsgBL9WowMA==",
"dev": true,
"requires": {
"@types/node": "*"
@@ -368,9 +422,9 @@
"dev": true
},
"@types/node": {
"version": "10.14.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.6.tgz",
"integrity": "sha512-Fvm24+u85lGmV4hT5G++aht2C5I4Z4dYlWZIh62FAfFO/TfzXtPpoLI6I7AuBWkIFqZCnhFOoTT7RjjaIL5Fjg=="
"version": "10.14.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.8.tgz",
"integrity": "sha512-I4+DbJEhLEg4/vIy/2gkWDvXBOOtPKV9EnLhYjMoqxcRW+TTZtUftkHktz/a8suoD5mUL7m6ReLrkPvSsCQQmw=="
},
"@types/nodemailer": {
"version": "4.6.5",
@@ -692,6 +746,12 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"conditional-type-checks": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/conditional-type-checks/-/conditional-type-checks-1.0.1.tgz",
"integrity": "sha512-+O/IE/QGjXzdk4ttJFLRQm8pofQE0KZZmgcamquUGhHfaZt0UTZMlklqW0J9tWO8HQvC70cPahEAVMwSfeqtuQ==",
"dev": true
},
"conventional-changelog": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.8.tgz",
@@ -836,9 +896,9 @@
"dev": true
},
"conventional-changelog-writer": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.5.tgz",
"integrity": "sha512-g/Myp4MaJ1A+f7Ai+SnVhkcWtaHk6flw0SYN7A+vQ+MTu0+gSovQWs4Pg4NtcNUcIztYQ9YHsoxHP+GGQplI7Q==",
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.6.tgz",
"integrity": "sha512-ou/sbrplJMM6KQpR5rKFYNVQYesFjN7WpNGdudQSWNi6X+RgyFUcSv871YBYkrUYV9EX8ijMohYVzn9RUb+4ag==",
"dev": true,
"requires": {
"compare-func": "^1.3.1",
@@ -848,17 +908,9 @@
"json-stringify-safe": "^5.0.1",
"lodash": "^4.2.1",
"meow": "^4.0.0",
"semver": "^5.5.0",
"semver": "^6.0.0",
"split": "^1.0.0",
"through2": "^3.0.0"
},
"dependencies": {
"semver": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
"dev": true
}
}
},
"conventional-commits-filter": {
@@ -872,13 +924,13 @@
}
},
"conventional-commits-parser": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.0.2.tgz",
"integrity": "sha512-y5eqgaKR0F6xsBNVSQ/5cI5qIF3MojddSUi1vKIggRkqUTbkqFKH9P5YX/AT1BVZp9DtSzBTIkvjyVLotLsVog==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.0.3.tgz",
"integrity": "sha512-KaA/2EeUkO4bKjinNfGUyqPTX/6w9JGshuQRik4r/wJz7rUw3+D3fDG6sZSEqJvKILzKXFQuFkpPLclcsAuZcg==",
"dev": true,
"requires": {
"JSONStream": "^1.0.4",
"is-text-path": "^1.0.0",
"is-text-path": "^2.0.0",
"lodash": "^4.2.1",
"meow": "^4.0.0",
"split2": "^2.0.0",
@@ -1729,6 +1781,11 @@
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
"dev": true
},
"http-status-codes": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-1.3.2.tgz",
"integrity": "sha512-nDUtj0ltIt08tGi2VWSpSzNNFye0v3YSe9lX3lIqLTuVvvRiYCvs4QQBSHo0eomFYw1wlUuofurUAlTm+vHnXg=="
},
"humanize-string": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/humanize-string/-/humanize-string-2.1.0.tgz",
@@ -1884,12 +1941,12 @@
}
},
"is-text-path": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz",
"integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz",
"integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==",
"dev": true,
"requires": {
"text-extensions": "^1.0.0"
"text-extensions": "^2.0.0"
}
},
"is-utf8": {
@@ -3490,9 +3547,9 @@
}
},
"text-extensions": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz",
"integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.0.0.tgz",
"integrity": "sha512-F91ZqLgvi1E0PdvmxMgp+gcf6q8fMH7mhdwWfzXnl1k+GbpQDmi8l7DzLC5JTASKbwpY3TfxajAUzAXcv2NmsQ==",
"dev": true
},
"through": {
@@ -3561,16 +3618,24 @@
}
},
"ts-node": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.1.0.tgz",
"integrity": "sha512-34jpuOrxDuf+O6iW1JpgTRDFynUZ1iEqtYruBqh35gICNjN8x+LpVcPAcwzLPi9VU6mdA3ym+x233nZmZp445A==",
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.2.0.tgz",
"integrity": "sha512-m8XQwUurkbYqXrKqr3WHCW310utRNvV5OnRVeISeea7LoCWVcdfeB/Ntl8JYWFh+WRoUAdBgESrzKochQt7sMw==",
"dev": true,
"requires": {
"arg": "^4.1.0",
"diff": "^3.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.6",
"yn": "^3.0.0"
},
"dependencies": {
"diff": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
"integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==",
"dev": true
}
}
},
"ts-optchain": {
@@ -3585,9 +3650,9 @@
"dev": true
},
"tslint": {
"version": "5.16.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz",
"integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
"version": "5.17.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.17.0.tgz",
"integrity": "sha512-pflx87WfVoYepTet3xLfDOLDm9Jqi61UXIKePOuca0qoAZyrGWonDG9VTbji58Fy+8gciUn8Bt7y69+KEVjc/w==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@@ -3596,7 +3661,7 @@
"commander": "^2.12.1",
"diff": "^3.2.0",
"glob": "^7.1.1",
"js-yaml": "^3.13.0",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"resolve": "^1.3.2",
@@ -3631,9 +3696,9 @@
"dev": true
},
"tsutils": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.10.0.tgz",
"integrity": "sha512-q20XSMq7jutbGB8luhKKsQldRKWvyBO2BGqni3p4yq8Ys9bEP/xQw3KepKmMRt9gJ4lvQSScrihJrcKdKoSU7Q==",
"version": "3.13.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.13.0.tgz",
"integrity": "sha512-wRtEjVU8Su72sDIDoqno5Scwt8x4eaF0teKO3m4hu8K1QFPnIZMM88CLafs2tapUeWnY9SwwO3bWeOt2uauBcg==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
@@ -3696,15 +3761,15 @@
"dev": true
},
"typescript": {
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz",
"integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz",
"integrity": "sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==",
"dev": true
},
"uglify-js": {
"version": "3.5.12",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.12.tgz",
"integrity": "sha512-KeQesOpPiZNgVwJj8Ge3P4JYbQHUdZzpx6Fahy6eKAYRSV4zhVmLXoC+JtOeYxcHCHTve8RG1ZGdTvpeOUM26Q==",
"version": "3.5.14",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.14.tgz",
"integrity": "sha512-dgyjIw8KFK6AyVl5vm2tEqPewv5TKGEiiVFLI1LbF+oHua/Njd8tZk3lIbF1AWU1rNdEg7scaceADb4zqCcWXg==",
"dev": true,
"optional": true,
"requires": {
@@ -3868,12 +3933,12 @@
"dev": true
},
"yaml": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.5.0.tgz",
"integrity": "sha512-nKxSWOa7vxAP2pikrGxbkZsG/garQseRiLn9mIDjzwoQsyVy7ZWIpLoARejnINGGLA4fttuzRFFNxxbsztdJgw==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.6.0.tgz",
"integrity": "sha512-iZfse3lwrJRoSlfs/9KQ9iIXxs9++RvBFVzAqbbBiFT+giYtyanevreF9r61ZTbGMgWQBxAua3FzJiniiJXWWw==",
"dev": true,
"requires": {
"@babel/runtime": "^7.4.3"
"@babel/runtime": "^7.4.5"
}
},
"yargs": {

View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/core",
"version": "0.19.0",
"version": "0.21.0",
"description": "StAppsCore - Generalized model of data",
"keywords": [
"Model",
@@ -20,10 +20,13 @@
"compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
"pack": "openstapps-core-tools pack",
"postversion": "npm run changelog",
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
"tslint": "tslint 'src/**/*.ts'"
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
},
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"contributors": [
@@ -39,31 +42,33 @@
"dependencies": {
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/node": "10.14.6",
"@types/node": "10.14.8",
"fast-clone": "1.5.13",
"http-status-codes": "1.3.2",
"json-patch": "0.7.0",
"jsonschema": "1.2.4",
"ts-optchain": "0.1.3"
},
"devDependencies": {
"@krlwlfrt/async-pool": "0.1.0",
"@openstapps/configuration": "0.14.0",
"@openstapps/configuration": "0.18.0",
"@openstapps/core-tools": "0.6.0",
"@openstapps/logger": "0.1.0",
"@openstapps/logger": "0.2.1",
"@types/chai": "4.1.7",
"@types/rimraf": "2.0.2",
"chai": "4.2.0",
"commander": "2.20.0",
"conditional-type-checks": "1.0.1",
"conventional-changelog-cli": "2.0.21",
"mocha": "6.1.4",
"mocha-typescript": "1.1.17",
"nyc": "14.1.1",
"rimraf": "2.6.3",
"source-map-support": "0.5.12",
"ts-node": "8.1.0",
"tslint": "5.16.0",
"ts-node": "8.2.0",
"tslint": "5.17.0",
"typedoc": "0.14.2",
"typescript": "3.4.5"
"typescript": "3.5.1"
},
"nyc": {
"check-coverage": true,
@@ -75,7 +80,8 @@
"include": [
"src/core/Route.ts",
"src/core/Thing.ts",
"src/core/Translator.ts"
"src/core/Translator.ts",
"src/core/types/Guards.ts"
],
"exclude": [],
"extension": [
@@ -89,6 +95,9 @@
},
"openstappsConfiguration": {
"hasCli": false,
"ignoreCiEntries": [
"build"
],
"standardBuild": false,
"standardDocumentation": false
}

View File

@@ -42,7 +42,7 @@ import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/Video';
/**
* A map of things, from type to meta data
*/
export const SCClasses: { [K in SCThingType]: any } = {
export const SCClasses: { [K in SCThingType]: object } = {
/* tslint:enable */
'academic event': SCAcademicEventMeta,
'article': SCArticleMeta,

View File

@@ -48,7 +48,8 @@ export enum SCRouteHttpVerbs {
/**
* The constructor of an error response
*/
export type SCErrorResponseConstructor = new (...args: any) => SCErrorResponse;
// tslint:disable-next-line:no-any
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
/**
* A description of a route
@@ -94,19 +95,41 @@ export interface SCRoute {
* An abstract route
*/
export abstract class SCAbstractRoute implements SCRoute {
/**
* @see SCRoute.errorNames
*/
errorNames: SCErrorResponseConstructor[] = [];
/**
* @see SCRoute.method
*/
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
/**
* @see SCRoute.obligatoryParameters
*/
obligatoryParameters?: SCMap<string>;
/**
* @see SCRoute.requestBodyName
*/
requestBodyName = 'any';
/**
* @see SCRoute.responseBodyName
*/
responseBodyName = 'any';
/**
* @see SCRoute.statusCodeSuccess
*/
statusCodeSuccess = 200;
/**
* @see SCRoute.urlFragment
*/
urlFragment = '/';
public getUrlFragment(parameters?: SCMap<string>): string {
if (typeof parameters === 'undefined') {
parameters = {};
}
/**
* Get "compiled" URL fragment
*
* @param parameters Parameters to compile URL fragment with
*/
public getUrlFragment(parameters: SCMap<string> = {}): string {
let obligatoryParameters: string[] = [];
if (typeof this.obligatoryParameters === 'object') {
@@ -126,14 +149,13 @@ export abstract class SCAbstractRoute implements SCRoute {
const parameter = part.substr(1);
// @ts-ignore
if (typeof parameters[parameter] === 'undefined') {
throw new Error(`Parameter '${parameter}' not provided.`);
}
// @ts-ignore
return parameters[parameter];
}).join('/');
})
.join('/');
}
}

View File

@@ -54,22 +54,29 @@ export enum SCThingType {
export interface SCThingWithoutReferences {
/**
* Alternate names of the thing
*
* @keyword
*/
alternateNames?: string[];
/**
* Description of the thing
*
* @minLength 1
* @text
*/
description?: string;
/**
* URL of an image of the thing
*
* @keyword
*/
image?: string;
/**
* Name of the thing
*
* @minLength 1
* @sortable ducet
* @text
*/
name: string;
/**
@@ -80,6 +87,9 @@ export interface SCThingWithoutReferences {
translations?: SCTranslations<SCThingTranslatableProperties>;
/**
* Type of the thing
*
* @sortable ducet
* @aggregatable
*/
type: SCThingType;
/**
@@ -143,6 +153,8 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
/**
* Name of the origin
*
* @text
*/
name: string;
@@ -200,10 +212,14 @@ export interface SCThingUserOrigin extends SCThingOrigin {
export interface SCThingTranslatableProperties {
/**
* Translation of the description of the thing
*
* @text
*/
description?: string;
/**
* Translation of the name of the thing
*
* @text
*/
name?: string;
/**
@@ -218,6 +234,8 @@ export interface SCThingTranslatableProperties {
export interface SCThingTranslatablePropertyOrigin {
/**
* Translation of the name of the origin
*
* @text
*/
name: string;
}
@@ -271,14 +289,16 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
},
};
// tslint:disable:static-this
/**
* Function to retrieve typed singleton instance
*/
public static getInstance<T extends SCThingMeta>(): T {
if (!this._instance.has(this.name)) {
this._instance.set(this.name, new this());
if (!SCThingMeta._instance.has(this.name)) {
SCThingMeta._instance.set(this.name, new this());
}
return this._instance.get(this.name) as T;
return SCThingMeta._instance.get(this.name) as T;
}
protected constructor() {

View File

@@ -21,6 +21,9 @@ import {SCTranslations} from './types/i18n';
import clone = require('fast-clone');
import {Defined, OCType} from 'ts-optchain';
// tslint:disable:no-any
const standardCacheSize = 200;
/**
* SCThingTranslator class
*/
@@ -35,20 +38,19 @@ export class SCThingTranslator {
* Property representing the translators base language
* This means every translation is given for this language
*/
private cache: LRUCache<SCThing>;
private readonly cache: LRUCache<SCThing>;
/**
* Property providing a mapping from a SCThingType to its known own meta class
*/
private metaClasses: typeof SCClasses;
private readonly metaClasses: typeof SCClasses;
/**
* @constructor
* @example
* // returns translator instance for german
* new SCThingTranslator('de');
*/
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = 200) {
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = standardCacheSize) {
this.cache = new LRUCache(cacheCapacity);
this._language = language;
this.metaClasses = SCClasses;
@@ -79,16 +81,19 @@ export class SCThingTranslator {
* @param data The intermediate object / primitive returned by the Proxys get() method
* @returns an OCType<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): OCType<T> {
const proxy = new Proxy(
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
{
get: (target, key) => {
const obj: any = target();
return this.deeptranslate(obj[key]);
},
},
);
return proxy;
}
@@ -109,30 +114,34 @@ 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) => {
Object.keys(metaClass.fieldTranslations.en)
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
});
}
// Assigns every property in fieldTranslations to the known translation in given language
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldTranslations[language]).forEach((key) => {
Object.keys(metaClass.fieldTranslations[language])
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
});
}
return fieldTranslations;
}
/**
* Returns meta class needed for translations given a SCThingType
*
* @param thingType
* @param thingType Type of the thing
* @returns An instance of the metaclass
*/
private getMetaClassInstance(thingType: SCThingType): any {
if (thingType in this.metaClasses) {
return new (this.metaClasses as any)[thingType]();
}
return undefined;
}
@@ -151,10 +160,12 @@ export class SCThingTranslator {
return instance;
}
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldValueTranslations[language]).forEach((key) => {
Object.keys(metaClass.fieldValueTranslations[language])
.forEach((key) => {
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
// Assigns known translations of subproperties to property in given language (e.g. categories)
Object.keys((instance as any)[key]).forEach((subKey) => {
Object.keys((instance as any)[key])
.forEach((subKey) => {
(instance as any)[key][subKey] =
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
});
@@ -164,6 +175,7 @@ export class SCThingTranslator {
}
});
}
return instance;
}
@@ -192,6 +204,7 @@ export class SCThingTranslator {
}
const objTranslated = this.translateWholeThingDestructively(clone(obj));
this.cache.putObject(objTranslated);
return this.deeptranslate(objTranslated[key]);
},
},
@@ -204,13 +217,13 @@ export class SCThingTranslator {
* @example
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
* @param language The language the object is translated to
* @param thingType
* @param thingType Type of the thing
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
*/
public translatedPropertyNames<T extends SCThing>(thing: T,
language?: keyof SCTranslations<T>): T | undefined {
const targetLanguage = (language) ? language : this.language;
// return {...{}, ...this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T};
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
}
@@ -224,26 +237,29 @@ export class SCThingTranslator {
*/
public translateWholeThingDestructively(instance: any,
language?: keyof SCTranslations<any>): any {
const targetLanguage = (language) ? language : this.language;
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
let nextInstance = instance;
// Recursively call this function on all nested SCThings, arrays and objects
Object.keys(instance).forEach((key) => {
Object.keys(nextInstance)
.forEach((key) => {
if (
isThing((instance as any)[key]) ||
instance[key] instanceof Array ||
instance[key] instanceof Object) {
instance[key] = this.translateWholeThingDestructively(instance[key], targetLanguage);
isThing((nextInstance as any)[key]) ||
nextInstance[key] instanceof Array ||
nextInstance[key] instanceof Object) {
nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage);
}
});
// Spread variable translations given by the connector into thing
if (typeof instance.translations !== 'undefined') {
if (typeof instance.translations![targetLanguage] !== 'undefined') {
instance = {...instance, ...instance.translations![targetLanguage]} as typeof instance;
if (typeof nextInstance.translations !== 'undefined') {
if (typeof nextInstance.translations![targetLanguage] !== 'undefined') {
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as typeof instance;
}
}
// Spread known translations from meta classes into (partly) translated thing
this.replaceAvailableMetaFieldValueTranslations(instance, targetLanguage);
return instance;
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
return nextInstance;
}
}
@@ -256,15 +272,14 @@ class LRUCache<T> {
/**
* Map property that manages cached content
*/
private entries: Map<string, T> = new Map<string, T>();
private readonly entries: Map<string, T> = new Map<string, T>();
/**
* Property representing cache maximum capacity
*/
private maxEntries: number;
private readonly maxEntries: number;
/**
* @constructor
* @example
* // returns LRUCache instance with a maximum capacity of 500
* new LRUCache(500);
@@ -307,11 +322,12 @@ class LRUCache<T> {
}
const entry = this.entries.get(key);
if (entry) {
if (typeof entry !== 'undefined') {
// LRU behavior
this.entries.delete(key);
this.entries.set(key, entry);
}
return entry;
}
@@ -324,7 +340,8 @@ 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);

View File

@@ -28,12 +28,16 @@ export interface SCAcademicDegreeWithoutReferences
/**
* The achievable academic degree with academic field specification
* (eg. Master of Science)
*
* @keyword
*/
academicDegreewithField: string;
/**
* The achievable academic degree with academic field specification
* shorted (eg. M.Sc.).
*
* @keyword
*/
academicDegreewithFieldShort: string;
}
@@ -50,20 +54,22 @@ export interface SCAcademicDegree
* Meta information about academic degrees
*/
export class SCAcademicDegreeMeta
extends SCThingMeta
implements SCMetaTranslations<SCAcademicDegree> {
extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
academicDegree: 'Hochschulgrad',
academicDegreewithField: 'Abschlussbezeichnungen',
academicDegreewithFieldShort: 'Abschlussbezeichnungen (kurz)',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
academicDegree: 'academic degree',
academicDegreewithField: 'acedemic degree and discipline',
academicDegreewithFieldShort: 'acedemic degree and discipline (short)',
},
};
@@ -72,7 +78,7 @@ export class SCAcademicDegreeMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
academicDegree: {
'bachelor': 'Bachelor',
'diploma': 'Diplom',
@@ -85,7 +91,7 @@ export class SCAcademicDegreeMeta
},
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
}

View File

@@ -23,6 +23,9 @@ export interface SCAcademicTermWithoutReferences
extends SCThingWithoutReferences {
/**
* Short name of the academic term, using the given pattern
*
* @aggregatable
* @keyword
*/
acronym: string;
@@ -65,10 +68,20 @@ export class SCAcademicTermWithoutReferencesMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
acronym: 'Akronym',
endDate: 'Enddatum',
eventsEndDate: 'Enddatum der Veranstaltungen',
eventsStartDate: 'Startdatum der Veranstaltungen',
startDate: 'Startdatum',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
acronym: 'acronym',
endDate: 'end date',
eventsEndDate: 'end date of events',
eventsStartDate: 'start date of events',
startDate: 'start date',
},
};
@@ -77,10 +90,10 @@ export class SCAcademicTermWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
}

View File

@@ -20,6 +20,7 @@ import {SCISO8601Date} from '../types/Time';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './ThingThatCanBeOffered';
@@ -41,6 +42,9 @@ export interface SCCreativeWorkWithoutReferences
/**
* Keywords of the creative work
*
* @aggregatable
* @keyword
*/
keywords?: string[];
@@ -78,6 +82,8 @@ export interface SCCreativeWorkTranslatableProperties
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translation of the keywords of the creative work
*
* @keyword
*/
keywords?: string[];
}
@@ -92,10 +98,22 @@ export class SCCreativeWorkMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
authors: 'Authoren',
datePublished: 'Veröffentlichungsdatum',
inLanguages: 'verfügbare Übersetzungen',
keywords: 'Schlagwörter',
publishers: 'Verleger',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
authors: 'authors',
datePublished: 'release date',
inLanguages: 'available Languages',
keywords: 'keywords',
publishers: 'publishers',
},
};
@@ -104,10 +122,12 @@ export class SCCreativeWorkMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
},
};
}

View File

@@ -28,6 +28,8 @@ export interface SCEventWithoutReferences
* Maximum number of participants of the event
*
* A maximum number of people that can participate in the event.
*
* @integer
*/
maximumParticipants?: number;
@@ -35,6 +37,8 @@ export interface SCEventWithoutReferences
* Remaining attendee capacity of the event
*
* This number represents the remaining open spots.
*
* @integer
*/
remainingAttendeeCapacity?: number;
}
@@ -82,10 +86,24 @@ export class SCEventMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
academicTerms: 'Semester',
catalogs: 'Verzeichnis',
creativeWorks: 'begleitende Werke',
maximumParticipants: 'maximale Anzahl an Teilnehmern',
organizers: 'Origanisatoren',
performers: 'Vortragende',
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
academicTerms: 'academic terms',
catalogs: 'catalogs',
creativeWorks: 'related material',
maximumParticipants: 'maximum participants',
organizers: 'organizers',
performers: 'performers',
remainingAttendeeCapacity: 'remaining attendee capacity',
},
};
@@ -94,10 +112,10 @@ export class SCEventMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
}

View File

@@ -37,7 +37,9 @@ export interface SCPlaceWithoutReferences
/**
* Opening hours of the place
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/
openingHours?: string;
@@ -63,6 +65,9 @@ export interface SCPlace
*/
export interface SCPlaceWithoutReferencesTranslatableProperties
extends SCThingTranslatableProperties {
/**
* Address of a place
*/
address?: SCPostalAddress;
}
@@ -76,10 +81,16 @@ export class SCPlaceWithoutReferencesMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
address: 'Adresse',
geo: 'Geoinformation',
openingHours: 'Öffnungszeiten',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
address: 'address',
geo: 'geographic information',
openingHours: 'opening hours',
},
};
@@ -88,10 +99,10 @@ export class SCPlaceWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
}

View File

@@ -34,11 +34,11 @@ export class SCThingInPlaceMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
inPlace: 'Ort',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
inPlace: 'location',
},
};
@@ -48,10 +48,10 @@ export class SCThingInPlaceMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
}

View File

@@ -19,9 +19,9 @@ import {SCMetaTranslations} from '../types/i18n';
* Types of payment that are accepted at a place.
*/
export type SCThingThatAcceptsPaymentsAcceptedPayments =
'Cash'
| 'Credit'
| 'Cafeteria Card';
'cash'
| 'credit'
| 'cafeteria card';
/**
* A thing without references that accepts payments
@@ -52,10 +52,12 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
paymentsAccepted: 'Bezahlmethoden',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
paymentsAccepted: 'accepted payment methods',
},
};
@@ -64,10 +66,15 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
paymentsAccepted: {
'cafeteria card': 'Mensakarte',
'cash': 'Bar',
'credit': 'Kreditkarte',
},
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
}

View File

@@ -12,10 +12,10 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCTranslations} from '../types/i18n';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
import {SCISO8601Date} from '../types/Time';
@@ -25,6 +25,9 @@ import {SCISO8601Date} from '../types/Time';
export interface SCPriceGroup {
/**
* Default price of the thing
*
* @sortable price
* @float
*/
default: number;
}
@@ -36,16 +39,25 @@ export interface SCAcademicPriceGroup
extends SCPriceGroup {
/**
* Price for employees
*
* @sortable price
* @float
*/
employee?: number;
/**
* Price for guests
*
* @sortable price
* @float
*/
guest?: number;
/**
* Price for students
*
* @sortable price
* @float
*/
student?: number;
}
@@ -115,6 +127,8 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
extends SCThingTranslatableProperties {
/**
* Availability of an offer
*
* @keyword
*/
'offers[].availability'?: string;
}
@@ -134,3 +148,55 @@ export type SCThingThatCanBeOfferedAvailability =
| 'out of stock'
| 'online only'
| 'limited availability';
/**
* Meta information about a thing without references that accepts payments
*/
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
SCMetaTranslations<SCThingThatCanBeOffered<T>> {
/**
* Instance
*/
protected static _instance = new Map<string, unknown>();
/**
* Translations of fields
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance().fieldTranslations.de,
offers: 'Angebote',
},
en: {
... SCThingMeta.getInstance().fieldTranslations.en,
offers: 'offers',
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
// tslint:disable:static-this
/**
* Function to retrieve typed singleton instance (including generics)
*/
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
if (!SCThingThatCanBeOfferedMeta._instance.has(this.name)) {
SCThingThatCanBeOfferedMeta._instance.set(this.name, new SCThingThatCanBeOfferedMeta<T>());
}
return SCThingThatCanBeOfferedMeta._instance
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
}
protected constructor() {}
}

View File

@@ -20,12 +20,15 @@ import {SCMap} from '../types/Map';
* A thing without references with categories
*
* !!! BEWARE !!!
* `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
* `T` should be a string literal union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
*/
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
extends SCThingWithoutReferences {
/**
* Categories of a thing with categories
*
* @sortable ducet
* @aggregatable
*/
categories: T[];
@@ -72,47 +75,65 @@ export interface SCThingWithCategoriesTranslatableProperties
export interface SCThingWithCategoriesSpecificValues {
/**
* Category specific alternate names of a thing
*
* @keyword
*/
alternateNames?: string[];
/**
* Category specific description of a thing
*
* @text
*/
description?: string;
/**
* URL of a category specific image of a thing
*
* @keyword
*/
image?: string;
/**
* Category specific name of a thing
*
* @text
*/
name?: string;
/**
* Category specific URL of a thing
*
* @keyword
*/
url?: string;
}
/**
* Meta information about a thing without references that accepts payments
* It intentionally does not extend the SCThingMeta implementation to be able to include generics.
*/
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
protected static _instance: SCThingMeta;
/**
* Instance
*/
protected static _instance = new Map<string, unknown>();
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
categories: 'Kategorien',
categorySpecificValues: 'besondere Kategorien',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
categories: 'categories',
categorySpecificValues: 'category with specific values',
},
};
@@ -121,18 +142,25 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
// tslint:disable:static-this
/**
* Function to retrieve typed singleton instance (including generics)
*/
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
return this._instance || (this._instance = new this<T, U>());
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
SCThingWithCategoriesWithoutReferencesMeta._instance
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
}
return SCThingWithCategoriesWithoutReferencesMeta._instance
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
}
protected constructor() {

View File

@@ -12,7 +12,16 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {
BAD_GATEWAY,
BAD_REQUEST, CONFLICT, INTERNAL_SERVER_ERROR,
METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, NOT_FOUND,
REQUEST_TOO_LONG,
TOO_MANY_REQUESTS,
UNSUPPORTED_MEDIA_TYPE,
} from 'http-status-codes';
import {ValidationError} from 'jsonschema';
import {SCPluginMetaData} from '../routes/plugin/PluginRegisterRequest';
/**
* A generic error that can be returned by the backend if somethings fails during the processing of a request
@@ -23,7 +32,7 @@ export interface SCErrorResponse extends Error {
/**
* Additional data that describes the error
*/
additionalData?: any;
additionalData?: unknown;
/**
* HTTP status code to return this error with
@@ -48,7 +57,7 @@ export abstract class SCError implements SCErrorResponse {
* @param statusCode HTTP status code to return this error with
* @param stack Set to true if a stack trace should be created
*/
constructor(public name: string, public message: string, public statusCode: number, stack?: boolean) {
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
// generate stacktrace if needed
if (stack) {
this.stack = (new Error()).stack;
@@ -72,7 +81,7 @@ export class SCValidationErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(errors: ValidationError[], stack?: boolean) {
super('ValidationError', 'Validation of request failed', 400, stack);
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
this.additionalData = errors;
}
}
@@ -87,7 +96,7 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('UnsupportedMediaTypeError', 'Unsupported media type', 415, stack);
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
}
}
@@ -101,7 +110,7 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', 405, stack);
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
}
}
@@ -111,10 +120,11 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
export class SCRequestBodyTooLargeErrorResponse extends SCError {
/**
* Create a SCRequestBodyTooLargeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('RequestBodyTooLargeError', 'The request body is too large.', 413, stack);
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
}
}
@@ -128,7 +138,12 @@ export class SCTooManyRequestsErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('TooManyRequestsError', 'Too many requests. You can not submit more than 5 queries an once', 429, stack);
super(
'TooManyRequestsError',
'Too many requests. You can not submit more than 5 queries an once',
TOO_MANY_REQUESTS,
stack,
);
}
}
@@ -142,7 +157,7 @@ export class SCNotFoundErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('NotFoundError', 'Resource not found', 404, stack);
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
}
}
@@ -158,7 +173,7 @@ export class SCParametersNotAcceptable extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('ParametersNotAcceptable', message, 406, stack);
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
}
}
@@ -169,13 +184,23 @@ export class SCParametersNotAcceptable extends SCError {
*/
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
/**
* Create a PluginAlreadyRegisteredError
* Meta data of a registered plugin, which is in a conflict with the plugin we want to register.
* If the stack is disabled this is not set for security reasons
*/
additionalData?: SCPluginMetaData;
/**
* Create a SCPluginAlreadyRegisteredError
*
* @param message contains potential differences in other parameters outside of the name
* @param message Provide further information why an already registered plugin matches the one we want to register
* @param plugin Provides meta data of a registered plugin, which is in a conflict with the plugin we want to register
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('PluginRegisteringFailedError', message, 409, stack);
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
if (stack) {
this.additionalData = plugin;
}
}
}
@@ -190,26 +215,7 @@ export class SCPluginRegisteringFailedErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('PluginRegisteringFailedError', message, 500, stack);
}
}
/**
* An error that is returned whenever there is a plugin request that is supposed to register a route, that is already
* registered
* This usually indicates that two **different** plugins use the same route.
*/
export class SCPluginRouteAlreadyRegisteredErrorResponse extends SCError {
/**
* Create a PluginRouteAlreadyRegisteredError
*
* @param registeredName The name by the plugin that has already registered the route previously
* @param registeredUrl The URL by the plugin that has already registered the route previously
* @param stack Set to true if a stack trace should be created
*/
constructor(registeredName: string, registeredUrl: string, stack?: boolean) {
super('PluginRouteAlreadyRegisteredError',
`Already registered by "${registeredName}" under URL "${registeredUrl}".`, 409, stack);
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
}
}
@@ -224,7 +230,7 @@ export class SCSyntaxErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('SyntaxError', message, 400, stack);
super('SyntaxError', message, BAD_REQUEST, stack);
}
}
@@ -241,11 +247,11 @@ export class SCInternalServerErrorResponse extends SCError {
* Create a SCInternalServerErrorResponse
*
* @param err Internal server error
* @param stack Set to true if a stack trace should be created
* @param stack Set to true if a stack trace should be created
* and the internal server error should be displayed to the client
*/
constructor(err?: Error, stack?: boolean) {
super('InternalServerError', 'Internal server error', 502, stack);
constructor(err?: Error, stack = false) {
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
if (stack) {
this.additionalData = err;

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {
SCInternalServerErrorResponse,
@@ -47,7 +48,7 @@ export class SCIndexRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCIndexRequest';
this.responseBodyName = 'SCIndexResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/';
}
}

View File

@@ -21,7 +21,13 @@ import {SCBackendConfiguration} from '../../../types/config/Backend';
* @validatable
*/
export interface SCIndexResponse {
/**
* @see SCAppConfiguration
*/
app: SCAppConfiguration;
/**
* @see SCBackendConfiguration
*/
backend: SCBackendConfiguration;
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCThings} from '../../../../Classes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
import {
@@ -53,7 +54,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
};
this.requestBodyName = 'SCThingUpdateRequest';
this.responseBodyName = 'SCThingUpdateResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/:TYPE/:UID';
}
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCUuid} from '../../../types/UUID';
import {
@@ -26,6 +27,7 @@ import {
/**
* Request to check the availability of books
*
* @validatable
*/
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
@@ -80,7 +82,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCBookAvailabilityRequest';
this.responseBodyName = 'SCBookAvailabilityResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/bookAvailability';
}
}

View File

@@ -16,6 +16,7 @@ import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/
/**
* List of availabilities of a book
*
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCThingType} from '../../../Thing';
import {SCISO8601Date} from '../../../types/Time';
@@ -78,7 +79,7 @@ export class SCBulkRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCBulkRequest';
this.responseBodyName = 'SCBulkResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/bulk';
}
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {CREATED} from 'http-status-codes';
import {SCThings} from '../../../../Classes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
import {
@@ -26,6 +27,7 @@ import {
/**
* Request to add a thing to a bulk
*
* @validatable
*/
export type SCBulkAddRequest = SCThings;
@@ -51,7 +53,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
};
this.requestBodyName = 'SCBulkAddRequest';
this.responseBodyName = 'SCBulkAddResponse';
this.statusCodeSuccess = 201;
this.statusCodeSuccess = CREATED;
this.urlFragment = '/bulk/:UID';
}
}

View File

@@ -14,6 +14,7 @@
*/
/**
* Response to a request to add a thing to a bulk
*
* @validatable
*/
export interface SCBulkAddResponse {

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {NO_CONTENT} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
import {
SCInternalServerErrorResponse,
@@ -25,6 +26,7 @@ import {
/**
* Request to change the bulk state to done (close the bulk process)
*
* @validatable
*/
export interface SCBulkDoneRequest {
@@ -51,7 +53,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
};
this.requestBodyName = 'SCBulkDoneRequest';
this.responseBodyName = 'SCBulkDoneResponse';
this.statusCodeSuccess = 204;
this.statusCodeSuccess = NO_CONTENT;
this.urlFragment = '/bulk/:UID/done';
}
}

View File

@@ -14,6 +14,7 @@
*/
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {NO_CONTENT} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCMessage} from '../../../things/Message';
import {
@@ -52,7 +53,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCFeedbackRequest';
this.responseBodyName = 'SCFeedbackResponse';
this.statusCodeSuccess = 204;
this.statusCodeSuccess = NO_CONTENT;
this.urlFragment = '/feedback';
}
}
@@ -74,7 +75,7 @@ export interface SCFeedbackRequestMetaData {
/**
* Scope/app state at feedback invocation
*/
scope: any;
scope: unknown;
/**
* Whether or not the feedback is sendable
@@ -84,7 +85,7 @@ export interface SCFeedbackRequestMetaData {
/**
* App state that feedback was invoked from
*/
state: any;
state: unknown;
/**
* User agent

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {Schema} from 'jsonschema';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {
@@ -19,7 +20,6 @@ import {
SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable,
SCPluginAlreadyRegisteredErrorResponse,
SCPluginRegisteringFailedErrorResponse,
SCPluginRouteAlreadyRegisteredErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
} from '../../errors/ErrorResponse';
@@ -103,14 +103,13 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
SCParametersNotAcceptable,
SCPluginAlreadyRegisteredErrorResponse,
SCPluginRegisteringFailedErrorResponse,
SCPluginRouteAlreadyRegisteredErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCPluginRegisterRequest';
this.responseBodyName = 'SCPluginRegisterResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/plugin/register';
}
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCMap} from '../../../types/Map';
import {
@@ -54,7 +55,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCMultiSearchRequest';
this.responseBodyName = 'SCMultiSearchResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/search/multi';
}
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCSearchContext} from '../../../types/config/Backend';
import {SCSearchFilter} from '../../../types/filters/Abstract';
@@ -85,7 +86,7 @@ export class SCSearchRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCSearchRequest';
this.responseBodyName = 'SCSearchResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = OK;
this.urlFragment = '/search';
}
}

View File

@@ -31,11 +31,16 @@ export interface SCAcademicEventWithoutReferences
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
/**
* Majors of the academic event that this event belongs to
*
* @aggregatable
* @keyword
*/
majors?: string[];
/**
* Original unmapped category from the source of the academic event
*
* @keyword
*/
originalCategory?: string;
@@ -54,6 +59,7 @@ export interface SCAcademicEventWithoutReferences
* An academic event
*
* @validatable
* @indexable
*/
export interface SCAcademicEvent
extends SCEvent, SCAcademicEventWithoutReferences,
@@ -77,6 +83,7 @@ export type SCAcademicEventCategories =
| 'seminar'
| 'integrated course'
| 'written exam'
| 'oral exam'
| 'tutorial'
| 'project'
| 'colloquium'
@@ -94,11 +101,15 @@ export interface SCAcademicEventTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties {
/**
* Translations of the majors of the academic event that this event belongs to
*
* @keyword
*/
majors?: string[];
/**
* Translation of the original unmapped category from the source of the academic event
*
* @keyword
*/
originalCategory?: string;
}
@@ -114,14 +125,22 @@ export class SCAcademicEventMeta
*/
fieldTranslations = {
de: {
...SCEventMeta.getInstance().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
majors: 'Hauptfächer',
originalCategory: 'ursprüngliche Kategorie',
},
en: {
...SCEventMeta.getInstance().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
majors: 'majors',
originalCategory: 'original category',
},
};
@@ -130,15 +149,35 @@ export class SCAcademicEventMeta
*/
fieldValueTranslations = {
de: {
...SCEventMeta.getInstance().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
'colloquium': 'Kolloquium',
'course': 'Kurs',
'excursion': 'Exkursion',
'integrated course': '',
'introductory class': 'Einführungsveranstaltung',
'lecture': 'Vorlesung',
'oral exam': 'mündliche Prüfung',
'practicum': 'Praktikum',
'practicum introduction': 'Einführungspraktikum',
'project': 'Projekt',
'seminar': 'Seminar',
'special': 'Sonderveranstalltung',
'tutorial': 'Tutorium',
'written exam': 'Schriftilche Prüfung',
},
type: 'akademische Veranstaltung',
},
en: {
...SCEventMeta.getInstance().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.AcademicEvent,
},
};

View File

@@ -36,6 +36,8 @@ export interface SCArticleWithoutReferences
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
/**
* Article itself as markdown
*
* @text
*/
articleBody: string;
@@ -54,6 +56,7 @@ export interface SCArticleWithoutReferences
* An article
*
* @validatable
* @indexable
*/
export interface SCArticle
extends SCCreativeWork, SCArticleWithoutReferences,
@@ -81,6 +84,8 @@ export interface SCArticleTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of the article itself as markdown
*
* @text
*/
articleBody?: string[];
}
@@ -95,14 +100,22 @@ export class SCArticleMeta
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
articleBody: 'Artikelinhalt',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
articleBody: 'article body',
},
};
@@ -111,15 +124,24 @@ export class SCArticleMeta
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
'unipedia': 'Unipedia',
},
type: 'Artikel',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Article,
},
};

View File

@@ -30,16 +30,22 @@ export interface SCBookWithoutReferences
extends SCCreativeWorkWithoutReferences {
/**
* Edition of a book
*
* @keyword
*/
bookEdition?: string;
/**
* ISBN of a book
*
* @keyword
*/
isbn: string;
/**
* Number of pages of a book
*
* @integer
*/
numberOfPages?: number;
@@ -58,6 +64,7 @@ export interface SCBookWithoutReferences
* A book
*
* @validatable
* @indexable
*/
export interface SCBook
extends SCCreativeWork, SCBookWithoutReferences {
@@ -84,6 +91,8 @@ export interface SCBookTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of an edition of a book
*
* @keyword
*/
bookEdition?: string;
}
@@ -97,10 +106,18 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
bookEdition: 'Buchausgabe',
isbn: 'ISBN',
numberOfPages: 'Seitenzahl',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
bookEdition: 'book edition',
isbn: 'ISBN',
numberOfPages: 'number of pages',
},
};
@@ -109,11 +126,13 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
type: 'Buch',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
type: SCThingType.Book,
},
};

View File

@@ -43,11 +43,16 @@ export interface SCBuildingWithoutReferences
SCPlaceWithoutReferences {
/**
* Categories of a building
*
* @sortable ducet
* @aggregatable
*/
categories: SCBuildingCategories[];
/**
* List of floor names of the place
*
* @keyword
*/
floors?: string[];
@@ -66,6 +71,7 @@ export interface SCBuildingWithoutReferences
* A building
*
* @validatable
* @indexable
*/
export interface SCBuilding
extends SCBuildingWithoutReferences, SCPlace,
@@ -83,6 +89,9 @@ export interface SCBuilding
export interface SCBuildingTranslatableProperties
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
/**
* @see SCBuilding.floors
*/
floors?: string[];
}
@@ -97,15 +106,24 @@ export class SCBuildingMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
floors: 'Etagen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
floors: 'floors',
},
};
@@ -114,9 +132,13 @@ export class SCBuildingMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
@@ -130,9 +152,13 @@ export class SCBuildingMeta
type: 'Gebäude',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
type: SCThingType.Building,
},
};

View File

@@ -32,6 +32,8 @@ export interface SCCatalogWithoutReferences
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
*
* Needed for keeping order in catalog inheritance array.
*
* @integer
*/
level: number;
@@ -44,7 +46,8 @@ export interface SCCatalogWithoutReferences
/**
* A catalog
*
* @validatable
* @validatable
* @indexable
*/
export interface SCCatalog
extends SCCatalogWithoutReferences, SCThing,
@@ -85,12 +88,24 @@ export class SCCatalogMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
academicTerm: 'Semester',
level: 'Ebene',
superCatalog: 'übergeordnetes Verzeichniss',
superCatalogs: 'übergeordnete Verzeichnisse',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
academicTerm: 'academic term',
level: 'level',
superCatalog: 'parent catalog',
superCatalogs: 'parent catalogs',
},
};
@@ -99,13 +114,20 @@ export class SCCatalogMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
'university events': 'Universitätsveranstaltung',
},
type: 'Verzeichnis',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Catalog,
},
};

View File

@@ -16,6 +16,7 @@ import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReference
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
@@ -37,6 +38,8 @@ export interface SCCourseOfStudiesWithoutReferences
/**
* Actual major of the course of studies (eg. physics)
*
* @keyword
*/
major: string;
@@ -65,6 +68,7 @@ export interface SCCourseOfStudiesWithoutReferences
* A course of studies
*
* @validatable
* @indexable
*/
export interface SCCourseOfStudies
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
@@ -114,10 +118,30 @@ export class SCCourseOfStudiesMeta
*/
fieldTranslations = {
de: {
...SCAcademicDegreeMeta.getInstance().fieldTranslations.de,
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
.fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
department: 'Fachbereich',
mainLanguage: 'Unterrichtssprache',
major: 'Studienfach',
mode: 'Studiengangsart',
secretary: 'Sekretariat',
startDates: 'Startdatum',
timeMode: 'Zeitmodell',
},
en: {
...SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
.fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
department: 'department',
mainLanguage: 'main language',
major: 'major',
mode: 'mode',
secretary: 'secretary',
startDates: 'start dates',
timeMode: 'time mode',
},
};
@@ -129,7 +153,11 @@ export class SCCourseOfStudiesMeta
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
modes: {
combination: 'Kombinationsstudiengang',
dual: 'Dualer Studiengang',
'double-degree': 'Doppelstudium',
dual: 'duales Studium',
standard: 'Studium',
},
timeMode: {
fulltime: 'Vollzeitstudiengang',
parttime: 'Teilzeitstudiengang',
},
@@ -137,11 +165,16 @@ export class SCCourseOfStudiesMeta
},
en: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
academicDegree: 'Hochschulabschluss',
department: 'Fachbereich',
major: 'Studienfach',
modes: 'Studiengangsarten',
secretary: 'Sekretariat',
modes: {
combination: 'combination course of studies',
'double-degree': 'double degree course of studies',
dual: 'dual course of studies',
standard: 'course of studies',
},
timeMode: {
fulltime: 'full-time',
parttime: 'part-time',
},
type: SCThingType.CourseOfStudies,
},
};

View File

@@ -22,6 +22,7 @@ import {
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date, SCISO8601Duration} from '../types/Time';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCPersonWithoutReferences} from './Person';
import {SCSportCourseWithoutReferences} from './SportCourse';
@@ -33,6 +34,8 @@ export interface SCSportCoursePriceGroup
extends SCAcademicPriceGroup {
/**
* Price for alumnis
*
* @float
*/
alumni?: number;
}
@@ -59,6 +62,8 @@ export interface SCDateSeriesWithoutReferences
/**
* Frequency of the date series
*
* @keyword
*/
frequency: string;
@@ -77,6 +82,7 @@ export interface SCDateSeriesWithoutReferences
* A date series
*
* @validatable
* @indexable
*/
export interface SCDateSeries
extends SCDateSeriesWithoutReferences,
@@ -115,10 +121,28 @@ export class SCDateSeriesMeta
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldTranslations.de,
dates: 'Einzeltermine',
duration: 'Dauer',
event: 'Event',
exceptions: 'Ausnahmen',
frequency: 'Frequenz',
performers: 'Vortragende',
},
en: {
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldTranslations.en,
dates: 'dates',
duration: 'duration',
event: 'event',
exceptions: 'exceptions',
frequency: 'frequency',
performers: 'performers',
},
};
@@ -127,14 +151,17 @@ export class SCDateSeriesMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
dates: 'Einzeltermine',
duration: 'Dauer',
frequency: 'Wiederholung',
type: 'Wiederholungreihe',
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldValueTranslations.de,
type: 'Terminserie',
},
en: {
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
.fieldValueTranslations.en,
type: SCThingType.DateSeries,
},
};
@@ -145,5 +172,8 @@ export class SCDateSeriesMeta
*/
export interface SCDateSeriesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
/**
* @see SCDateSeriesWithoutReferences.frequency
*/
frequency?: string;
}

View File

@@ -48,6 +48,7 @@ export interface SCDiffWithoutReferences
* A diff
*
* @validatable
* @indexable
*/
export interface SCDiff
extends SCDiffWithoutReferences, SCThing {
@@ -73,13 +74,18 @@ export class SCDiffMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
action: 'Aktion',
changes: 'Änderungen',
dateCreated: 'Erstellungsdatum',
object: 'Objekt',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
action: 'action',
changes: 'changes',
dateCreated: 'date created',
object: 'object',
},
};
@@ -89,6 +95,10 @@ export class SCDiffMeta
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
action: {
'changed': 'geändert',
'removed': 'gelöscht',
},
type: 'Unterschied',
},
en: {

View File

@@ -27,6 +27,7 @@ import {
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
/**
* A dish without references
@@ -36,11 +37,16 @@ export interface SCDishWithoutReferences
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
/**
* Additives of the dish
*
* @keyword
*/
additives?: string[];
/**
* Category of the dish
*
* @sortable ducet
* @aggregatable
*/
categories: SCDishCategories[];
@@ -69,6 +75,7 @@ export interface SCDishWithoutReferences
* A dish
*
* @validatable
* @indexable
*/
export interface SCDish
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
@@ -103,11 +110,15 @@ export interface SCDishTranslatableProperties
export interface SCDishCharacteristic {
/**
* URL of an image of the characteristic
*
* @keyword
*/
image?: string;
/**
* Name of the characteristic
*
* @text
*/
name: string;
}
@@ -131,36 +142,50 @@ export type SCDishCategories =
export interface SCNutritionInformation {
/**
* Number of calories contained (in kcal)
*
* @float
*/
calories?: number;
/**
* Content of carbohydrates (in grams)
*
* @float
*/
carbohydrateContent?: number;
/**
* Content of fat (in grams)
*
* @float
*/
fatContent?: number;
/**
* Content of proteins (in grams)
*
* @float
*/
proteinContent?: number;
/**
* Content of salt (in grams)
*
* @float
*/
saltContent?: number;
/**
* Content of saturated fat (in grams)
*
* @float
*/
saturatedFatContent?: number;
/**
* Content of sugar (in grams)
*
* @float
*/
sugarContent?: number;
}
@@ -176,12 +201,28 @@ export class SCDishMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
additives: 'Zusatzstoffe',
characteristics: 'Merkmale',
dishAddOns: 'Beilagen',
nutrition: 'Nährwertangaben',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.en,
additives: 'additives',
characteristics: 'characteristics',
dishAddOns: 'side dishes',
nutrition: 'nutrition information',
},
};
@@ -190,8 +231,12 @@ export class SCDishMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.de,
categories: {
appetizer: 'Vorspeise',
dessert: 'Nachtisch',
@@ -203,8 +248,12 @@ export class SCDishMeta
type: 'Essen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.en,
type: SCThingType.Dish,
},
};

View File

@@ -49,6 +49,7 @@ export interface SCFavoriteWithoutReferences
* A favorite
*
* @validatable
* @indexable
*/
export interface SCFavorite
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
@@ -26,13 +27,15 @@ export interface SCFloorWithoutReferences
extends SCThingWithoutReferences {
/**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
*
* @text
*/
floorName: string;
/**
* Floor plan
*/
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
plan: SCFloorFeatureCollectionWithPlaces<LineString>;
/**
* Translated fields of a floor
@@ -49,6 +52,7 @@ export interface SCFloorWithoutReferences
* A floor
*
* @validatable
* @indexable
*/
export interface SCFloor
extends SCFloorWithoutReferences, SCThingInPlace {
@@ -66,19 +70,19 @@ export interface SCFloor
/**
* A feature collection
*/
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
extends FeatureCollection<T, P> {
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
extends FeatureCollection<T> {
/**
* Features of the collection
*/
features: Array<SCFloorFeatureWithPlace<T, P>>;
features: Array<SCFloorFeatureWithPlace<T>>;
}
/***
* A feature with a place
*/
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
extends Feature<T, P> {
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
extends Feature<T> {
/**
* The place of the feature
*/
@@ -92,6 +96,8 @@ export interface SCFloorTranslatableProperties
extends SCThingTranslatableProperties {
/**
* Translation of the floor name
*
* @text
*/
floorName?: string;
}
@@ -107,10 +113,16 @@ export class SCFloorMeta
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
floorName: 'Etagenbezeichnung',
plan: 'Grundriss',
},
en: {
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
floorName: 'floor name',
plan: 'plan',
},
};
@@ -119,11 +131,13 @@ export class SCFloorMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
type: 'Etage',
},
en: {
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
type: SCThingType.Floor,
},
};

View File

@@ -40,8 +40,10 @@ export interface SCMessageWithoutReferences
/**
* Message itself
*
* @text
*/
message: string;
messageBody: string;
/**
* Translated fields of a message
@@ -58,6 +60,7 @@ export interface SCMessageWithoutReferences
* A message
*
* @validatable
* @indexable
*/
export interface SCMessage
extends SCCreativeWork, SCMessageWithoutReferences {
@@ -87,8 +90,10 @@ export interface SCMessageTranslatableProperties
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/**
* Message itself
*
* @text
*/
message?: string;
messageBody?: string;
}
/**
@@ -102,10 +107,18 @@ export class SCMessageMeta
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
audiences: 'Zielgruppen',
dateCreated: 'Erstellungsdatum',
messageBody: 'Nachrichteninhalt',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
audiences: 'audiences',
dateCreated: 'date created',
messageBody: 'message body',
},
};
@@ -114,11 +127,18 @@ export class SCMessageMeta
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
audiences: {
'employees': 'Angestellte',
'guests': 'Gäste',
'students': 'Studenten',
},
type: 'Nachricht',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
type: SCThingType.Message,
},
};

View File

@@ -12,8 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingInPlace} from '../base/ThingInPlace';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
/**
* An organization without references
@@ -30,6 +31,7 @@ export interface SCOrganizationWithoutReferences
* An organization
*
* @validatable
* @indexable
*/
export interface SCOrganization
extends SCOrganizationWithoutReferences, SCThingInPlace {
@@ -42,5 +44,31 @@ export interface SCOrganization
/**
* Meta information about an organization
*/
export class SCOrganizationMeta extends SCThingMeta {
export class SCOrganizationMeta
extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.de,
type: 'Einrichtung',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.en,
type: SCThingType.Organization,
},
};
}

View File

@@ -27,6 +27,8 @@ export interface SCPersonWithoutReferences
extends SCThingWithoutReferences {
/**
* Additional first names of the person.
*
* @keyword
*/
additionalName?: string;
@@ -39,16 +41,22 @@ export interface SCPersonWithoutReferences
* The private email address of the person.
*
* @TJS-format email
*
* @keyword
*/
email?: string;
/**
* The family name of the person.
*
* @keyword
*/
familyName: string;
/**
* The private fax number of the person.
*
* @keyword
*/
faxNumber?: string;
@@ -59,26 +67,36 @@ export interface SCPersonWithoutReferences
/**
* The first name of the person.
*
* @keyword
*/
givenName: string;
/**
* Honorific prefix of the person.
*
* @keyword
*/
honorificPrefix?: string;
/**
* Honorific suffix of the person.
*
* @keyword
*/
honorificSuffix?: string;
/**
* Titles of jobs that the person has.
*
* @keyword
*/
jobTitles?: string[];
/**
* The complete name of the person combining all the parts of the name into one.
*
* @text
*/
name: string;
@@ -89,6 +107,8 @@ export interface SCPersonWithoutReferences
/**
* The private telephone number of the person.
*
* @keyword
*/
telephone?: string;
@@ -102,6 +122,7 @@ export interface SCPersonWithoutReferences
* A person
*
* @validatable
* @indexable
*/
export interface SCPerson
extends SCPersonWithoutReferences, SCThing {
@@ -139,10 +160,40 @@ export class SCPersonMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
additionalName: 'Zusatzname',
affiliations: 'Zugehörigkeiten',
birthDate: 'Geburtsdatum',
email: 'E-Mail',
familyName: 'Nachname',
faxNumber: 'Faxnummer',
gender: 'Geschlecht',
givenName: 'Vorname',
homeLocations: 'Heimatstandorte',
honorificPrefix: 'Ehrentitel',
honorificSuffix: 'Ehrentitel (Suffix)',
jobTitles: 'Berufsbezeichnungen',
nationality: 'Staatsangehörigkeit',
telephone: 'Telefonnummer',
workLocations: 'Arbeitsorte',
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
additionalName: 'additional name',
affiliations: 'affiliations',
birthDate: 'birth date',
email: 'email',
familyName: 'family name',
faxNumber: 'fax',
gender: 'gender',
givenName: 'given name',
homeLocations: 'home locations',
honorificPrefix: 'honorific title',
honorificSuffix: 'honorific title (suffix)',
jobTitles: 'job titles',
nationality: 'nationality',
telephone: 'telephone',
workLocations: 'work locations',
},
};
@@ -151,11 +202,17 @@ export class SCPersonMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
gender: {
'female': 'weiblich',
'inter': 'divers',
'male': 'männlich',
'undefined': 'undefiniert',
},
type: 'Person',
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
type: SCThingType.Person,
},
};
@@ -174,26 +231,36 @@ export interface SCContactPoint {
/**
* E-mail at the work location
*
* @keyword
*/
email?: string;
/**
* Fax number at the work location
*
* @keyword
*/
faxNumber?: string;
/**
* Times available for contacting at the work location
*
* @keyword
*/
hoursAvailable?: string;
/**
* Contact number at the work location
*
* @keyword
*/
telephone?: string;
/**
* URL at the work location
*
* @keyword
*/
url?: string;
}

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
import {SCThingInPlace} from '../base/ThingInPlace';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
@@ -45,6 +45,7 @@ export interface SCPointOfInterestWithoutReferences
* A point of interest
*
* @validatable
* @indexable
*/
export interface SCPointOfInterest
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
@@ -81,16 +82,26 @@ export class SCPointOfInterestMeta
*/
fieldTranslations = {
de: {
// tslint:disable-next-line:max-line-length
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
},
en: {
// tslint:disable-next-line:max-line-length
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
},
};
@@ -99,15 +110,30 @@ export class SCPointOfInterestMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
categories: {
'card charger': 'Kartenaufwerter',
'computer': 'Computer',
'disabled access': 'barrierefreier Zugang',
'printer': 'Drucker',
'validator': 'Validierer',
},
type: 'Sonderziel',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
type: SCThingType.PointOfInterest,
},
};

View File

@@ -57,8 +57,10 @@ export interface SCRoomWithoutReferences
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
/**
* The name of the floor in which the room is in.
*
* @text
*/
floor?: string;
floorName?: string;
/**
* The inventory of the place/room as a list of items and their quantity.
@@ -82,6 +84,7 @@ export interface SCRoomWithoutReferences
* A room
*
* @validatable
* @indexable
*/
export interface SCRoom
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
@@ -106,6 +109,8 @@ export interface SCRoomSpecificValues
extends SCThingWithCategoriesSpecificValues {
/**
* Category specific opening hours of the room
*
* @keyword
*/
openingHours?: string;
}
@@ -121,18 +126,36 @@ export class SCRoomMeta
*/
fieldTranslations = {
de: {
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
floorName: 'Etagenbezeichnung',
inventory: 'Bestand',
},
en: {
...SCPlaceWithoutReferencesMeta.getInstance().fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
floorName: 'floor name',
inventory: 'inventory',
},
};
@@ -141,11 +164,18 @@ export class SCRoomMeta
*/
fieldValueTranslations = {
de: {
...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
@@ -164,11 +194,18 @@ export class SCRoomMeta
type: 'Raum',
},
en: {
...SCPlaceWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
type: SCThingType.Room,
},
};

View File

@@ -29,6 +29,7 @@ export interface SCSemesterWithoutReferences
* The short name of the semester, using the given pattern.
*
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
* @keyword
*/
acronym: string;
@@ -42,6 +43,7 @@ export interface SCSemesterWithoutReferences
* A semester
*
* @validatable
* @indexable
*/
export interface SCSemester
extends SCSemesterWithoutReferences, SCAcademicTerm {
@@ -62,7 +64,9 @@ export class SCSemesterMeta
*/
fieldTranslations = {
de: {
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de,
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldTranslations.de,
acronym: 'Abkürzung',
endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss',
@@ -70,7 +74,14 @@ export class SCSemesterMeta
startDate: 'Beginn',
},
en: {
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.en,
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldTranslations.en,
acronym: 'acronym',
endDate: 'end date',
eventsEndDate: 'semester ending',
eventsStartDate: 'semester beginning',
startDate: 'start date',
},
};
@@ -79,11 +90,15 @@ export class SCSemesterMeta
*/
fieldValueTranslations = {
de: {
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldValueTranslations.de,
type: 'Semester',
},
en: {
...SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldValueTranslations.en,
type: SCThingType.Semester,
},
};

View File

@@ -22,13 +22,15 @@ import {
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
export type SCSettingCategories = string;
/**
* A setting without references
*/
export interface SCSettingWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
/**
* Categories of a setting
*/
categories: SCSettingCategories[];
/**
* The default value of a setting
*/
@@ -39,6 +41,8 @@ export interface SCSettingWithoutReferences
inputType: SCSettingInputType;
/**
* The order number this setting should show up in its category list
*
* @integer
*/
order: number;
/**
@@ -59,6 +63,15 @@ export interface SCSettingWithoutReferences
values?: SCSettingValues;
}
/**
* A list of categories for settings
*/
export type SCSettingCategories =
'profile'
| 'privacy'
| 'credentials'
| 'others';
/**
* The types of input/value a setting object can carry
*/
@@ -74,6 +87,7 @@ export enum SCSettingInputType {
* A setting with references
*
* @validatable
* @indexable
*/
export interface SCSetting
extends SCSettingWithoutReferences, SCThing,
@@ -104,6 +118,8 @@ export type SCSettingValues = SCSettingValue[];
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
/**
* The translations of the possible values of a setting
*
* @keyword
*/
values?: string[];
}
@@ -117,20 +133,26 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/
fieldTranslations = {
de: {
// tslint:disable-next-line:max-line-length
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
defaultValue: 'Standard Wert',
inputType: 'Eingabetyp',
order: 'Position',
value: 'Wert',
values: 'Werte',
},
en: {
// tslint:disable-next-line:max-line-length
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
defaultValue: 'default value',
inputType: 'input type',
order: 'position',
value: 'value',
values: 'values',
},
};
@@ -139,9 +161,16 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/
fieldValueTranslations = {
de: {
// tslint:disable-next-line:max-line-length
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: {
credentials: 'Anmeldedaten',
others: 'Andere',
privacy: 'Privatsphäre',
profile: 'Profil',
},
inputType: {
'multiple choice': 'mehrfach Auswahl',
number: 'Zahl',
@@ -152,9 +181,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
type: 'Einstellung',
},
en: {
// tslint:disable-next-line:max-line-length
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Setting,
},
};

View File

@@ -31,6 +31,7 @@ export interface SCSportCourseWithoutReferences
* A sport course
*
* @validatable
* @indexable
*/
export interface SCSportCourse
extends SCEvent, SCSportCourseWithoutReferences {
@@ -51,12 +52,10 @@ export class SCSportCourseMeta
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCEventMeta.getInstance().fieldTranslations.de,
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCEventMeta.getInstance().fieldTranslations.en,
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
},
};
@@ -65,13 +64,11 @@ export class SCSportCourseMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCEventMeta.getInstance().fieldValueTranslations.de,
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
type: 'Sportkurs',
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCEventMeta.getInstance().fieldValueTranslations.en,
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
type: SCThingType.SportCourse,
},
};

View File

@@ -21,6 +21,7 @@ import {
import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCOrganizationWithoutReferences} from './Organization';
import {SCPersonWithoutReferences} from './Person';
@@ -33,6 +34,8 @@ export interface SCStudyModuleWithoutReferences
/**
* ECTS points (European Credit Transfer System)
*
* @float
*/
ects: number;
@@ -43,6 +46,8 @@ export interface SCStudyModuleWithoutReferences
/**
* Majors that this study module is meant for
*
* @keyword
*/
majors: string[];
@@ -66,6 +71,7 @@ export interface SCStudyModuleWithoutReferences
* A study module
*
* @validatable
* @indexable
*/
export interface SCStudyModule
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
@@ -110,6 +116,8 @@ export interface SCStudyModuleTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translations of the majors that this study module is meant for
*
* @keyword
*/
majors?: string[];
@@ -142,6 +150,8 @@ export class SCStudyModuleMeta
fieldTranslations = {
de: {
...SCThingMeta.getInstance().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
academicEvents: 'Veranstaltungen',
ects: 'ECTS-Punkte',
faculty: 'Fachbereich',
@@ -154,6 +164,8 @@ export class SCStudyModuleMeta
},
en: {
...SCThingMeta.getInstance().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.en,
academicEvents: 'academic events',
ects: 'ECTS points',
faculty: 'faculty',
@@ -171,7 +183,9 @@ export class SCStudyModuleMeta
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.de,
necessity: {
'elective': 'Wahlfach',
'optional': 'optional',
@@ -180,7 +194,9 @@ export class SCStudyModuleMeta
type: 'Studiengangmodul',
},
en: {
...SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.en,
type: SCThingType.StudyModule,
},
};

View File

@@ -29,13 +29,15 @@ export interface SCTicketWithoutReferences
/**
* Waiting number of the ticket
*
* @keyword
*/
currentTicketNumber: string;
/**
* Service type of the ticket
*/
serviceType: any;
serviceType: string;
/**
* Type of a ticket
@@ -47,6 +49,7 @@ export interface SCTicketWithoutReferences
* A ticket
*
* @validatable
* @indexable
*/
export interface SCTicket
extends SCTicketWithoutReferences, SCThingInPlace {
@@ -67,10 +70,18 @@ export class SCTicketMeta
*/
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
approxWaitingTime: 'ungefähre Wartezeit',
currentTicketNumber: 'aktuelle Ticketnummer',
serviceType: 'Service Kategorie',
},
en: {
...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
approxWaitingTime: 'approximate waiting time',
currentTicketNumber: 'current ticket number',
serviceType: 'type of service',
},
};
@@ -79,11 +90,13 @@ export class SCTicketMeta
*/
fieldValueTranslations = {
de: {
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
type: 'Ticket',
},
en: {
...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
type: SCThingType.Ticket,
},
};

View File

@@ -53,6 +53,7 @@ export interface SCToDoWithoutReferences
* A "to do"
*
* @validatable
* @indexable
*/
export interface SCToDo
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
@@ -85,12 +86,22 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
string,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
done: 'Erledigt',
dueDate: 'Fälligkeitsdatum',
priority: 'Priorität',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
string,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
done: 'done',
dueDate: 'due date',
priority: 'priority',
},
};

View File

@@ -22,16 +22,22 @@ export interface SCTourWithoutReferences
extends SCThingWithoutReferences {
/**
* Init script for the tour
*
* @text
*/
init?: string;
/**
* Steps of a tour
*
* @keyword
*/
steps: SCTourStep[];
/**
* Type of a tour
*
* @keyword
*/
type: SCThingType.Tour;
}
@@ -40,6 +46,7 @@ export interface SCTourWithoutReferences
* A tour
*
* @validatable
* @indexable
*/
export interface SCTour
extends SCTourWithoutReferences, SCThing {
@@ -55,6 +62,35 @@ export interface SCTour
export class SCTourMeta
extends SCThingMeta
implements SCMetaTranslations<SCTour> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
init: 'Initiales Skript',
steps: 'Schritte',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
init: 'initial script',
steps: 'steps',
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
type: 'Tour',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
type: SCThingType.Tour,
},
};
}
/**
@@ -71,6 +107,8 @@ export type SCTourStep =
export interface SCTourStepLocation {
/**
* Location to go to
*
* @keyword
*/
location: string;
@@ -91,6 +129,8 @@ export interface SCTourStepTooltip {
/**
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
*
* @keyword
*/
element: string | string[];
@@ -106,11 +146,15 @@ export interface SCTourStepTooltip {
/**
* Text that the tooltip shall contain
*
* @text
*/
text: string;
/**
* How often it shall be retried
*
* @integer
*/
tries?: number;
@@ -146,6 +190,8 @@ export interface SCTourStepMenu {
export interface SCTourResolvedElement {
/**
* Element name
*
* @keyword
*/
element: string;
}
@@ -156,6 +202,8 @@ export interface SCTourResolvedElement {
export interface SCTourResolvedEvent {
/**
* Event name
*
* @keyword
*/
event: string;
}
@@ -176,6 +224,8 @@ export interface SCTourResolvedLocation {
export interface SCTourResolvedLocationTypeIs {
/**
* Specific location name
*
* @keyword
*/
is: string;
}
@@ -186,6 +236,8 @@ export interface SCTourResolvedLocationTypeIs {
export interface SCTourResolvedLocationTypeMatch {
/**
* Regex location name
*
* @keyword
*/
match: string;
}

View File

@@ -35,6 +35,8 @@ export interface SCVideoWithoutReferences
/**
* URLs to a thumbnails for the Video
*
* @keyword
*/
thumbnails?: string[];
@@ -45,6 +47,8 @@ export interface SCVideoWithoutReferences
/**
* A Transcript of the Video
*
* @text
*/
transcript?: string;
@@ -57,6 +61,8 @@ export interface SCVideoWithoutReferences
export interface SCVideoSource {
/**
* Pixel Height of the Video
*
* @integer
*/
height?: number;
@@ -67,16 +73,22 @@ export interface SCVideoSource {
/**
* Size of the Video File in bytes
*
* @integer
*/
size?: number;
/**
* URL to the Video File
*
* @keyword
*/
url: string;
/**
* Pixel Width of the Video
*
* @integer
*/
width?: number;
}
@@ -94,6 +106,8 @@ export interface SCVideoTrack {
/**
* URL to the Track File
*
* @keyword
*/
url: string;
}
@@ -102,6 +116,7 @@ export interface SCVideoTrack {
* A video
*
* @validatable
* @indexable
*/
export interface SCVideo
extends SCCreativeWork, SCVideoWithoutReferences {
@@ -127,10 +142,24 @@ export class SCVideoMeta
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
actors: 'Darsteller',
duration: 'Dauer',
sources: 'Quellen',
thumbnails: 'Vorschaubilder',
tracks: 'Spuren',
transcript: 'Transkript',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
actors: 'actors',
duration: 'duration',
sources: 'sources',
thumbnails: 'thumbnails',
tracks: 'tracks',
transcript: 'transcript',
},
};
@@ -139,11 +168,13 @@ export class SCVideoMeta
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
type: 'Video',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
type: SCThingType.Video,
},
};
@@ -163,7 +194,7 @@ export type SCVideoMimeType =
* Video Track Types
*/
export type SCVideoTrackTypes =
'captions'
'closed captions'
| 'chapters'
| 'description'
| 'metadata'

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Point, Polygon} from 'geojson';
/**

View File

@@ -5,7 +5,7 @@
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* unknown WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
@@ -23,12 +23,25 @@ import {SCTranslations} from './i18n';
*
* @param something Something to check
*/
export function isThing(something: any): something is SCThing {
return (
typeof something === 'object'
&& typeof something.type === 'string'
&& Object.values(SCThingType).indexOf(something.type) >= 0
);
export function isThing(something: unknown): something is SCThing {
if (typeof something !== 'object' || something === null) {
return false;
}
if (!('type' in something)) {
return false;
}
// tslint:disable-next-line:completed-docs
const type = (something as { type: unknown; }).type;
if (typeof type !== 'string') {
return false;
}
return Object
.values(SCThingType)
.indexOf(type) >= 0;
}
/**
@@ -37,7 +50,8 @@ export function isThing(something: any): something is SCThing {
* @param thing Thing to check
*/
export function isThingWithTranslations(thing: SCThingWithoutReferences)
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties> } {
// tslint:disable-next-line:completed-docs
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
return typeof thing.translations !== 'undefined';
}
@@ -46,12 +60,34 @@ export function isThingWithTranslations(thing: SCThingWithoutReferences)
*
* @param something Something to check
*/
export function isBulkResponse(something: any): something is SCBulkResponse {
return typeof something.expiration === 'string'
&& typeof something.source === 'string'
&& typeof something.state === 'string'
&& typeof something.type === 'string'
&& typeof something.uid === 'string';
export function isBulkResponse(something: unknown): something is SCBulkResponse {
if (typeof something !== 'object' || something === null) {
return false;
}
if (!('expiration' in something)
|| !('source' in something)
|| !('state' in something)
|| !('type' in something)
|| !('uid' in something)) {
return false;
}
const {expiration, source, state, type, uid} = something as {
// tslint:disable:completed-docs
expiration: unknown;
source: unknown;
state: unknown;
type: unknown;
uid: unknown;
// tslint:enable
};
return typeof expiration === 'string'
&& typeof source === 'string'
&& typeof state === 'string'
&& typeof type === 'string'
&& typeof uid === 'string';
}
/**
@@ -59,15 +95,20 @@ export function isBulkResponse(something: any): something is SCBulkResponse {
*
* @param something Something to check
*/
export function isSearchResponse(something: any): something is SCSearchResponse {
return Array.isArray(something.data)
&& Array.isArray(something.facets)
&& typeof something.pagination !== 'undefined'
&& typeof something.pagination.count === 'number'
&& typeof something.pagination.offset === 'number'
&& typeof something.pagination.total === 'number'
&& typeof something.stats !== 'undefined'
&& typeof something.stats.time === 'number';
export function isSearchResponse(something: unknown): something is SCSearchResponse {
if (!(typeof something === 'object') || something === null) {
return false;
}
const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
return Array.isArray(somethingObject.data)
&& Array.isArray(somethingObject.facets)
&& typeof somethingObject.pagination !== 'undefined'
&& typeof somethingObject.pagination.count === 'number'
&& typeof somethingObject.pagination.offset === 'number'
&& typeof somethingObject.pagination.total === 'number'
&& typeof somethingObject.stats !== 'undefined'
&& typeof somethingObject.stats.time === 'number';
}
/**
@@ -75,8 +116,11 @@ export function isSearchResponse(something: any): something is SCSearchResponse
*
* @param something Something to check
*/
export function isMultiSearchResponse(something: any): something is SCMultiSearchResponse {
return Object.keys(something).reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse(something[key]);
}, true as boolean);
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
return Object.keys(something as { [key: string]: string; })
.reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
}, initialValue as boolean);
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson';
import {SCSetting} from '../../things/Setting';
import {SCTranslations} from '../i18n';
@@ -126,11 +127,11 @@ export interface SCAppConfiguration {
}
/**
*
* Map of features
*/
export interface SCAppConfigurationFeature {
/**
*
* Whether or not widgets are enabled
*/
widgets: boolean;
}

View File

@@ -176,10 +176,9 @@ export interface SCBackendInternalConfiguration {
/**
* Configuration of the database
*/
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<any> {
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<unknown> {
/**
* Name of the database used by the backend
*/
name: string;
}

View File

@@ -140,7 +140,7 @@ export interface SCMonitoringWatcher {
/**
* Query to execute against the database
*/
query: any;
query: unknown;
/**
* A list of triggers

View File

@@ -48,7 +48,7 @@ export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArgument
/**
* Arguments for the filter instruction
*/
export type SCSearchAbstractFilterArguments = SCMap<any>;
export type SCSearchAbstractFilterArguments = SCMap<unknown>;
/**
* Available filter instructions

View File

@@ -22,6 +22,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
* Filter for documents where it cannot be safely determined that they are not available
*/
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'availability';
}

View File

@@ -20,6 +20,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter}
* This filter can be used to combine multiple filters with boolean operations.
*/
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'boolean';
}

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCThingsField} from '../../Classes';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
@@ -22,6 +23,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
* Filter for documents that are in the given distance of the given location
*/
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'distance';
}

View File

@@ -19,6 +19,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
* Filters for documents that match the value on the given field
*/
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'value';
}

View File

@@ -690,7 +690,7 @@ export interface SCTranslations<T> {
* (Source: https://stackoverflow.com/a/51365037)
*/
type RecursivePartial<T> = {
[P in keyof T]?:
[P in keyof T]-?:
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
T[P] extends object ? RecursivePartial<T[P]> :
T[P];
@@ -714,6 +714,12 @@ type SCRequiredTranslation<T> = {
* Interface to be implemented by all Meta classes
*/
export interface SCMetaTranslations<T> {
/**
* Field translations
*/
fieldTranslations: SCRequiredTranslation<T>;
fieldValueTranslations: any;
/**
* Field value translations
*/
fieldValueTranslations: unknown;
}

View File

@@ -41,7 +41,7 @@ export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
/**
* Map of arguments for the sort instruction
*/
export interface SCSearchAbstractSortArguments extends SCMap<any> {
export interface SCSearchAbstractSortArguments extends SCMap<unknown> {
/**
* Field to sort by
*/

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
@@ -19,6 +20,9 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
* Sort instruction to sort by distance
*/
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
/**
* @see SCSearchAbstractSort.type
*/
type: 'distance';
}

View File

@@ -18,5 +18,8 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
* Sort instruction for ducet sort
*/
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
/**
* @see SCSearchAbstractSort.type
*/
type: 'ducet';
}

View File

@@ -19,6 +19,9 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
* Sort instruction to sort by price
*/
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
/**
* @see SCSearchAbstractSort.type
*/
type: 'price';
}

View File

@@ -14,44 +14,129 @@
*/
import {expect} from 'chai';
import {slow, suite, test, timeout} from 'mocha-typescript';
import {SCBulkResponse} from '../src/core/protocol/routes/bulk/BulkResponse';
import {SCMultiSearchResponse} from '../src/core/protocol/routes/search/MultiSearchResponse';
import {SCSearchResponse} from '../src/core/protocol/routes/search/SearchResponse';
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
import {SCDish} from '../src/core/things/Dish';
import {isThing} from '../src/core/types/Guards';
import {
isBulkResponse,
isMultiSearchResponse,
isSearchResponse,
isThing,
isThingWithTranslations,
} from '../src/core/types/Guards';
@suite(timeout(10000), slow(5000))
export class GuardsSpec {
static bulkResponse: SCBulkResponse = {
expiration: '2009-06-30T18:30:00+02:00 ',
source: 'bar',
state: 'done',
type: SCThingType.Dish,
uid: 'foo',
};
static dishWithTranslation: SCDish = {
categories: [
'appetizer',
],
name: 'foo',
origin: {
created: '',
type: SCThingOriginType.User,
},
translations: {
de: {
name: 'Foo',
},
},
type: SCThingType.Dish,
uid: 'bar',
};
static notADish = {
categories: [
'appetizer',
],
name: 'foo',
origin: {
created: '',
type: SCThingOriginType.User,
},
type: 'foobar',
uid: 'bar',
};
static searchResponse: SCSearchResponse = {
data: [
GuardsSpec.dishWithTranslation,
],
facets: [
{
buckets: [
{
count: 1,
key: 'key',
},
],
field: 'field',
},
],
pagination: {
count: 1,
offset: 0,
total: 1,
},
stats: {
time: 1,
},
};
@test
public isBulkResponse() {
expect(isBulkResponse(null)).to.be.equal(false);
expect(isBulkResponse(GuardsSpec.dishWithTranslation)).to.be.equal(false);
expect(isBulkResponse(GuardsSpec.bulkResponse)).to.be.equal(true);
}
@test
public isMultiSearchResponse() {
const multiSearchResponse: SCMultiSearchResponse = {
foo: GuardsSpec.searchResponse,
};
expect(isMultiSearchResponse(multiSearchResponse)).to.be.equal(true);
const notAMultiSearchResponse = {...multiSearchResponse, ...{bar: 'baz'}};
expect(isMultiSearchResponse(notAMultiSearchResponse)).to.be.equal(false);
delete multiSearchResponse.foo;
expect(isMultiSearchResponse(multiSearchResponse)).to.be.equal(false);
}
@test
public isSearchResponse() {
const notASearchResponse = {...GuardsSpec.searchResponse};
delete notASearchResponse.pagination;
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
delete notASearchResponse.data;
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
expect(isSearchResponse(null)).to.be.equal(false);
expect(isSearchResponse(GuardsSpec.searchResponse)).to.be.equal(true);
}
@test
public isThing() {
const notADish = {
categories: [
'appetizer',
],
name: 'foo',
origin: {
created: '',
type: SCThingOriginType.User,
},
type: 'foobar',
uid: 'bar',
};
const dish: SCDish = {
categories: [
'appetizer',
],
name: 'foo',
origin: {
created: '',
type: SCThingOriginType.User,
},
type: SCThingType.Dish,
uid: 'bar',
};
expect(isThing('foo')).to.be.equal(false);
expect(isThing({type: 'foo'})).to.be.equal(false);
expect(isThing(GuardsSpec.notADish)).to.be.equal(false);
expect(isThing(GuardsSpec.dishWithTranslation)).to.be.equal(true);
}
expect(isThing(notADish)).to.be.equal(false);
expect(isThing(dish)).to.be.equal(true);
@test
public isThingWithTranslations() {
const dishWithoutTranslation = {...GuardsSpec.dishWithTranslation};
delete dishWithoutTranslation.translations;
expect(isThingWithTranslations(dishWithoutTranslation)).to.be.equal(false);
expect(isThingWithTranslations(GuardsSpec.dishWithTranslation)).to.be.equal(true);
}
}

View File

@@ -193,7 +193,7 @@ export class SchemaSpec {
continue;
}
const type = property.type!;
let type = property.type!;
if (isIntrinsicType(type)) {
continue;
@@ -212,10 +212,24 @@ export class SchemaSpec {
fail(`'${thingName}'#'${property.name}' element type '${elementType.type}' is not handled by this test!`);
}
} else if (isReferenceType(type)) {
expect(SchemaSpec.thingNames).not.to.contain(
type.name,
`Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`,
);
do {
expect(SchemaSpec.thingNames).not.to.contain(
type.name,
`Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`,
);
const referencedObject = SchemaSpec.objects[type.name];
if (typeof referencedObject !== 'undefined') {
const referencedType = referencedObject.type;
if (typeof referencedType !== 'undefined') {
type = referencedType;
} else {
break;
}
} else {
break;
}
} while (isReferenceType(type));
} else if (isUnionType(type)) {
for (const nestedType of type.types) {
if (isIntrinsicType(nestedType) || isStringLiteralType(nestedType)) {

View File

@@ -237,6 +237,7 @@ export class MetaTranslationSpec {
public consistencyWithMetaClass() {
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish);
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish, 'en');
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
}

344
test/Type.spec.ts Normal file
View File

@@ -0,0 +1,344 @@
import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks';
import {SCThing, SCThingWithoutReferences} from '../src/core/Thing';
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/core/things/AcademicEvent';
import {SCArticle, SCArticleWithoutReferences} from '../src/core/things/Article';
import {SCBook, SCBookWithoutReferences} from '../src/core/things/Book';
import {SCBuilding, SCBuildingWithoutReferences} from '../src/core/things/Building';
import {SCCatalog, SCCatalogWithoutReferences} from '../src/core/things/Catalog';
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/core/things/CourseOfStudies';
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/core/things/DateSeries';
import {SCDiff, SCDiffWithoutReferences} from '../src/core/things/Diff';
import {SCDish, SCDishWithoutReferences} from '../src/core/things/Dish';
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/core/things/Favorite';
import {SCFloor, SCFloorWithoutReferences} from '../src/core/things/Floor';
import {SCMessage, SCMessageWithoutReferences} from '../src/core/things/Message';
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/core/things/Organization';
import {SCPerson, SCPersonWithoutReferences} from '../src/core/things/Person';
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/core/things/PointOfInterest';
import {SCRoom, SCRoomWithoutReferences} from '../src/core/things/Room';
import {SCSemester, SCSemesterWithoutReferences} from '../src/core/things/Semester';
import {SCSetting, SCSettingWithoutReferences} from '../src/core/things/Setting';
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/core/things/SportCourse';
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/core/things/StudyModule';
import {SCTicket, SCTicketWithoutReferences} from '../src/core/things/Ticket';
import {SCToDo, SCToDoWithoutReferences} from '../src/core/things/ToDo';
import {SCTour, SCTourWithoutReferences} from '../src/core/things/Tour';
import {SCVideo, SCVideoWithoutReferences} from '../src/core/things/Video';
/**
* Check if E extends T
*/
type Extends<E, T> = E extends T ? true : false;
/**
* Get type of array elements up to nesting level 3
*/
type ElementType<T> = T extends any[] ?
(T[0] extends any[] ?
(T[0][0] extends any[] ?
T[0][0][0] : T[0][0]) : T[0]) : T;
/**
* Get types of properties
*
* - Extracts only the properties which extend object and are not any.
* - If type is an array it returns the type of the elements.
*/
type PropertyTypes<T> = Extract<ElementType<T extends object ?
(IsAny<T[keyof T]> extends true ?
never : T[keyof T]) : never>
, object>;
/**
* Get nested property types
*/
type PropertyTypesNested<T> = PropertyTypes<T> extends object ? PropertyTypes<PropertyTypes<T>> : PropertyTypes<T>;
/**
* Types of properties of SCDiff
*/
type SCDiffPropertyTypes = PropertyTypesNested<SCDiff>;
assert<NotHas<SCDiffPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCDiffPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCDiffPropertyTypes, SCThing>>(true);
assert<Has<SCDiffPropertyTypes, SCThing>>(false);
assert<Extends<SCDiffWithoutReferences, SCThing>>(false);
assert<Extends<SCDiff, SCThing>>(true);
/**
* Types of properties of SCAcademicEvent
*/
type SCAcademicEventPropertyTypes = PropertyTypesNested<SCAcademicEvent>;
assert<NotHas<SCAcademicEventPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCAcademicEventPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCAcademicEventPropertyTypes, SCThing>>(true);
assert<Has<SCAcademicEventPropertyTypes, SCThing>>(false);
assert<Extends<SCAcademicEventWithoutReferences, SCThing>>(false);
assert<Extends<SCAcademicEvent, SCThing>>(true);
/**
* Types of properties of SCArticle
*/
type SCArticlePropertyTypes = PropertyTypesNested<SCArticle>;
assert<NotHas<SCArticlePropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCArticlePropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCArticlePropertyTypes, SCThing>>(true);
assert<Has<SCArticlePropertyTypes, SCThing>>(false);
assert<Extends<SCArticleWithoutReferences, SCThing>>(false);
assert<Extends<SCArticle, SCThing>>(true);
/**
* Types of properties of SCBook
*/
type SCBookPropertyTypes = PropertyTypesNested<SCBook>;
assert<NotHas<SCBookPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCBookPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCBookPropertyTypes, SCThing>>(true);
assert<Has<SCBookPropertyTypes, SCThing>>(false);
assert<Extends<SCBookWithoutReferences, SCThing>>(false);
assert<Extends<SCBook, SCThing>>(true);
/**
* Types of properties of SCBuilding
*/
type SCBuildingPropertyTypes = PropertyTypesNested<SCBuilding>;
assert<NotHas<SCBuildingPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCBuildingPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCBuildingPropertyTypes, SCThing>>(true);
assert<Has<SCBuildingPropertyTypes, SCThing>>(false);
assert<Extends<SCBuildingWithoutReferences, SCThing>>(false);
assert<Extends<SCBuilding, SCThing>>(true);
/**
* Types of properties of SCCatalog
*/
type SCCatalogPropertyTypes = PropertyTypesNested<SCCatalog>;
assert<NotHas<SCCatalogPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCCatalogPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCCatalogPropertyTypes, SCThing>>(true);
assert<Has<SCCatalogPropertyTypes, SCThing>>(false);
assert<Extends<SCCatalogWithoutReferences, SCThing>>(false);
assert<Extends<SCCatalog, SCThing>>(true);
/**
* Types of properties of SCCourseOfStudies
*/
type SCCourseOfStudiesPropertyTypes = PropertyTypesNested<SCCourseOfStudies>;
assert<NotHas<SCCourseOfStudiesPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCCourseOfStudiesPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCCourseOfStudiesPropertyTypes, SCThing>>(true);
assert<Has<SCCourseOfStudiesPropertyTypes, SCThing>>(false);
assert<Extends<SCCourseOfStudiesWithoutReferences, SCThing>>(false);
assert<Extends<SCCourseOfStudies, SCThing>>(true);
/**
* Types of properties of SCDateSeries
*/
type SCDateSeriesPropertyTypes = PropertyTypesNested<SCDateSeries>;
assert<NotHas<SCDateSeriesPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCDateSeriesPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCDateSeriesPropertyTypes, SCThing>>(true);
assert<Has<SCDateSeriesPropertyTypes, SCThing>>(false);
assert<Extends<SCDateSeriesWithoutReferences, SCThing>>(false);
assert<Extends<SCDateSeries, SCThing>>(true);
/**
* Types of properties of SCDish
*/
type SCDishPropertyTypes = PropertyTypesNested<SCDish>;
assert<NotHas<SCDishPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCDishPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCDishPropertyTypes, SCThing>>(true);
assert<Has<SCDishPropertyTypes, SCThing>>(false);
assert<Extends<SCDishWithoutReferences, SCThing>>(false);
assert<Extends<SCDish, SCThing>>(true);
/**
* Types of properties of SCFavorite
*/
type SCFavoritePropertyTypes = PropertyTypesNested<SCFavorite>;
assert<NotHas<SCFavoritePropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCFavoritePropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCFavoritePropertyTypes, SCThing>>(true);
assert<Has<SCFavoritePropertyTypes, SCThing>>(false);
assert<Extends<SCFavoriteWithoutReferences, SCThing>>(false);
assert<Extends<SCFavorite, SCThing>>(true);
/**
* Types of properties of SCFloor
*/
type SCFloorPropertyTypes = PropertyTypesNested<SCFloor>;
assert<NotHas<SCFloorPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCFloorPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCFloorPropertyTypes, SCThing>>(true);
assert<Has<SCFloorPropertyTypes, SCThing>>(false);
assert<Extends<SCFloorWithoutReferences, SCThing>>(false);
assert<Extends<SCFloor, SCThing>>(true);
/**
* Types of properties of SCMessage
*/
type SCMessagePropertyTypes = PropertyTypesNested<SCMessage>;
assert<NotHas<SCMessagePropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCMessagePropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCMessagePropertyTypes, SCThing>>(true);
assert<Has<SCMessagePropertyTypes, SCThing>>(false);
assert<Extends<SCMessageWithoutReferences, SCThing>>(false);
assert<Extends<SCMessage, SCThing>>(true);
/**
* Types of properties of SCOrganization
*/
type SCOrganizationPropertyTypes = PropertyTypesNested<SCOrganization>;
assert<NotHas<SCOrganizationPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCOrganizationPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCOrganizationPropertyTypes, SCThing>>(true);
assert<Has<SCOrganizationPropertyTypes, SCThing>>(false);
assert<Extends<SCOrganizationWithoutReferences, SCThing>>(false);
assert<Extends<SCOrganization, SCThing>>(true);
/**
* Types of properties of SCPerson
*/
type SCPersonPropertyTypes = PropertyTypesNested<SCPerson>;
assert<NotHas<SCPersonPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCPersonPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCPersonPropertyTypes, SCThing>>(true);
assert<Has<SCPersonPropertyTypes, SCThing>>(false);
assert<Extends<SCPersonWithoutReferences, SCThing>>(false);
assert<Extends<SCPerson, SCThing>>(true);
/**
* Types of properties of SCPointOfInterest
*/
type SCPointOfInterestPropertyTypes = PropertyTypesNested<SCPointOfInterest>;
assert<NotHas<SCPointOfInterestPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCPointOfInterestPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCPointOfInterestPropertyTypes, SCThing>>(true);
assert<Has<SCPointOfInterestPropertyTypes, SCThing>>(false);
assert<Extends<SCPointOfInterestWithoutReferences, SCThing>>(false);
assert<Extends<SCPointOfInterest, SCThing>>(true);
/**
* Types of properties of SCRoom
*/
type SCRoomPropertyTypes = PropertyTypesNested<SCRoom>;
assert<NotHas<SCRoomPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCRoomPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCRoomPropertyTypes, SCThing>>(true);
assert<Has<SCRoomPropertyTypes, SCThing>>(false);
assert<Extends<SCRoomWithoutReferences, SCThing>>(false);
assert<Extends<SCRoom, SCThing>>(true);
/**
* Types of properties of SCSemester
*/
type SCSemesterPropertyTypes = PropertyTypesNested<SCSemester>;
assert<NotHas<SCSemesterPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCSemesterPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCSemesterPropertyTypes, SCThing>>(true);
assert<Has<SCSemesterPropertyTypes, SCThing>>(false);
assert<Extends<SCSemesterWithoutReferences, SCThing>>(false);
assert<Extends<SCSemester, SCThing>>(true);
/**
* Types of properties of SCSetting
*/
type SCSettingPropertyTypes = PropertyTypesNested<SCSetting>;
assert<NotHas<SCSettingPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCSettingPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCSettingPropertyTypes, SCThing>>(true);
assert<Has<SCSettingPropertyTypes, SCThing>>(false);
assert<Extends<SCSettingWithoutReferences, SCThing>>(false);
assert<Extends<SCSetting, SCThing>>(true);
/**
* Types of properties of SCSportCourse
*/
type SCSportCoursePropertyTypes = PropertyTypesNested<SCSportCourse>;
assert<NotHas<SCSportCoursePropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCSportCoursePropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCSportCoursePropertyTypes, SCThing>>(true);
assert<Has<SCSportCoursePropertyTypes, SCThing>>(false);
assert<Extends<SCSportCourseWithoutReferences, SCThing>>(false);
assert<Extends<SCSportCourse, SCThing>>(true);
/**
* Types of properties of SCStudyModule
*/
type SCStudyModulePropertyTypes = PropertyTypesNested<SCStudyModule>;
assert<NotHas<SCStudyModulePropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCStudyModulePropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCStudyModulePropertyTypes, SCThing>>(true);
assert<Has<SCStudyModulePropertyTypes, SCThing>>(false);
assert<Extends<SCStudyModuleWithoutReferences, SCThing>>(false);
assert<Extends<SCStudyModule, SCThing>>(true);
/**
* Types of properties of SCTicket
*/
type SCTicketPropertyTypes = PropertyTypesNested<SCTicket>;
assert<NotHas<SCTicketPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCTicketPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCTicketPropertyTypes, SCThing>>(true);
assert<Has<SCTicketPropertyTypes, SCThing>>(false);
assert<Extends<SCTicketWithoutReferences, SCThing>>(false);
assert<Extends<SCTicket, SCThing>>(true);
/**
* Types of properties of SCToDo
*/
type SCToDoPropertyTypes = PropertyTypesNested<SCToDo>;
assert<NotHas<SCToDoPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCToDoPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCToDoPropertyTypes, SCThing>>(true);
assert<Has<SCToDoPropertyTypes, SCThing>>(false);
assert<Extends<SCToDoWithoutReferences, SCThing>>(false);
assert<Extends<SCToDo, SCThing>>(true);
/**
* Types of properties of SCToDo
*/
type SCTourPropertyTypes = PropertyTypesNested<SCTour>;
assert<NotHas<SCTourPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCTourPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCTourPropertyTypes, SCThing>>(true);
assert<Has<SCTourPropertyTypes, SCThing>>(false);
assert<Extends<SCTourWithoutReferences, SCThing>>(false);
assert<Extends<SCTour, SCThing>>(true);
/**
* Types of properties of SCVideo
*/
type SCVideoPropertyTypes = PropertyTypesNested<SCVideo>;
assert<NotHas<SCVideoPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCVideoPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCVideoPropertyTypes, SCThing>>(true);
assert<Has<SCVideoPropertyTypes, SCThing>>(false);
assert<Extends<SCVideoWithoutReferences, SCThing>>(false);
assert<Extends<SCVideo, SCThing>>(true);
/**
* Dummy interface, to check if union types still resolve to any if one of the members is any
*/
interface Foo {
bar: SCPerson;
foo: any;
}
/**
* Type that is unfortunately never - blame TypeScript
*/
type UnfortunatelyNever = PropertyTypesNested<Foo>;
assert<IsNever<UnfortunatelyNever>>(true);
/**
* Flat property types
*/
type FlatPropertyTypes<T> = T[keyof T];
/**
* Type that is unfortunately any - blame TypeScript
*/
type UnfortunatelyAny = FlatPropertyTypes<Foo>;
assert<IsAny<UnfortunatelyAny>>(true);

View File

@@ -21,7 +21,7 @@
],
"uid": "b535c86a-777b-54c3-b89a-cad528d0580f",
"name": "EMH 225",
"floor": "2"
"floorName": "2"
},
"frequency": "once",
"dates": [

View File

@@ -21,7 +21,7 @@
],
"uid": "b535c86a-777b-54c3-b89a-cad528d0580f",
"name": "EMH 225",
"floor": "2"
"floorName": "2"
},
"frequency": "once",
"dates": [

View File

@@ -17,7 +17,7 @@
"uid": "072db1e5-e479-5040-88e0-4a98d731e443",
"name": "Name One",
"type": "message",
"message": "Message",
"messageBody": "Message",
"audiences": [
"students"
],

View File

@@ -17,7 +17,7 @@
"uid": "072db1e5-e479-5040-88e0-4a98d731e443",
"name": "Name One",
"type": "message",
"message": "Message",
"messageBody": "Message",
"audiences": [
"students"
],

View File

@@ -3383,7 +3383,7 @@
],
"uid": "593655b5-0fc9-59de-a82f-b8f5f908deef",
"name": "MA 043",
"floor": "0"
"floorName": "0"
}
},
{
@@ -5526,7 +5526,7 @@
],
"uid": "31b1ab4c-1803-51ed-8c66-59bfc97cd350",
"name": "MA Foyer",
"floor": "0"
"floorName": "0"
}
},
{
@@ -6340,7 +6340,7 @@
],
"uid": "56ce0744-ae39-5209-b18f-d3a6edcb8f0a",
"name": "MA 042",
"floor": "0"
"floorName": "0"
}
},
{
@@ -6450,7 +6450,7 @@
],
"uid": "96b7e555-1214-5ca8-8294-e8209ac04f5a",
"name": "MA 041",
"floor": "0"
"floorName": "0"
}
},
{
@@ -6680,7 +6680,7 @@
],
"uid": "ed50a94d-eb06-5d07-8058-dfbdeb6c3a0b",
"name": "MA 001",
"floor": "0"
"floorName": "0"
}
},
{

View File

@@ -5,7 +5,7 @@
"uid": "4706ef24-b631-5c20-91d1-3c627decca5a",
"image": "https://backend/res/img/message_small.png",
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
"message": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
"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"
],

View File

@@ -7,7 +7,7 @@
"uid": "cdb7059c-a1a2-5229-821d-434c345e2917",
"image": "https://backend/res/img/message_small.png",
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
"message": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
"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"
],

View File

@@ -8,7 +8,7 @@
"uid": "4706ef24-b631-5c20-91d1-3c627decca5a",
"image": "https://backend/res/img/message_small.png",
"name": "Lösung für das Problem des Zurücksetzens der StApps-App gefunden",
"message": "Wie bereits berichtet, klagten User über das Löschen ihres Stundenplans beim Update von Version 0.8.0 auf 0.8.1. Wir haben eine Lösung für das Problem gefunden und testen diese ausführlich bis zum Ende dieser Woche. Wenn alles glatt verläuft, dann kommt am Wochenende die fehlerbereinige Version 0.8.2 heraus.\n\n*(25.Okt 2016)*",
"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"
],

View File

@@ -19,7 +19,7 @@
"BIB"
],
"name": "Universitätsbibliothek",
"floor": "0",
"floorName": "0",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -179,7 +179,7 @@
"streetAddress": "Straße des 17. Juni 136"
}
},
"floor": "0",
"floorName": "0",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -26,11 +26,9 @@
"H 0010"
],
"name": "Prüfungsamt - Team 2",
"floor": "0"
},
"serviceType": {
"name": "Prüfungsamt"
"floorName": "0"
},
"serviceType": "Prüfungsamt",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -1,6 +1,7 @@
{
"extends": "./node_modules/@openstapps/configuration/tslint.json",
"rules": {
"no-empty-interface": false
"no-empty-interface": false,
"file-name-casing": [false, "camel-case"]
}
}