mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 17:42:57 +00:00
Compare commits
132 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b517837671 | ||
|
|
6f03ede8bf | ||
|
|
952207ace1 | ||
|
|
3d9d28c60c | ||
|
|
913c5691da | ||
|
|
03cdbc6f9b | ||
|
|
9f886a8968 | ||
|
|
e80afe2c93 | ||
|
|
6b10cc86d8 | ||
|
|
1aedd6332f | ||
|
|
790c8bbc3f | ||
|
|
e934017a65 | ||
|
|
88dbedd932 | ||
|
|
8b1b3444fd | ||
|
|
d5f3d71a41 | ||
|
|
cbcf9c9adb | ||
|
|
321e4f6f24 | ||
|
|
8510f11d7b | ||
|
|
68aa377fe2 | ||
|
|
29f2c77ecc | ||
|
|
29bc00616e | ||
|
|
02920af4a4 | ||
|
|
0c14b0f1a0 | ||
|
|
db0a239761 | ||
|
|
377f55bbbe | ||
|
|
8d7a0e10c6 | ||
|
|
4865f911d1 | ||
|
|
15ae5e0873 | ||
|
|
a246bdea84 | ||
|
|
8641bfc877 | ||
|
|
d34e66fbbc | ||
|
|
c6273a85d9 | ||
|
|
5558d29c2b | ||
|
|
69dfd1ae39 | ||
|
|
4638bb3684 | ||
|
|
6c687c6004 | ||
|
|
0bf1301733 | ||
|
|
827ba47892 | ||
|
|
d3b620a745 | ||
|
|
821834cfa0 | ||
|
|
c369c8520a | ||
|
|
66075ef99b | ||
|
|
7a6333aa8f | ||
|
|
e242a21e99 | ||
|
|
6fecd1e89d | ||
|
|
f6a93e668b | ||
|
|
2f96bc8569 | ||
|
|
9ce4026b1a | ||
|
|
e434b2d26e | ||
|
|
fe7f1a53ae | ||
|
|
907d61b5d2 | ||
|
|
5fb9755841 | ||
|
|
e5dd02eeca | ||
|
|
e7b4a426a9 | ||
|
|
7dd74af305 | ||
|
|
4409101647 | ||
|
|
3a141e6cf4 | ||
|
|
8a20e3e873 | ||
|
|
e196303e64 | ||
|
|
70c1a3eaa3 | ||
|
|
6060113df5 | ||
|
|
39d5becb56 | ||
|
|
f5e88569eb | ||
|
|
67041aa39d | ||
|
|
18943612a8 | ||
|
|
d167947e04 | ||
|
|
2a0dc812d8 | ||
|
|
cdb8a6507d | ||
|
|
5bedb27cad | ||
|
|
0d89b14932 | ||
|
|
5de523a4bf | ||
|
|
f97e199bb9 | ||
|
|
abda5cf0ca | ||
|
|
9658f05d31 | ||
|
|
e92bf6f7c7 | ||
|
|
ca8c4d1c05 | ||
|
|
443cb748fb | ||
|
|
5561b36a34 | ||
|
|
49b55db66f | ||
|
|
01f92baa98 | ||
|
|
ce5856cd86 | ||
|
|
a821bcae83 | ||
|
|
149f3ffff1 | ||
|
|
9ca7870183 | ||
|
|
87ee92b19b | ||
|
|
44e61bf336 | ||
|
|
fba63db137 | ||
|
|
8a5251c2e6 | ||
|
|
bde71c7e3a | ||
|
|
fec33715ad | ||
|
|
6dcca89257 | ||
|
|
3a65d4ba2f | ||
|
|
88f579e09b | ||
|
|
be2bfb4017 | ||
|
|
bad15dc872 | ||
|
|
8b090af3ed | ||
|
|
747497699d | ||
|
|
80a102cb6a | ||
|
|
234cb57070 | ||
|
|
d4a8ef6a9c | ||
|
|
689dc99414 | ||
|
|
27d97c4c95 | ||
|
|
e71dace32f | ||
|
|
180c966891 | ||
|
|
65730d603a | ||
|
|
7fbe1620ee | ||
|
|
d781dd6de5 | ||
|
|
86f3f8dfae | ||
|
|
34fe32b404 | ||
|
|
f262a6b8fa | ||
|
|
e1d4b2bc9d | ||
|
|
c3a9606f9d | ||
|
|
dd56d97945 | ||
|
|
43851d2d35 | ||
|
|
b6272e9229 | ||
|
|
13dae1fb06 | ||
|
|
c18e3c15f1 | ||
|
|
54d44f1acb | ||
|
|
47b686dfd0 | ||
|
|
89eb10451c | ||
|
|
ceab7cc7ef | ||
|
|
5de9bf3794 | ||
|
|
02593a013c | ||
|
|
472038ec62 | ||
|
|
3a84d12f26 | ||
|
|
b621a12689 | ||
|
|
6ffa4efbaf | ||
|
|
e41169a9c7 | ||
|
|
46194b177b | ||
|
|
ff1f554e0b | ||
|
|
9c424b0f96 | ||
|
|
55b5248660 |
@@ -1,17 +1,14 @@
|
|||||||
image: registry.gitlab.com/openstapps/projectmanagement/node
|
image: registry.gitlab.com/openstapps/projectmanagement/node
|
||||||
|
|
||||||
cache:
|
|
||||||
key: ${CI_COMMIT_REF_SLUG}
|
|
||||||
paths:
|
|
||||||
- node_modules
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm install
|
- npm install
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- audit
|
||||||
- deploy
|
- deploy
|
||||||
|
- publish
|
||||||
|
|
||||||
build:
|
build:
|
||||||
tags:
|
tags:
|
||||||
@@ -25,7 +22,7 @@ build:
|
|||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
||||||
audit:
|
audit:
|
||||||
stage: test
|
stage: audit
|
||||||
script:
|
script:
|
||||||
- npm audit
|
- npm audit
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
@@ -33,9 +30,9 @@ audit:
|
|||||||
- schedules
|
- schedules
|
||||||
|
|
||||||
scheduled-audit:
|
scheduled-audit:
|
||||||
stage: test
|
stage: audit
|
||||||
script:
|
script:
|
||||||
- npm audit
|
- npm audit --audit-level=high
|
||||||
only:
|
only:
|
||||||
- schedules
|
- schedules
|
||||||
|
|
||||||
@@ -50,6 +47,21 @@ test:
|
|||||||
- report
|
- report
|
||||||
- coverage
|
- coverage
|
||||||
|
|
||||||
|
package:
|
||||||
|
dependencies:
|
||||||
|
- build
|
||||||
|
tags:
|
||||||
|
- secrecy
|
||||||
|
stage: publish
|
||||||
|
script:
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
|
||||||
|
- npm publish
|
||||||
|
only:
|
||||||
|
- /^v[0-9]+.[0-9]+.[0-9]+$/
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- lib
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
|
|||||||
5
.mailmap
Normal file
5
.mailmap
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <git@killinger.co>
|
||||||
|
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinge@hrz.uni-frankfurt.de>
|
||||||
|
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinger@hrz.uni-frankfurt.de>
|
||||||
|
Wieland Schöbl <wulkanat@gmail.com> wulkanat@gmail.com <wulkanat@gmail.com>
|
||||||
|
Wieland Schöbl <wulkanat@gmail.com> Wieland Schöbl <wieland.schoebl@campus.tu-berlin.de>
|
||||||
284
CHANGELOG.md
284
CHANGELOG.md
@@ -1,11 +1,237 @@
|
|||||||
|
# [0.44.0](https://gitlab.com/openstapps/core/compare/v0.43.0...v0.44.0) (2021-04-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add support for multiple values in the value filter ([913c569](https://gitlab.com/openstapps/core/commit/913c5691da46ad2591fe14bcf7286f12b29ab5ee))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.43.0](https://gitlab.com/openstapps/core/compare/v0.42.0...v0.43.0) (2021-04-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.42.0](https://gitlab.com/openstapps/core/compare/v0.41.0...v0.42.0) (2021-02-16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.41.0](https://gitlab.com/openstapps/core/compare/v0.40.0...v0.41.0) (2021-02-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add date, numeric range filter to SCSearchFilter ([8510f11](https://gitlab.com/openstapps/core/commit/8510f11d7b4c62a6b239a70f47fe07e8cc86ab63))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.40.0](https://gitlab.com/openstapps/core/compare/v0.39.0...v0.40.0) (2021-02-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add range filter, date sorting support ([29bc006](https://gitlab.com/openstapps/core/commit/29bc00616e87a8d346d8c304fab2e3818921c75e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.39.0](https://gitlab.com/openstapps/core/compare/v0.38.1...v0.39.0) (2020-12-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* extend property value translation retrival ([a246bde](https://gitlab.com/openstapps/core/commit/a246bdea84e0ca390be6ab38723d637626db87d2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.38.1](https://gitlab.com/openstapps/core/compare/v0.38.0...v0.38.1) (2020-11-02)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.38.0](https://gitlab.com/openstapps/core/compare/v0.37.0...v0.38.0) (2020-10-30)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.37.0](https://gitlab.com/openstapps/core/compare/v0.36.0...v0.37.0) (2020-09-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove keyword tag from steps ([c369c85](https://gitlab.com/openstapps/core/commit/c369c8520a2eed169555a35a50ce745c08e1f9da))
|
||||||
|
* remove redundant property declaration ([66075ef](https://gitlab.com/openstapps/core/commit/66075ef99b95198a9cd5c0a396603e089221bcd9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.36.0](https://gitlab.com/openstapps/core/compare/v0.35.0...v0.36.0) (2020-07-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add function to get translated SCThingType ([fe7f1a5](https://gitlab.com/openstapps/core/commit/fe7f1a53ae46e052e23f1b39851f1547b5a8dded))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.35.0](https://gitlab.com/openstapps/core/compare/v0.34.0...v0.35.0) (2020-05-13)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.34.0](https://gitlab.com/openstapps/core/compare/v0.33.0...v0.34.0) (2020-04-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add [@sortable](https://gitlab.com/sortable) tags to certain translatable properties ([f5e8856](https://gitlab.com/openstapps/core/commit/f5e88569eb75578febbcde67259c0c14563e53fe))
|
||||||
|
* annotate SCThing uid and url as filterable ([70c1a3e](https://gitlab.com/openstapps/core/commit/70c1a3eaa3d1c88f4b86f0df86d0d362ad1f930c))
|
||||||
|
* Update src/things/book.ts - made ISBN optional ([6060113](https://gitlab.com/openstapps/core/commit/6060113df56b871bb5014a8a961974895e52158f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.33.0](https://gitlab.com/openstapps/core/compare/v0.32.0...v0.33.0) (2020-02-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.32.0](https://gitlab.com/openstapps/core/compare/v0.31.0...v0.32.0) (2020-02-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* make SCContactPoint extend SCThing ([0d89b14](https://gitlab.com/openstapps/core/commit/0d89b1493293f83e9096615f653a6094519d59f2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.31.0](https://gitlab.com/openstapps/core/compare/v0.30.0...v0.31.0) (2019-11-14)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove categories from custom translations ([9658f05](https://gitlab.com/openstapps/core/commit/9658f05d31366b3735da3aa548ef5ed0255d8054))
|
||||||
|
* translator can now handle enum translations ([abda5cf](https://gitlab.com/openstapps/core/commit/abda5cf0caead37f085431e1e5a9771b79272ec6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.30.0](https://gitlab.com/openstapps/core/compare/v0.29.0...v0.30.0) (2019-11-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add aggregatable tag for type field ([443cb74](https://gitlab.com/openstapps/core/commit/443cb748fba1575f5f1e16c550fd33eb7fa7901c))
|
||||||
|
* add new field sequenceIndex to message ([01f92ba](https://gitlab.com/openstapps/core/commit/01f92baa985013bfe1c79fad60351fdaf44bd676))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.29.0](https://gitlab.com/openstapps/core/compare/v0.28.0...v0.29.0) (2019-09-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add mappingIgnoredTags property to SCBackend ([149f3ff](https://gitlab.com/openstapps/core/commit/149f3ffff15dce27337665abba520d11bc3014dd))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.28.0](https://gitlab.com/openstapps/core/compare/v0.27.0...v0.28.0) (2019-09-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add onlyOnType field for SCFacet ([fba63db](https://gitlab.com/openstapps/core/commit/fba63db137c52212113545be1062d760f0c4213f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.27.0](https://gitlab.com/openstapps/core/compare/v0.26.0...v0.27.0) (2019-09-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add [@filterable](https://gitlab.com/filterable) tags ([fec3371](https://gitlab.com/openstapps/core/commit/fec33715add996ae0a7125ad00ee043d288c6671))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.26.0](https://gitlab.com/openstapps/core/compare/v0.25.0...v0.26.0) (2019-08-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* complete german translations ([bad15dc](https://gitlab.com/openstapps/core/commit/bad15dc8728954ee6ee23fa68c471647328830b9))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add pluginRequestTimeout field to backend config ([88f579e](https://gitlab.com/openstapps/core/commit/88f579e09bc5e7726dbc4fc788737ba49a0801cd))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.25.0](https://gitlab.com/openstapps/core/compare/v0.24.0...v0.25.0) (2019-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* correct package job ([d4a8ef6](https://gitlab.com/openstapps/core/commit/d4a8ef6a9ca69849f8b981804da45e4ba907f37b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.24.0](https://gitlab.com/openstapps/core/compare/v0.23.1...v0.24.0) (2019-07-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6de5cc7572b9218df959247b93cb2db305))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.23.1](https://gitlab.com/openstapps/core/compare/v0.23.0...v0.23.1) (2019-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* use correct generic for the distance filter ([f262a6b](https://gitlab.com/openstapps/core/commit/f262a6b8fa7a9d40234569ec490d5ef8e9437a75))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add type maps from routes to requests and responses ([e1d4b2b](https://gitlab.com/openstapps/core/commit/e1d4b2bc9de60a2332788c9a2264760d151c8813)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.23.0](https://gitlab.com/openstapps/core/compare/v0.22.0...v0.23.0) (2019-07-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add mapping type from response to request and vice versa ([c18e3c1](https://gitlab.com/openstapps/core/commit/c18e3c15f1940338b6872343f6b20dba6346f84b)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
|
||||||
|
* support 404 (resource not found) error on plugin register route ([43851d2](https://gitlab.com/openstapps/core/commit/43851d2d358c4c342a80a863b059a6447c819c04))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.22.0](https://gitlab.com/openstapps/core/compare/v0.21.0...v0.22.0) (2019-06-28)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.21.0](https://gitlab.com/openstapps/core/compare/v0.20.0...v0.21.0) (2019-06-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0f96da26d3aae9ffaadb2c640e7369ca7e))
|
||||||
|
* add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554e0beacb5ce2f3308c8212e2b8e4d8cbb0)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [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/f847a2aa0cf576e2fd79197cdc7795638d929136))
|
||||||
|
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64bae08d9ca12badaedf921a24fa5ffe90552))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
|
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
### 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)
|
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507ee341af75cd15dddeeb3f4cbe08899434c)), 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)
|
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20bd098032745ed0eb6978902b6ff6feac5)), 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)
|
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7841e9c38e68c9e5c718377a9c04fe50d6)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -14,7 +240,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790ad))
|
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790adbd82417923d79b4a5a35c74fcaab3e050))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -31,13 +257,13 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042))
|
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042428e24a04b73fb03d71c01353588419a7))
|
||||||
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed61)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed613a9405b53a86a33c13d48bc49d48de1ce)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/3242411))
|
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/324241176849b338bee9f5d1dcaf1109f47a8bb9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +272,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/8188731))
|
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/81887315f8c3038ec37c2197db8e193da835f6fc))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -55,14 +281,14 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9))
|
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9eb810de94ca0bb6e1298799ee3f550145))
|
||||||
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fca))
|
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fcac42c21c68b5c6aa6bcf9bbdecfdf84de7))
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2e)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
|
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2eae7f44ec4a284cc26fc85051a9a45e192)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
|
||||||
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d4879e6ce8f43d4cebb9d8c8500d5d16b7)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -71,12 +297,12 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* add todo to SCThingsWithoutDiff and SCClasses ([9a49442](https://gitlab.com/openstapps/core/commit/9a49442)), closes [#39](https://gitlab.com/openstapps/core/issues/39)
|
* add todo to SCThingsWithoutDiff and SCClasses ([9a49442](https://gitlab.com/openstapps/core/commit/9a49442902a9f49439083a9197bd9f0a231d007d)), closes [#39](https://gitlab.com/openstapps/core/issues/39)
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add SCThingTranslator class. move functionality accordingly ([90e3d22](https://gitlab.com/openstapps/core/commit/90e3d22))
|
* add SCThingTranslator class. move functionality accordingly ([90e3d22](https://gitlab.com/openstapps/core/commit/90e3d2239921bbfcea27b64aef9344ffee270b6d))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -85,8 +311,8 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add laboratory and computer as room categories ([a0ab72e](https://gitlab.com/openstapps/core/commit/a0ab72e)), closes [#33](https://gitlab.com/openstapps/core/issues/33)
|
* add laboratory and computer as room categories ([a0ab72e](https://gitlab.com/openstapps/core/commit/a0ab72e597f6a14cfc0bd8935e1ef765b86b90f7)), closes [#33](https://gitlab.com/openstapps/core/issues/33)
|
||||||
* add maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e))
|
* add maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e40bfb49463815538ebaa44ff53b5d7b92))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +321,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6))
|
* add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6d11cba836a55cbd5787d68cfe655b68a6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -108,7 +334,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab473))
|
* add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab47397e2a33b1c460b9038cbf53fec148316d))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +351,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add model for syntax error ([a3f9fcb](https://gitlab.com/openstapps/core/commit/a3f9fcb))
|
* add model for syntax error ([a3f9fcb](https://gitlab.com/openstapps/core/commit/a3f9fcbfb0c35206adabc95792de076518f604f7))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -134,7 +360,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add draft of todo ([2860a11](https://gitlab.com/openstapps/core/commit/2860a11))
|
* add draft of todo ([2860a11](https://gitlab.com/openstapps/core/commit/2860a11b618081ab88ecb1780a280cab37217a0e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -143,13 +369,13 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* set larger v8 stack size ([d3d08e7](https://gitlab.com/openstapps/core/commit/d3d08e7))
|
* set larger v8 stack size ([d3d08e7](https://gitlab.com/openstapps/core/commit/d3d08e7735808d4eae5aab4b263e36047c608679))
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add different origin types: remote and user ([13a4965](https://gitlab.com/openstapps/core/commit/13a4965)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
* add different origin types: remote and user ([13a4965](https://gitlab.com/openstapps/core/commit/13a49650c4498f6edbe17c9de3598e0180b866da)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||||
* add saveable thing for saving user/client data ([a4f3fab](https://gitlab.com/openstapps/core/commit/a4f3fab)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
* add saveable thing for saving user/client data ([a4f3fab](https://gitlab.com/openstapps/core/commit/a4f3fab033ca18352c0119061f2d0e64252d4bbb)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -158,7 +384,7 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* use tag [@validatable](https://gitlab.com/validatable) to mark schema types ([7f248ee](https://gitlab.com/openstapps/core/commit/7f248ee))
|
* use tag [@validatable](https://gitlab.com/validatable) to mark schema types ([7f248ee](https://gitlab.com/openstapps/core/commit/7f248eea13c732a95c4ee8e1bc91afeee52e8c2d))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -167,9 +393,9 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc4))
|
* add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc49c14b0ce45cf0cfdaf46c1ebe43b23ec7))
|
||||||
* add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a))
|
* add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a555603a395c81a7a92ce5d95ed04de9de))
|
||||||
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2))
|
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2d676895264f43b0138645d7c13f60c9db))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -177,12 +403,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.0.1](https://gitlab.com/openstapps/core/compare/2d770dd...v0.0.1) (2018-11-29)
|
## [0.0.1](https://gitlab.com/openstapps/core/compare/2d770dde4464dc4cf4cdc29927aa4e4382914148...v0.0.1) (2018-11-29)
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* add core ([2d770dd](https://gitlab.com/openstapps/core/commit/2d770dd))
|
* add core ([2d770dd](https://gitlab.com/openstapps/core/commit/2d770dde4464dc4cf4cdc29927aa4e4382914148))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,33 @@ The [core tools](https://openstapps.gitlab.io/core-tools) are more or less not d
|
|||||||
|
|
||||||
App and connectors should be updated regularly to new releases of the core but not as important like API and backend. Since the app is just a view for the data stored in the backend it is not necessary to be up to date with the newest core immediately and the connectors are developed independently by every school and up to their responsibility.
|
App and connectors should be updated regularly to new releases of the core but not as important like API and backend. Since the app is just a view for the data stored in the backend it is not necessary to be up to date with the newest core immediately and the connectors are developed independently by every school and up to their responsibility.
|
||||||
|
|
||||||
|
## Adding new Types
|
||||||
|
|
||||||
|
Adding new types requires changes at multiple locations for it to work correctly
|
||||||
|
|
||||||
|
### Required changes
|
||||||
|
* Add your SCThing and SCThingWithoutReferences to `src/things/your-thing-name.ts` and make them extend `SCThingWithoutReferences` and `SCThing` respectively
|
||||||
|
* Add your SCThingMeta to `src/things/your-thing-name.ts` and make it extend `SCThingMeta`
|
||||||
|
* Add your SCThingMeta to `SCClasses` in `src/meta.ts`
|
||||||
|
* Add your SCThing to `SCThingsWithoutDiff` in `src/meta.ts`
|
||||||
|
* Add your SCThingWithoutReferences to `SCAssociatedThingWithoutReferences` in `src/meta.ts`
|
||||||
|
* Add your SCThing to `SCAssociatedThing` in `src/meta.ts`
|
||||||
|
* Add your SCThing to the `SCThingType` enum in `src/things/abstract/thing.ts`
|
||||||
|
* Add an example file for your SCThing in `test/resources/YourThingName.json`
|
||||||
|
* Add the following lines for your SCThing in `test/type.spec.ts`:
|
||||||
|
```typescript
|
||||||
|
/**
|
||||||
|
* Types of properties of SCYourThingName
|
||||||
|
*/
|
||||||
|
type SCYourThingNamePropertyTypes = PropertyTypesNested<SCYourThingName>;
|
||||||
|
assert<NotHas<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCYourThingNamePropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCYourThingNamePropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCYourThingNameWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCYourThingName, SCThing>>(true);
|
||||||
|
```
|
||||||
|
|
||||||
## Additional coding style
|
## Additional coding style
|
||||||
|
|
||||||
### Extract inline type definitions
|
### Extract inline type definitions
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -29,3 +29,24 @@ To generate a documentation for the routes use the following command.
|
|||||||
```shell
|
```shell
|
||||||
node --require ts-node/register src/cli.ts routes PATH/TO/ROUTES.md
|
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 | whether the property is being used on the top type or across all types: `global` |
|
||||||
|
| `@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. Fields are always sortable through generic sort, even without annotation. | sort method to be used: `ducet`, `price`, `distance` |
|
||||||
|
| `@text` | string field is interpreted as text | |
|
||||||
|
| `@date` | string field is interpreted as a date field | |
|
||||||
|
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |
|
||||||
|
| `@filterable` | non-object/nested field is filterable if the core schema is used to put data into a database/key-value store | |
|
||||||
|
| `@inheritTags` | inherit all tags from another field | `[SCThingType]::[field]` |
|
||||||
|
|
||||||
|
*Note: tags ignore casing, but for consistency they should use the variants proposed here.*
|
||||||
|
|||||||
4807
package-lock.json
generated
4807
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
99
package.json
99
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.20.0",
|
"version": "0.45.0",
|
||||||
"description": "StAppsCore - Generalized model of data",
|
"description": "StAppsCore - Generalized model of data",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Model",
|
"Model",
|
||||||
@@ -20,75 +20,92 @@
|
|||||||
"compile": "rimraf lib && tsc",
|
"compile": "rimraf lib && tsc",
|
||||||
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
||||||
"pack": "openstapps-core-tools pack",
|
"pack": "openstapps-core-tools pack",
|
||||||
|
"postversion": "npm run changelog",
|
||||||
"prepublishOnly": "npm ci && npm run build",
|
"prepublishOnly": "npm ci && npm run build",
|
||||||
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
|
"preversion": "npm run prepublishOnly",
|
||||||
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
|
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||||
"tslint": "tslint 'src/**/*.ts'"
|
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src lib/schema",
|
||||||
|
"test": "nyc mocha --require ts-node/register --recursive 'test/*.spec.ts'",
|
||||||
|
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
||||||
},
|
},
|
||||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
|
||||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
|
||||||
"Andreas Lehmann",
|
"Andreas Lehmann",
|
||||||
"Sebastian Lange",
|
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||||
"Rainer Killinger",
|
"Axel Nieder-Vahrenholz",
|
||||||
"Imran Hossain",
|
"Benjamin Jöckel",
|
||||||
|
"Frank Nagel",
|
||||||
|
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||||
"Michel Jonathan Schmitz",
|
"Michel Jonathan Schmitz",
|
||||||
|
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||||
|
"Roman Klopsch",
|
||||||
|
"Sebastian Lange",
|
||||||
"Wieland Schöbl"
|
"Wieland Schöbl"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@openstapps/core-tools": "0.19.0",
|
||||||
"@types/geojson": "1.0.6",
|
"@types/geojson": "1.0.6",
|
||||||
"@types/json-patch": "0.0.30",
|
"@types/json-patch": "0.0.30",
|
||||||
"@types/node": "10.14.6",
|
"@types/json-schema": "7.0.7",
|
||||||
|
"@types/node": "14.14.37",
|
||||||
"fast-clone": "1.5.13",
|
"fast-clone": "1.5.13",
|
||||||
|
"fast-deep-equal": "3.1.3",
|
||||||
|
"http-status-codes": "2.1.4",
|
||||||
"json-patch": "0.7.0",
|
"json-patch": "0.7.0",
|
||||||
"jsonschema": "1.2.4",
|
"json-schema": "0.3.0",
|
||||||
"ts-optchain": "0.1.3"
|
"ts-optchain": "0.1.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@krlwlfrt/async-pool": "0.1.0",
|
"@openstapps/configuration": "0.27.0",
|
||||||
"@openstapps/configuration": "0.14.0",
|
"@openstapps/logger": "0.6.0",
|
||||||
"@openstapps/core-tools": "0.6.0",
|
"@testdeck/mocha": "0.1.2",
|
||||||
"@openstapps/logger": "0.1.0",
|
"@types/chai": "4.2.16",
|
||||||
"@types/chai": "4.1.7",
|
"@types/rimraf": "3.0.0",
|
||||||
"@types/rimraf": "2.0.2",
|
"chai": "4.3.4",
|
||||||
"chai": "4.2.0",
|
"conditional-type-checks": "1.0.5",
|
||||||
"commander": "2.20.0",
|
"conventional-changelog-cli": "2.1.1",
|
||||||
"conventional-changelog-cli": "2.0.21",
|
"mocha": "8.3.2",
|
||||||
"mocha": "6.1.4",
|
"nyc": "15.1.0",
|
||||||
"mocha-typescript": "1.1.17",
|
"rimraf": "3.0.2",
|
||||||
"nyc": "14.1.1",
|
"source-map-support": "0.5.19",
|
||||||
"rimraf": "2.6.3",
|
"ts-node": "9.1.1",
|
||||||
"source-map-support": "0.5.12",
|
"tslint": "6.1.3",
|
||||||
"ts-node": "8.1.0",
|
"typedoc": "0.18.0",
|
||||||
"tslint": "5.16.0",
|
"typescript": "3.8.3"
|
||||||
"typedoc": "0.14.2",
|
|
||||||
"typescript": "3.4.5"
|
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
|
"all": true,
|
||||||
|
"branches": 90,
|
||||||
"check-coverage": true,
|
"check-coverage": true,
|
||||||
"per-file": true,
|
|
||||||
"lines": 95,
|
|
||||||
"statements": 95,
|
|
||||||
"functions": 95,
|
|
||||||
"branches": 85,
|
|
||||||
"include": [
|
|
||||||
"src/core/Route.ts",
|
|
||||||
"src/core/Thing.ts",
|
|
||||||
"src/core/Translator.ts"
|
|
||||||
],
|
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
"extension": [
|
"extension": [
|
||||||
".ts"
|
".ts"
|
||||||
],
|
],
|
||||||
|
"functions": 95,
|
||||||
|
"include": [
|
||||||
|
"src/protocol/route.ts",
|
||||||
|
"src/things/abstract/thing.ts",
|
||||||
|
"src/things/abstract/thing-that-can-be-offered.ts",
|
||||||
|
"src/things/abstract/thing-with-categories.ts",
|
||||||
|
"src/translator.ts",
|
||||||
|
"src/guards.ts"
|
||||||
|
],
|
||||||
|
"lines": 95,
|
||||||
|
"per-file": true,
|
||||||
"reporter": [
|
"reporter": [
|
||||||
"html",
|
"html",
|
||||||
"text-summary"
|
"text-summary"
|
||||||
],
|
],
|
||||||
"all": true
|
"require": [
|
||||||
|
"ts-node/register"
|
||||||
|
],
|
||||||
|
"statements": 95
|
||||||
},
|
},
|
||||||
"openstappsConfiguration": {
|
"openstappsConfiguration": {
|
||||||
"hasCli": false,
|
"hasCli": false,
|
||||||
|
"ignoreCiEntries": [
|
||||||
|
"build"
|
||||||
|
],
|
||||||
"standardBuild": false,
|
"standardBuild": false,
|
||||||
"standardDocumentation": false
|
"standardDocumentation": false
|
||||||
}
|
}
|
||||||
|
|||||||
100109
reflection.json
100109
reflection.json
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Polygon} from 'geojson';
|
import {Polygon} from 'geojson';
|
||||||
import {SCSetting} from '../../things/Setting';
|
import {SCTranslations} from '../general/i18n';
|
||||||
import {SCTranslations} from '../i18n';
|
import {SCSetting} from '../things/setting';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An app configuration menu item
|
* An app configuration menu item
|
||||||
@@ -126,11 +127,11 @@ export interface SCAppConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Map of features
|
||||||
*/
|
*/
|
||||||
export interface SCAppConfigurationFeature {
|
export interface SCAppConfigurationFeature {
|
||||||
/**
|
/**
|
||||||
*
|
* Whether or not widgets are enabled
|
||||||
*/
|
*/
|
||||||
widgets: boolean;
|
widgets: boolean;
|
||||||
}
|
}
|
||||||
@@ -148,7 +149,7 @@ export interface SCAppConfigurationStoreUrl {
|
|||||||
*/
|
*/
|
||||||
ios?: string;
|
ios?: string;
|
||||||
/**
|
/**
|
||||||
* Microsoft Store URL
|
* Microsoft Store URL
|
||||||
*/
|
*/
|
||||||
uwp?: string;
|
uwp?: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,23 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingType} from '../../Thing';
|
import {SCMap, SCRestrictedMap} from '../general/map';
|
||||||
import {SCSearchSortType} from '../sorts/Abstract';
|
import {SCUuid} from '../general/uuid';
|
||||||
import {SCUuid} from '../UUID';
|
import {SCSearchSortType} from '../protocol/search/sort';
|
||||||
import {SCMap, SCRestrictedMap} from './../Map';
|
import {SCThingType} from '../things/abstract/thing';
|
||||||
import {SCMonitoringConfiguration} from './Monitoring';
|
import {SCMonitoringConfiguration} from './monitoring';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A backend configuration
|
* A backend configuration
|
||||||
*/
|
*/
|
||||||
export interface SCBackendConfiguration {
|
export interface SCBackendConfiguration {
|
||||||
|
/**
|
||||||
|
* The maximum amount of time (milliseconds) an external program can take to provide a response to the backend
|
||||||
|
*
|
||||||
|
* This can be used for example for Plugins.
|
||||||
|
*/
|
||||||
|
externalRequestTimeout: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of hidden SC types
|
* A list of hidden SC types
|
||||||
*
|
*
|
||||||
@@ -30,6 +37,13 @@ export interface SCBackendConfiguration {
|
|||||||
*/
|
*/
|
||||||
hiddenTypes: SCThingType[];
|
hiddenTypes: SCThingType[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of tags that will be ignored by the mapping generator
|
||||||
|
*
|
||||||
|
* The ignored tags should mainly be tags that are irrelevant to the mapping. The tags should include the '@'.
|
||||||
|
*/
|
||||||
|
mappingIgnoredTags: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of queries, that can be used in MultiSearchRoute
|
* Maximum number of queries, that can be used in MultiSearchRoute
|
||||||
*/
|
*/
|
||||||
@@ -96,10 +110,8 @@ export type SCSearchContext =
|
|||||||
* A boosting configuration for one context
|
* A boosting configuration for one context
|
||||||
*/
|
*/
|
||||||
export type SCBackendConfigurationSearchBoostingContext =
|
export type SCBackendConfigurationSearchBoostingContext =
|
||||||
SCRestrictedMap<
|
SCRestrictedMap<SCSearchContext,
|
||||||
SCSearchContext,
|
SCBackendConfigurationSearchBoostingType[]>;
|
||||||
SCBackendConfigurationSearchBoostingType[]
|
|
||||||
>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A boosting configuration for one SCType
|
* A boosting configuration for one SCType
|
||||||
@@ -176,10 +188,9 @@ export interface SCBackendInternalConfiguration {
|
|||||||
/**
|
/**
|
||||||
* Configuration of the database
|
* 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 of the database used by the backend
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAppConfiguration} from '../types/config/App';
|
import {SCLicensePlate} from '../general/namespaces';
|
||||||
import {SCBackendConfiguration, SCBackendInternalConfiguration} from '../types/config/Backend';
|
import {SCAppConfiguration} from './app';
|
||||||
import {SCLicensePlate} from '../types/namespaces';
|
import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A configuration file that configures app and backend
|
* A configuration file that configures app and backend
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -140,7 +140,7 @@ export interface SCMonitoringWatcher {
|
|||||||
/**
|
/**
|
||||||
* Query to execute against the database
|
* Query to execute against the database
|
||||||
*/
|
*/
|
||||||
query: any;
|
query: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of triggers
|
* A list of triggers
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Possible HTTP verbs for routes
|
|
||||||
*/
|
|
||||||
import {SCErrorResponse} from './protocol/errors/ErrorResponse';
|
|
||||||
import {SCBookAvailabilityRequest} from './protocol/routes/bookAvailability/BookAvailabilityRequest';
|
|
||||||
import {SCBookAvailabilityResponse} from './protocol/routes/bookAvailability/BookAvailabilityResponse';
|
|
||||||
import {SCBulkRequest} from './protocol/routes/bulk/BulkRequest';
|
|
||||||
import {SCBulkResponse} from './protocol/routes/bulk/BulkResponse';
|
|
||||||
import {SCBulkAddRequest} from './protocol/routes/bulk/UID/BulkAddRequest';
|
|
||||||
import {SCBulkAddResponse} from './protocol/routes/bulk/UID/BulkAddResponse';
|
|
||||||
import {SCBulkDoneRequest} from './protocol/routes/bulk/UID/BulkDoneRequest';
|
|
||||||
import {SCBulkDoneResponse} from './protocol/routes/bulk/UID/BulkDoneResponse';
|
|
||||||
import {SCFeedbackRequest} from './protocol/routes/feedback/FeedbackRequest';
|
|
||||||
import {SCFeedbackResponse} from './protocol/routes/feedback/FeedbackResponse';
|
|
||||||
import {SCIndexRequest} from './protocol/routes/INDEX/IndexRequest';
|
|
||||||
import {SCIndexResponse} from './protocol/routes/INDEX/IndexResponse';
|
|
||||||
import {SCMultiSearchRequest} from './protocol/routes/search/MultiSearchRequest';
|
|
||||||
import {SCMultiSearchResponse} from './protocol/routes/search/MultiSearchResponse';
|
|
||||||
import {SCSearchRequest} from './protocol/routes/search/SearchRequest';
|
|
||||||
import {SCSearchResponse} from './protocol/routes/search/SearchResponse';
|
|
||||||
import {SCThingUpdateRequest} from './protocol/routes/TYPE/UID/ThingUpdateRequest';
|
|
||||||
import {SCThingUpdateResponse} from './protocol/routes/TYPE/UID/ThingUpdateResponse';
|
|
||||||
import {SCMap} from './types/Map';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible Verbs for HTTP requests
|
|
||||||
*/
|
|
||||||
export enum SCRouteHttpVerbs {
|
|
||||||
GET = 'GET',
|
|
||||||
POST = 'POST',
|
|
||||||
PUT = 'PUT',
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The constructor of an error response
|
|
||||||
*/
|
|
||||||
export type SCErrorResponseConstructor = new (...args: any) => SCErrorResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A description of a route
|
|
||||||
*/
|
|
||||||
export interface SCRoute {
|
|
||||||
/**
|
|
||||||
* A map of names of possible errors that can be returned by the route with their appropriate status codes
|
|
||||||
*/
|
|
||||||
errorNames: SCErrorResponseConstructor[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP verb to use to request the route
|
|
||||||
*/
|
|
||||||
method: SCRouteHttpVerbs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map of obligatory parameters and their type that have to be set via the requested path
|
|
||||||
*/
|
|
||||||
obligatoryParameters?: SCMap<string>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the type of the request body
|
|
||||||
*/
|
|
||||||
requestBodyName: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the type of the response body
|
|
||||||
*/
|
|
||||||
responseBodyName: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Status code for success
|
|
||||||
*/
|
|
||||||
statusCodeSuccess: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* URL fragment of the route
|
|
||||||
*/
|
|
||||||
urlFragment: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An abstract route
|
|
||||||
*/
|
|
||||||
export abstract class SCAbstractRoute implements SCRoute {
|
|
||||||
errorNames: SCErrorResponseConstructor[] = [];
|
|
||||||
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
|
|
||||||
obligatoryParameters?: SCMap<string>;
|
|
||||||
requestBodyName = 'any';
|
|
||||||
responseBodyName = 'any';
|
|
||||||
statusCodeSuccess = 200;
|
|
||||||
urlFragment = '/';
|
|
||||||
|
|
||||||
public getUrlFragment(parameters?: SCMap<string>): string {
|
|
||||||
if (typeof parameters === 'undefined') {
|
|
||||||
parameters = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
let obligatoryParameters: string[] = [];
|
|
||||||
|
|
||||||
if (typeof this.obligatoryParameters === 'object') {
|
|
||||||
obligatoryParameters = Object.keys(this.obligatoryParameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.keys(parameters).length > obligatoryParameters.length) {
|
|
||||||
throw new Error('Extraneous parameters provided.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.urlFragment
|
|
||||||
.split('/')
|
|
||||||
.map((part) => {
|
|
||||||
if (part.indexOf(':') !== 0) {
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
|
|
||||||
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('/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible requests
|
|
||||||
*/
|
|
||||||
export type SCRequests =
|
|
||||||
SCBookAvailabilityRequest
|
|
||||||
| SCBulkRequest
|
|
||||||
| SCBulkAddRequest
|
|
||||||
| SCBulkDoneRequest
|
|
||||||
| SCFeedbackRequest
|
|
||||||
| SCIndexRequest
|
|
||||||
| SCMultiSearchRequest
|
|
||||||
| SCSearchRequest
|
|
||||||
| SCThingUpdateRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible responses
|
|
||||||
*/
|
|
||||||
export type SCResponses =
|
|
||||||
SCBookAvailabilityResponse
|
|
||||||
| SCBulkResponse
|
|
||||||
| SCBulkAddResponse
|
|
||||||
| SCBulkDoneResponse
|
|
||||||
| SCFeedbackResponse
|
|
||||||
| SCIndexResponse
|
|
||||||
| SCMultiSearchResponse
|
|
||||||
| SCSearchResponse
|
|
||||||
| SCThingUpdateResponse;
|
|
||||||
@@ -1,246 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018-2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
import {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
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCErrorResponse extends Error {
|
|
||||||
/**
|
|
||||||
* Additional data that describes the error
|
|
||||||
*/
|
|
||||||
additionalData?: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP status code to return this error with
|
|
||||||
*/
|
|
||||||
statusCode: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that can be created by the backend during the processing of a request
|
|
||||||
*/
|
|
||||||
export abstract class SCError implements SCErrorResponse {
|
|
||||||
/**
|
|
||||||
* Call stack of the error
|
|
||||||
*/
|
|
||||||
stack?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instatiate an SCError
|
|
||||||
*
|
|
||||||
* @param name Name of the error
|
|
||||||
* @param message Message of the error
|
|
||||||
* @param statusCode HTTP status code to return this error with
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
*/
|
|
||||||
constructor(public name: string, public message: string, public statusCode: number, stack?: boolean) {
|
|
||||||
// generate stacktrace if needed
|
|
||||||
if (stack) {
|
|
||||||
this.stack = (new Error()).stack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned when the validation of a request fails
|
|
||||||
*/
|
|
||||||
export class SCValidationErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* List of validatation errors
|
|
||||||
*/
|
|
||||||
additionalData: ValidationError[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a SCValidationErrorResponse
|
|
||||||
*
|
|
||||||
* @param errors List of validation errors
|
|
||||||
* @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);
|
|
||||||
this.additionalData = errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned when the content type of the request is not supported
|
|
||||||
*/
|
|
||||||
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a SCUnsupportedMediaTypeErrorResponse
|
|
||||||
*
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
*/
|
|
||||||
constructor(stack?: boolean) {
|
|
||||||
super('UnsupportedMediaTypeError', 'Unsupported media type', 415, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
|
||||||
*/
|
|
||||||
export class SCMethodNotAllowedErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a SCMethodNotAllowedErrorResponse
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned, when the request body is too large.
|
|
||||||
*/
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned, when to many request are submitted at once
|
|
||||||
*/
|
|
||||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a SCTooManyRequestsErrorResponse
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned when the requested route or resource was not found
|
|
||||||
*/
|
|
||||||
export class SCNotFoundErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a SCNotFoundErrorResponse
|
|
||||||
*
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
*/
|
|
||||||
constructor(stack?: boolean) {
|
|
||||||
super('NotFoundError', 'Resource not found', 404, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
|
|
||||||
* acceptable.
|
|
||||||
*/
|
|
||||||
export class SCParametersNotAcceptable extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a ParametersNotAcceptable
|
|
||||||
*
|
|
||||||
* @param message contains more details to what you did wrong
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
*/
|
|
||||||
constructor(message: string, stack?: boolean) {
|
|
||||||
super('ParametersNotAcceptable', message, 406, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
|
|
||||||
* running at the same time.
|
|
||||||
* This usually indicates that there is more than one instance a plugin running.
|
|
||||||
*/
|
|
||||||
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* 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 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, plugin: SCPluginMetaData, stack?: boolean) {
|
|
||||||
super('SCPluginAlreadyRegisteredError', message, 409, stack);
|
|
||||||
if (stack) {
|
|
||||||
this.additionalData = plugin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned whenever there is an unexpected error while creating a plugin
|
|
||||||
*/
|
|
||||||
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a PluginRegisteringFailedError
|
|
||||||
*
|
|
||||||
* @param message Describes what went wrong wile registering the plugin
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
*/
|
|
||||||
constructor(message: string, stack?: boolean) {
|
|
||||||
super('PluginRegisteringFailedError', message, 500, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned whenever there is a syntax error
|
|
||||||
*/
|
|
||||||
export class SCSyntaxErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Create a SyntaxError
|
|
||||||
*
|
|
||||||
* @param message Describes the syntax error
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
*/
|
|
||||||
constructor(message: string, stack?: boolean) {
|
|
||||||
super('SyntaxError', message, 400, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An error that is returned, when an internal server error occurred
|
|
||||||
*/
|
|
||||||
export class SCInternalServerErrorResponse extends SCError {
|
|
||||||
/**
|
|
||||||
* Internal error that occurred. If the stack is disabled this error is not set for security reasons
|
|
||||||
*/
|
|
||||||
additionalData?: Error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a SCInternalServerErrorResponse
|
|
||||||
*
|
|
||||||
* @param err Internal server error
|
|
||||||
* @param stack Set to true if a stack trace should be created
|
|
||||||
* and the internal server error should be displayed to the client
|
|
||||||
*/
|
|
||||||
constructor(err?: Error, stack?: boolean) {
|
|
||||||
super('InternalServerError', 'Internal server error', 502, stack);
|
|
||||||
|
|
||||||
if (stack) {
|
|
||||||
this.additionalData = err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
import {SCAppConfiguration} from '../../../types/config/App';
|
|
||||||
import {SCBackendConfiguration} from '../../../types/config/Backend';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A response to an index request
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCIndexResponse {
|
|
||||||
app: SCAppConfiguration;
|
|
||||||
|
|
||||||
backend: SCBackendConfiguration;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Response for an entity update request
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCThingUpdateResponse {
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/ThingThatCanBeOffered';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of availabilities of a book
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Response to a request to add a thing to a bulk
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCBulkAddResponse {
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Response to a request to change the state of a bulk to done
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCBulkDoneResponse {
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* A response to a feedback request
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCFeedbackResponse {
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018-2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
import {SCMap} from '../../../types/Map';
|
|
||||||
import {SCSearchResult} from './SearchResponse';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A multi search response
|
|
||||||
*
|
|
||||||
* This is a map of [[SCSearchResponse]]s indexed by name
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export type SCMultiSearchResponse = SCMap<SCSearchResult>;
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse';
|
|
||||||
import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse';
|
|
||||||
import {SCSearchResponse} from '../protocol/routes/search/SearchResponse';
|
|
||||||
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
|
||||||
import {SCTranslations} from './i18n';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to check if something is a SCThing
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to check if translations exist
|
|
||||||
*
|
|
||||||
* @param thing Thing to check
|
|
||||||
*/
|
|
||||||
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
|
||||||
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties> } {
|
|
||||||
return typeof thing.translations !== 'undefined';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to check if something is a bulk response
|
|
||||||
*
|
|
||||||
* @param 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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to check if something is a search response
|
|
||||||
*
|
|
||||||
* @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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to check if something is a multi search response
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -18,18 +18,22 @@
|
|||||||
export interface SCLanguage {
|
export interface SCLanguage {
|
||||||
/**
|
/**
|
||||||
* The two letter ISO 639-1 Code of the Language
|
* The two letter ISO 639-1 Code of the Language
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
code: SCLanguageCode;
|
code: SCLanguageCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Fulltext name of the Language
|
* The Fulltext name of the Language
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
name: SCLanguageName;
|
name: SCLanguageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of possible languages in english
|
* A list of possible languages in english
|
||||||
*
|
*
|
||||||
* @see https://en.wikipedia.org/wiki/ISO_639-1
|
* @see https://en.wikipedia.org/wiki/ISO_639-1
|
||||||
*/
|
*/
|
||||||
export type SCLanguageName =
|
export type SCLanguageName =
|
||||||
@@ -221,7 +225,7 @@ export type SCLanguageName =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A List of all possible Languages as ISO 639-1 Codes
|
* A List of all possible Languages as ISO 639-1 Codes
|
||||||
*
|
*
|
||||||
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||||
*/
|
*/
|
||||||
export type SCLanguageCode =
|
export type SCLanguageCode =
|
||||||
@@ -691,9 +695,9 @@ export interface SCTranslations<T> {
|
|||||||
*/
|
*/
|
||||||
type RecursivePartial<T> = {
|
type RecursivePartial<T> = {
|
||||||
[P in keyof T]-?:
|
[P in keyof T]-?:
|
||||||
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
|
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
|
||||||
T[P] extends object ? RecursivePartial<T[P]> :
|
T[P] extends object ? RecursivePartial<T[P]> :
|
||||||
T[P];
|
T[P];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -714,6 +718,12 @@ type SCRequiredTranslation<T> = {
|
|||||||
* Interface to be implemented by all Meta classes
|
* Interface to be implemented by all Meta classes
|
||||||
*/
|
*/
|
||||||
export interface SCMetaTranslations<T> {
|
export interface SCMetaTranslations<T> {
|
||||||
|
/**
|
||||||
|
* Field translations
|
||||||
|
*/
|
||||||
fieldTranslations: SCRequiredTranslation<T>;
|
fieldTranslations: SCRequiredTranslation<T>;
|
||||||
fieldValueTranslations: any;
|
/**
|
||||||
|
* Field value translations
|
||||||
|
*/
|
||||||
|
fieldValueTranslations: unknown;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -18,6 +18,8 @@
|
|||||||
*
|
*
|
||||||
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
|
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
|
||||||
* @see https://gist.github.com/philipashlock/8830168
|
* @see https://gist.github.com/philipashlock/8830168
|
||||||
|
*
|
||||||
|
* @date
|
||||||
*/
|
*/
|
||||||
export type SCISO8601Date = string;
|
export type SCISO8601Date = string;
|
||||||
/* tslint:enable */
|
/* tslint:enable */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
/**
|
/**
|
||||||
* Universally unique identifier of the thing
|
* Universally unique identifier of the thing
|
||||||
*
|
*
|
||||||
|
* @filterable
|
||||||
* @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
|
* @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
|
||||||
* @see http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid
|
* @see http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid
|
||||||
*/
|
*/
|
||||||
126
src/guards.ts
Normal file
126
src/guards.ts
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* unknown WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {SCTranslations} from './general/i18n';
|
||||||
|
import {SCBulkResponse} from './protocol/routes/bulk-request';
|
||||||
|
import {SCSearchResponse} from './protocol/routes/search';
|
||||||
|
import {SCMultiSearchResponse} from './protocol/routes/search-multi';
|
||||||
|
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type guard to check if something is a SCThing
|
||||||
|
*
|
||||||
|
* @param something Something to check
|
||||||
|
*/
|
||||||
|
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 as SCThingType) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type guard to check if translations exist
|
||||||
|
*
|
||||||
|
* @param thing Thing to check
|
||||||
|
*/
|
||||||
|
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
||||||
|
// tslint:disable-next-line:completed-docs
|
||||||
|
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
|
||||||
|
return typeof thing.translations !== 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type guard to check if something is a bulk response
|
||||||
|
*
|
||||||
|
* @param something Something to check
|
||||||
|
*/
|
||||||
|
export function isBulkResponse(something: unknown): something is SCBulkResponse {
|
||||||
|
if (typeof something !== 'object' || something === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!('expiration' in something)
|
||||||
|
|| !('source' in something)
|
||||||
|
|| !('state' in something)
|
||||||
|
|| !('type' in something)
|
||||||
|
|| !('uid' in something)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {expiration, source, state, type, uid} = something as {
|
||||||
|
// tslint:disable:completed-docs
|
||||||
|
expiration: unknown;
|
||||||
|
source: unknown;
|
||||||
|
state: unknown;
|
||||||
|
type: unknown;
|
||||||
|
uid: unknown;
|
||||||
|
// tslint:enable
|
||||||
|
};
|
||||||
|
|
||||||
|
return typeof expiration === 'string'
|
||||||
|
&& typeof source === 'string'
|
||||||
|
&& typeof state === 'string'
|
||||||
|
&& typeof type === 'string'
|
||||||
|
&& typeof uid === 'string';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type guard to check if something is a search response
|
||||||
|
*
|
||||||
|
* @param something Something to check
|
||||||
|
*/
|
||||||
|
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';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type guard to check if something is a multi search response
|
||||||
|
*
|
||||||
|
* @param something Something to check
|
||||||
|
*/
|
||||||
|
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
|
||||||
|
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
|
||||||
|
|
||||||
|
return Object.keys(something as { [key: string]: string; })
|
||||||
|
.reduce((previousOnesAreSearchResponses, key) => {
|
||||||
|
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
|
||||||
|
}, initialValue as boolean);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,43 +12,45 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingType} from './Thing';
|
import {SCThingType} from './things/abstract/thing';
|
||||||
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/AcademicEvent';
|
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event';
|
||||||
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/Article';
|
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article';
|
||||||
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/Book';
|
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
|
||||||
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/Building';
|
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
|
||||||
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/Catalog';
|
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
|
||||||
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/CourseOfStudies';
|
import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point';
|
||||||
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/DateSeries';
|
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/course-of-studies';
|
||||||
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/Diff';
|
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
|
||||||
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/Dish';
|
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
|
||||||
import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/Favorite';
|
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish';
|
||||||
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/Floor';
|
import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/favorite';
|
||||||
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/Message';
|
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
|
||||||
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/Organization';
|
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
|
||||||
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/Person';
|
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
|
||||||
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/PointOfInterest';
|
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
|
||||||
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/Room';
|
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
|
||||||
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/Semester';
|
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
|
||||||
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/Setting';
|
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
|
||||||
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/SportCourse';
|
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
|
||||||
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/StudyModule';
|
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/sport-course';
|
||||||
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/Ticket';
|
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/study-module';
|
||||||
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/ToDo';
|
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/ticket';
|
||||||
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/Tour';
|
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
|
||||||
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/Video';
|
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
|
||||||
|
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
|
||||||
|
|
||||||
/* tslint:disable:variable-name */
|
/* tslint:disable:variable-name */
|
||||||
/**
|
/**
|
||||||
* A map of things, from type to meta data
|
* A map of things, from type to meta data
|
||||||
*/
|
*/
|
||||||
export const SCClasses: { [K in SCThingType]: any } = {
|
export const SCClasses: { [K in SCThingType]: object } = {
|
||||||
/* tslint:enable */
|
/* tslint:enable */
|
||||||
'academic event': SCAcademicEventMeta,
|
'academic event': SCAcademicEventMeta,
|
||||||
'article': SCArticleMeta,
|
'article': SCArticleMeta,
|
||||||
'book': SCBookMeta,
|
'book': SCBookMeta,
|
||||||
'building': SCBuildingMeta,
|
'building': SCBuildingMeta,
|
||||||
'catalog': SCCatalogMeta,
|
'catalog': SCCatalogMeta,
|
||||||
|
'contact point': SCContactPointMeta,
|
||||||
'course of studies': SCCourseOfStudiesMeta,
|
'course of studies': SCCourseOfStudiesMeta,
|
||||||
'date series': SCDateSeriesMeta,
|
'date series': SCDateSeriesMeta,
|
||||||
'diff': SCDiffMeta,
|
'diff': SCDiffMeta,
|
||||||
@@ -76,6 +78,7 @@ export type SCThingsWithoutDiff =
|
|||||||
| SCBook
|
| SCBook
|
||||||
| SCBuilding
|
| SCBuilding
|
||||||
| SCCatalog
|
| SCCatalog
|
||||||
|
| SCContactPoint
|
||||||
| SCCourseOfStudies
|
| SCCourseOfStudies
|
||||||
| SCDateSeries
|
| SCDateSeries
|
||||||
| SCDish
|
| SCDish
|
||||||
@@ -116,26 +119,27 @@ export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
|
|||||||
THING extends SCBook ? SCBookWithoutReferences :
|
THING extends SCBook ? SCBookWithoutReferences :
|
||||||
THING extends SCBuilding ? SCBuildingWithoutReferences :
|
THING extends SCBuilding ? SCBuildingWithoutReferences :
|
||||||
THING extends SCCatalog ? SCCatalogWithoutReferences :
|
THING extends SCCatalog ? SCCatalogWithoutReferences :
|
||||||
THING extends SCCourseOfStudies ? SCCourseOfStudiesWithoutReferences :
|
THING extends SCContactPoint ? SCContactPointWithoutReferences :
|
||||||
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
|
THING extends SCCourseOfStudies ? SCCourseOfStudiesWithoutReferences :
|
||||||
THING extends SCDiff ? SCDiffWithoutReferences :
|
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
|
||||||
THING extends SCDish ? SCDishWithoutReferences :
|
THING extends SCDiff ? SCDiffWithoutReferences :
|
||||||
THING extends SCFavorite ? SCFavoriteWithoutReferences :
|
THING extends SCDish ? SCDishWithoutReferences :
|
||||||
THING extends SCFloor ? SCFloorWithoutReferences :
|
THING extends SCFavorite ? SCFavoriteWithoutReferences :
|
||||||
THING extends SCMessage ? SCMessageWithoutReferences :
|
THING extends SCFloor ? SCFloorWithoutReferences :
|
||||||
THING extends SCOrganization ? SCOrganizationWithoutReferences :
|
THING extends SCMessage ? SCMessageWithoutReferences :
|
||||||
THING extends SCPerson ? SCPersonWithoutReferences :
|
THING extends SCOrganization ? SCOrganizationWithoutReferences :
|
||||||
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
|
THING extends SCPerson ? SCPersonWithoutReferences :
|
||||||
THING extends SCRoom ? SCRoomWithoutReferences :
|
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
|
||||||
THING extends SCSemester ? SCSemesterWithoutReferences :
|
THING extends SCRoom ? SCRoomWithoutReferences :
|
||||||
THING extends SCSetting ? SCSettingWithoutReferences :
|
THING extends SCSemester ? SCSemesterWithoutReferences :
|
||||||
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
|
THING extends SCSetting ? SCSettingWithoutReferences :
|
||||||
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
|
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
|
||||||
THING extends SCTicket ? SCTicketWithoutReferences :
|
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
|
||||||
THING extends SCToDo ? SCToDoWithoutReferences :
|
THING extends SCTicket ? SCTicketWithoutReferences :
|
||||||
THING extends SCTour ? SCTourWithoutReferences :
|
THING extends SCToDo ? SCToDoWithoutReferences :
|
||||||
THING extends SCVideo ? SCVideoWithoutReferences :
|
THING extends SCTour ? SCTourWithoutReferences :
|
||||||
never;
|
THING extends SCVideo ? SCVideoWithoutReferences :
|
||||||
|
never;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thing for a thing without references
|
* Thing for a thing without references
|
||||||
@@ -146,23 +150,24 @@ export type SCAssociatedThing<THING extends SCThings> =
|
|||||||
THING extends SCBookWithoutReferences ? SCBook :
|
THING extends SCBookWithoutReferences ? SCBook :
|
||||||
THING extends SCBuildingWithoutReferences ? SCBuilding :
|
THING extends SCBuildingWithoutReferences ? SCBuilding :
|
||||||
THING extends SCCatalogWithoutReferences ? SCCatalog :
|
THING extends SCCatalogWithoutReferences ? SCCatalog :
|
||||||
THING extends SCCourseOfStudiesWithoutReferences ? SCCourseOfStudies :
|
THING extends SCContactPointWithoutReferences ? SCContactPoint :
|
||||||
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
|
THING extends SCCourseOfStudiesWithoutReferences ? SCCourseOfStudies :
|
||||||
THING extends SCDiffWithoutReferences ? SCDiff :
|
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
|
||||||
THING extends SCDishWithoutReferences ? SCDish :
|
THING extends SCDiffWithoutReferences ? SCDiff :
|
||||||
THING extends SCFavoriteWithoutReferences ? SCFavorite :
|
THING extends SCDishWithoutReferences ? SCDish :
|
||||||
THING extends SCFloorWithoutReferences ? SCFloor :
|
THING extends SCFavoriteWithoutReferences ? SCFavorite :
|
||||||
THING extends SCMessageWithoutReferences ? SCMessage :
|
THING extends SCFloorWithoutReferences ? SCFloor :
|
||||||
THING extends SCOrganizationWithoutReferences ? SCOrganization :
|
THING extends SCMessageWithoutReferences ? SCMessage :
|
||||||
THING extends SCPersonWithoutReferences ? SCPerson :
|
THING extends SCOrganizationWithoutReferences ? SCOrganization :
|
||||||
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
|
THING extends SCPersonWithoutReferences ? SCPerson :
|
||||||
THING extends SCRoomWithoutReferences ? SCRoom :
|
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
|
||||||
THING extends SCSemesterWithoutReferences ? SCSemester :
|
THING extends SCRoomWithoutReferences ? SCRoom :
|
||||||
THING extends SCSettingWithoutReferences ? SCSetting :
|
THING extends SCSemesterWithoutReferences ? SCSemester :
|
||||||
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
|
THING extends SCSettingWithoutReferences ? SCSetting :
|
||||||
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
|
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
|
||||||
THING extends SCTicketWithoutReferences ? SCTicket :
|
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
|
||||||
THING extends SCToDoWithoutReferences ? SCToDo :
|
THING extends SCTicketWithoutReferences ? SCTicket :
|
||||||
THING extends SCTourWithoutReferences ? SCTour :
|
THING extends SCToDoWithoutReferences ? SCToDo :
|
||||||
THING extends SCVideoWithoutReferences ? SCVideo :
|
THING extends SCTourWithoutReferences ? SCTour :
|
||||||
never;
|
THING extends SCVideoWithoutReferences ? SCVideo :
|
||||||
|
never;
|
||||||
56
src/protocol/error.ts
Normal file
56
src/protocol/error.ts
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic error that can be returned by the backend if somethings fails during the processing of a request
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCErrorResponse extends Error {
|
||||||
|
/**
|
||||||
|
* Additional data that describes the error
|
||||||
|
*/
|
||||||
|
additionalData?: unknown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP status code to return this error with
|
||||||
|
*/
|
||||||
|
statusCode: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that can be created by the backend during the processing of a request
|
||||||
|
*/
|
||||||
|
export abstract class SCError implements SCErrorResponse {
|
||||||
|
/**
|
||||||
|
* Call stack of the error
|
||||||
|
*/
|
||||||
|
stack?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instatiate an SCError
|
||||||
|
*
|
||||||
|
* @param name Name of the error
|
||||||
|
* @param message Message of the error
|
||||||
|
* @param statusCode HTTP status code to return this error with
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
|
*/
|
||||||
|
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
|
||||||
|
// generate stacktrace if needed
|
||||||
|
if (stack) {
|
||||||
|
this.stack = (new Error()).stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/protocol/errors/internal-server-error.ts
Normal file
41
src/protocol/errors/internal-server-error.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {BAD_GATEWAY} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned, when an internal server error occurred
|
||||||
|
*/
|
||||||
|
export class SCInternalServerErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* Internal error that occurred. If the stack is disabled this error is not set for security reasons
|
||||||
|
*/
|
||||||
|
additionalData?: Error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a SCInternalServerErrorResponse
|
||||||
|
*
|
||||||
|
* @param err Internal server error
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
|
* and the internal server error should be displayed to the client
|
||||||
|
*/
|
||||||
|
constructor(err?: Error, stack = false) {
|
||||||
|
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
|
||||||
|
|
||||||
|
if (stack) {
|
||||||
|
this.additionalData = err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/protocol/errors/method-not-allowed.ts
Normal file
30
src/protocol/errors/method-not-allowed.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {METHOD_NOT_ALLOWED} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
||||||
|
*/
|
||||||
|
export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* Create a SCMethodNotAllowedErrorResponse
|
||||||
|
*
|
||||||
|
* @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', METHOD_NOT_ALLOWED, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,18 +12,19 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {Point, Polygon} from 'geojson';
|
import {NOT_FOUND} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Positional information
|
* An error that is returned when the requested route or resource was not found
|
||||||
*/
|
*/
|
||||||
export interface SCGeoInformation {
|
export class SCNotFoundErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
* Center point of a place
|
* Create a SCNotFoundErrorResponse
|
||||||
|
*
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
point: Point;
|
constructor(stack?: boolean) {
|
||||||
/**
|
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
|
||||||
* Shape of a place
|
}
|
||||||
*/
|
|
||||||
polygon?: Polygon;
|
|
||||||
}
|
}
|
||||||
32
src/protocol/errors/parameters-not-acceptable.ts
Normal file
32
src/protocol/errors/parameters-not-acceptable.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {NOT_ACCEPTABLE} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
|
||||||
|
* acceptable.
|
||||||
|
*/
|
||||||
|
export class SCParametersNotAcceptable extends SCError {
|
||||||
|
/**
|
||||||
|
* Create a ParametersNotAcceptable
|
||||||
|
*
|
||||||
|
* @param message contains more details to what you did wrong
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
|
*/
|
||||||
|
constructor(message: string, stack?: boolean) {
|
||||||
|
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
44
src/protocol/errors/plugin-already-registered.ts
Normal file
44
src/protocol/errors/plugin-already-registered.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {CONFLICT} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
import {SCPluginMetaData} from '../routes/plugin-register';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
|
||||||
|
* running at the same time.
|
||||||
|
* This usually indicates that there is more than one instance a plugin running.
|
||||||
|
*/
|
||||||
|
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* 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 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, plugin: SCPluginMetaData, stack = false) {
|
||||||
|
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
|
||||||
|
if (stack) {
|
||||||
|
this.additionalData = plugin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/protocol/errors/plugin-registering-failed.ts
Normal file
31
src/protocol/errors/plugin-registering-failed.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {INTERNAL_SERVER_ERROR} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned whenever there is an unexpected error while creating a plugin
|
||||||
|
*/
|
||||||
|
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* Create a PluginRegisteringFailedError
|
||||||
|
*
|
||||||
|
* @param message Describes what went wrong wile registering the plugin
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
|
*/
|
||||||
|
constructor(message: string, stack?: boolean) {
|
||||||
|
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,25 +12,19 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCUuid} from '../../../types/UUID';
|
import {REQUEST_TOO_LONG} from 'http-status-codes';
|
||||||
import {SCBulkParameters} from './BulkRequest';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requested Bulk from backend
|
* An error that is returned, when the request body is too large.
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
*/
|
||||||
export interface SCBulkResponse extends SCBulkParameters {
|
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
* State of bulk
|
* Create a SCRequestBodyTooLargeErrorResponse
|
||||||
*
|
*
|
||||||
* The state is `in progress` while it accepts things to be added to the bulk.
|
* @param stack Set to true if a stack trace should be created
|
||||||
* The state is `done` once it is closed.
|
|
||||||
*/
|
*/
|
||||||
state: 'in progress' | 'done';
|
constructor(stack?: boolean) {
|
||||||
|
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
|
||||||
/**
|
}
|
||||||
* Universally unique identifier of the bulk
|
|
||||||
*/
|
|
||||||
uid: SCUuid;
|
|
||||||
}
|
}
|
||||||
@@ -12,21 +12,20 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCBuildingWithoutReferences} from '../things/Building';
|
import {BAD_REQUEST} from 'http-status-codes';
|
||||||
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
|
import {SCError} from '../error';
|
||||||
import {SCRoomWithoutReferences} from '../things/Room';
|
|
||||||
/**
|
/**
|
||||||
* Something that is or happens in a place
|
* An error that is returned whenever there is a syntax error
|
||||||
*
|
|
||||||
* !Important!
|
|
||||||
* This is not a SCThing.
|
|
||||||
*/
|
*/
|
||||||
export interface SCInPlace {
|
export class SCSyntaxErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
* Place the thing is or happens in
|
* Create a SyntaxError
|
||||||
|
*
|
||||||
|
* @param message Describes the syntax error
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
inPlace?:
|
constructor(message: string, stack?: boolean) {
|
||||||
SCBuildingWithoutReferences
|
super('SyntaxError', message, BAD_REQUEST, stack);
|
||||||
| SCPointOfInterestWithoutReferences
|
}
|
||||||
| SCRoomWithoutReferences;
|
|
||||||
}
|
}
|
||||||
35
src/protocol/errors/too-many-requests.ts
Normal file
35
src/protocol/errors/too-many-requests.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {TOO_MANY_REQUESTS} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned, when to many request are submitted at once
|
||||||
|
*/
|
||||||
|
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* Create a SCTooManyRequestsErrorResponse
|
||||||
|
*
|
||||||
|
* @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',
|
||||||
|
TOO_MANY_REQUESTS,
|
||||||
|
stack,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/protocol/errors/unsupported-media-type.ts
Normal file
30
src/protocol/errors/unsupported-media-type.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {UNSUPPORTED_MEDIA_TYPE} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned when the content type of the request is not supported
|
||||||
|
*/
|
||||||
|
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* Create a SCUnsupportedMediaTypeErrorResponse
|
||||||
|
*
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
|
*/
|
||||||
|
constructor(stack?: boolean) {
|
||||||
|
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/protocol/errors/validation.ts
Normal file
38
src/protocol/errors/validation.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {ValidationError} from '@openstapps/core-tools/lib/common';
|
||||||
|
import {BAD_REQUEST} from 'http-status-codes';
|
||||||
|
import {SCError} from '../error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An error that is returned when the validation of a request fails
|
||||||
|
*/
|
||||||
|
export class SCValidationErrorResponse extends SCError {
|
||||||
|
/**
|
||||||
|
* List of validatation errors
|
||||||
|
*/
|
||||||
|
additionalData: ValidationError[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a SCValidationErrorResponse
|
||||||
|
*
|
||||||
|
* @param errors List of validation errors
|
||||||
|
* @param stack Set to true if a stack trace should be created
|
||||||
|
*/
|
||||||
|
constructor(errors: ValidationError[], stack?: boolean) {
|
||||||
|
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
|
||||||
|
this.additionalData = errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
240
src/protocol/route.ts
Normal file
240
src/protocol/route.ts
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {SCMap} from '../general/map';
|
||||||
|
import {SCErrorResponse} from './error';
|
||||||
|
import {SCIndexRequest, SCIndexResponse, SCIndexRoute} from './routes';
|
||||||
|
import {
|
||||||
|
SCBookAvailabilityRequest,
|
||||||
|
SCBookAvailabilityResponse,
|
||||||
|
SCBookAvailabilityRoute,
|
||||||
|
} from './routes/book-availability';
|
||||||
|
import {SCBulkAddRequest, SCBulkAddResponse, SCBulkAddRoute} from './routes/bulk-add';
|
||||||
|
import {SCBulkDoneRequest, SCBulkDoneResponse, SCBulkDoneRoute} from './routes/bulk-done';
|
||||||
|
import {SCBulkRequest, SCBulkResponse, SCBulkRoute} from './routes/bulk-request';
|
||||||
|
import {SCFeedbackRequest, SCFeedbackResponse, SCFeedbackRoute} from './routes/feedback';
|
||||||
|
import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search';
|
||||||
|
import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi';
|
||||||
|
import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possible Verbs for HTTP requests
|
||||||
|
*/
|
||||||
|
export enum SCRouteHttpVerbs {
|
||||||
|
GET = 'GET',
|
||||||
|
POST = 'POST',
|
||||||
|
PUT = 'PUT',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor of an error response
|
||||||
|
*/
|
||||||
|
// tslint:disable-next-line:no-any
|
||||||
|
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A description of a route
|
||||||
|
*/
|
||||||
|
export interface SCRoute {
|
||||||
|
/**
|
||||||
|
* A map of names of possible errors that can be returned by the route with their appropriate status codes
|
||||||
|
*/
|
||||||
|
errorNames: SCErrorResponseConstructor[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP verb to use to request the route
|
||||||
|
*/
|
||||||
|
method: SCRouteHttpVerbs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of obligatory parameters and their type that have to be set via the requested path
|
||||||
|
*/
|
||||||
|
obligatoryParameters?: SCMap<string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the type of the request body
|
||||||
|
*/
|
||||||
|
requestBodyName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the type of the response body
|
||||||
|
*/
|
||||||
|
responseBodyName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status code for success
|
||||||
|
*/
|
||||||
|
statusCodeSuccess: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL fragment of the route
|
||||||
|
*/
|
||||||
|
urlFragment: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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') {
|
||||||
|
obligatoryParameters = Object.keys(this.obligatoryParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object.keys(parameters).length > obligatoryParameters.length) {
|
||||||
|
throw new Error('Extraneous parameters provided.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.urlFragment
|
||||||
|
.split('/')
|
||||||
|
.map((part) => {
|
||||||
|
if (part.indexOf(':') !== 0) {
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parameter = part.substr(1);
|
||||||
|
|
||||||
|
if (typeof parameters[parameter] === 'undefined') {
|
||||||
|
throw new Error(`Parameter '${parameter}' not provided.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parameters[parameter];
|
||||||
|
})
|
||||||
|
.join('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possible requests
|
||||||
|
*/
|
||||||
|
export type SCRequests =
|
||||||
|
SCBookAvailabilityRequest
|
||||||
|
| SCBulkRequest
|
||||||
|
| SCBulkAddRequest
|
||||||
|
| SCBulkDoneRequest
|
||||||
|
| SCFeedbackRequest
|
||||||
|
| SCIndexRequest
|
||||||
|
| SCMultiSearchRequest
|
||||||
|
| SCSearchRequest
|
||||||
|
| SCThingUpdateRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possible responses
|
||||||
|
*/
|
||||||
|
export type SCResponses =
|
||||||
|
SCBookAvailabilityResponse
|
||||||
|
| SCBulkResponse
|
||||||
|
| SCBulkAddResponse
|
||||||
|
| SCBulkDoneResponse
|
||||||
|
| SCFeedbackResponse
|
||||||
|
| SCIndexResponse
|
||||||
|
| SCMultiSearchResponse
|
||||||
|
| SCSearchResponse
|
||||||
|
| SCThingUpdateResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated response for a request
|
||||||
|
*/
|
||||||
|
export type SCAssociatedResponse<REQUEST> =
|
||||||
|
REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse :
|
||||||
|
REQUEST extends SCBulkRequest ? SCBulkResponse :
|
||||||
|
REQUEST extends SCBulkAddRequest ? SCBulkAddResponse :
|
||||||
|
REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse :
|
||||||
|
REQUEST extends SCFeedbackRequest ? SCFeedbackResponse :
|
||||||
|
REQUEST extends SCIndexRequest ? SCIndexResponse :
|
||||||
|
REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse :
|
||||||
|
REQUEST extends SCSearchRequest ? SCSearchResponse :
|
||||||
|
REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse :
|
||||||
|
never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated request for a response
|
||||||
|
*/
|
||||||
|
export type SCAssociatedRequest<RESPONSE> =
|
||||||
|
RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest :
|
||||||
|
RESPONSE extends SCBulkResponse ? SCBulkRequest :
|
||||||
|
RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest :
|
||||||
|
RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest :
|
||||||
|
RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest :
|
||||||
|
RESPONSE extends SCIndexResponse ? SCIndexRequest :
|
||||||
|
RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest :
|
||||||
|
RESPONSE extends SCSearchResponse ? SCSearchRequest :
|
||||||
|
RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest :
|
||||||
|
never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated request for a route
|
||||||
|
*/
|
||||||
|
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> =
|
||||||
|
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityRequest :
|
||||||
|
ROUTE extends SCBulkRoute ? SCBulkRequest :
|
||||||
|
ROUTE extends SCBulkAddRoute ? SCBulkAddRequest :
|
||||||
|
ROUTE extends SCBulkDoneRoute ? SCBulkDoneRequest :
|
||||||
|
ROUTE extends SCFeedbackRoute ? SCFeedbackRequest :
|
||||||
|
ROUTE extends SCIndexRoute ? SCIndexRequest :
|
||||||
|
ROUTE extends SCMultiSearchRoute ? SCMultiSearchRequest :
|
||||||
|
ROUTE extends SCSearchRoute ? SCSearchRequest :
|
||||||
|
ROUTE extends SCThingUpdateRoute ? SCThingUpdateRequest :
|
||||||
|
never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated response for a route
|
||||||
|
*/
|
||||||
|
export type SCAssignedResponse<ROUTE extends SCAbstractRoute> =
|
||||||
|
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityResponse :
|
||||||
|
ROUTE extends SCBulkRoute ? SCBulkResponse :
|
||||||
|
ROUTE extends SCBulkAddRoute ? SCBulkAddResponse :
|
||||||
|
ROUTE extends SCBulkDoneRoute ? SCBulkDoneResponse :
|
||||||
|
ROUTE extends SCFeedbackRoute ? SCFeedbackResponse :
|
||||||
|
ROUTE extends SCIndexRoute ? SCIndexResponse :
|
||||||
|
ROUTE extends SCMultiSearchRoute ? SCMultiSearchResponse :
|
||||||
|
ROUTE extends SCSearchRoute ? SCSearchResponse :
|
||||||
|
ROUTE extends SCThingUpdateRoute ? SCThingUpdateResponse :
|
||||||
|
never;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,20 +12,21 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {OK} from 'http-status-codes';
|
||||||
import {SCUuid} from '../../../types/UUID';
|
import {SCUuid} from '../../general/uuid';
|
||||||
import {
|
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
|
||||||
SCInternalServerErrorResponse,
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCNotFoundErrorResponse,
|
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCSyntaxErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCValidationErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
} from '../../errors/ErrorResponse';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to check the availability of books
|
* Request to check the availability of books
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
|
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
|
||||||
@@ -50,6 +51,13 @@ export interface SCBookAvailabilityRequestByUuid {
|
|||||||
uid: SCUuid;
|
uid: SCUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of availabilities of a book
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for book availability
|
* Route for book availability
|
||||||
*
|
*
|
||||||
@@ -80,7 +88,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/bookAvailability';
|
this.urlFragment = '/bookAvailability';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,24 +12,32 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThings} from '../../../../Classes';
|
import {CREATED} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
import {SCThings} from '../../meta';
|
||||||
import {
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||||
SCNotFoundErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCSyntaxErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
SCValidationErrorResponse,
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
} from '../../../errors/ErrorResponse';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to add a thing to a bulk
|
* Request to add a thing to a bulk
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export type SCBulkAddRequest = SCThings;
|
export type SCBulkAddRequest = SCThings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response to a request to add a thing to a bulk
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCBulkAddResponse {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for indexing SC things in a bulk
|
* Route for indexing SC things in a bulk
|
||||||
*/
|
*/
|
||||||
@@ -51,7 +59,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCBulkAddRequest';
|
this.requestBodyName = 'SCBulkAddRequest';
|
||||||
this.responseBodyName = 'SCBulkAddResponse';
|
this.responseBodyName = 'SCBulkAddResponse';
|
||||||
this.statusCodeSuccess = 201;
|
this.statusCodeSuccess = CREATED;
|
||||||
this.urlFragment = '/bulk/:UID';
|
this.urlFragment = '/bulk/:UID';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,24 +12,32 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
import {NO_CONTENT} from 'http-status-codes';
|
||||||
import {
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||||
SCNotFoundErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCSyntaxErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
SCValidationErrorResponse,
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
} from '../../../errors/ErrorResponse';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to change the bulk state to done (close the bulk process)
|
* Request to change the bulk state to done (close the bulk process)
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export interface SCBulkDoneRequest {
|
export interface SCBulkDoneRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response to a request to change the state of a bulk to done
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCBulkDoneResponse {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for closing bulks
|
* Route for closing bulks
|
||||||
*/
|
*/
|
||||||
@@ -51,7 +59,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCBulkDoneRequest';
|
this.requestBodyName = 'SCBulkDoneRequest';
|
||||||
this.responseBodyName = 'SCBulkDoneResponse';
|
this.responseBodyName = 'SCBulkDoneResponse';
|
||||||
this.statusCodeSuccess = 204;
|
this.statusCodeSuccess = NO_CONTENT;
|
||||||
this.urlFragment = '/bulk/:UID/done';
|
this.urlFragment = '/bulk/:UID/done';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {OK} from 'http-status-codes';
|
||||||
import {SCThingType} from '../../../Thing';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCISO8601Date} from '../../../types/Time';
|
import {SCUuid} from '../../general/uuid';
|
||||||
import {
|
import {SCThingType} from '../../things/abstract/thing';
|
||||||
SCInternalServerErrorResponse,
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCSyntaxErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCValidationErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
} from '../../errors/ErrorResponse';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bulk request
|
* A bulk request
|
||||||
@@ -56,11 +56,31 @@ export interface SCBulkParameters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of things that are indexed in this bulk.
|
* Type of things that are indexed in this bulk.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
type: SCThingType;
|
type: SCThingType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requested Bulk from backend
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCBulkResponse extends SCBulkParameters {
|
||||||
|
/**
|
||||||
|
* State of bulk
|
||||||
|
*
|
||||||
|
* The state is `in progress` while it accepts things to be added to the bulk.
|
||||||
|
* The state is `done` once it is closed.
|
||||||
|
*/
|
||||||
|
state: 'in progress' | 'done';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Universally unique identifier of the bulk
|
||||||
|
*/
|
||||||
|
uid: SCUuid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for bulk creation
|
* Route for bulk creation
|
||||||
*/
|
*/
|
||||||
@@ -78,7 +98,7 @@ export class SCBulkRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCBulkRequest';
|
this.requestBodyName = 'SCBulkRequest';
|
||||||
this.responseBodyName = 'SCBulkResponse';
|
this.responseBodyName = 'SCBulkResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/bulk';
|
this.urlFragment = '/bulk';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,15 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {NO_CONTENT} from 'http-status-codes';
|
||||||
import {SCMessage} from '../../../things/Message';
|
import {SCMessage} from '../../things/message';
|
||||||
import {
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCSyntaxErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
SCValidationErrorResponse,
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
} from '../../errors/ErrorResponse';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User feedback
|
* User feedback
|
||||||
@@ -35,6 +34,14 @@ export interface SCFeedbackRequest extends SCMessage {
|
|||||||
metaData: SCFeedbackRequestMetaData;
|
metaData: SCFeedbackRequestMetaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A response to a feedback request
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCFeedbackResponse {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for feedback submission
|
* Route for feedback submission
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +59,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCFeedbackRequest';
|
this.requestBodyName = 'SCFeedbackRequest';
|
||||||
this.responseBodyName = 'SCFeedbackResponse';
|
this.responseBodyName = 'SCFeedbackResponse';
|
||||||
this.statusCodeSuccess = 204;
|
this.statusCodeSuccess = NO_CONTENT;
|
||||||
this.urlFragment = '/feedback';
|
this.urlFragment = '/feedback';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +81,7 @@ export interface SCFeedbackRequestMetaData {
|
|||||||
/**
|
/**
|
||||||
* Scope/app state at feedback invocation
|
* Scope/app state at feedback invocation
|
||||||
*/
|
*/
|
||||||
scope: any;
|
scope: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the feedback is sendable
|
* Whether or not the feedback is sendable
|
||||||
@@ -84,7 +91,7 @@ export interface SCFeedbackRequestMetaData {
|
|||||||
/**
|
/**
|
||||||
* App state that feedback was invoked from
|
* App state that feedback was invoked from
|
||||||
*/
|
*/
|
||||||
state: any;
|
state: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User agent
|
* User agent
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,15 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {OK} from 'http-status-codes';
|
||||||
import {
|
import {SCAppConfiguration} from '../../config/app';
|
||||||
SCInternalServerErrorResponse,
|
import {SCBackendConfiguration} from '../../config/backend';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCSyntaxErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCValidationErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
} from '../../errors/ErrorResponse';
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index request
|
* Index request
|
||||||
@@ -30,6 +31,23 @@ import {
|
|||||||
export interface SCIndexRequest {
|
export interface SCIndexRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A response to an index request
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCIndexResponse {
|
||||||
|
/**
|
||||||
|
* @see SCAppConfiguration
|
||||||
|
*/
|
||||||
|
app: SCAppConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SCBackendConfiguration
|
||||||
|
*/
|
||||||
|
backend: SCBackendConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route to request meta information about the deployment
|
* Route to request meta information about the deployment
|
||||||
*/
|
*/
|
||||||
@@ -47,7 +65,7 @@ export class SCIndexRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCIndexRequest';
|
this.requestBodyName = 'SCIndexRequest';
|
||||||
this.responseBodyName = 'SCIndexResponse';
|
this.responseBodyName = 'SCIndexResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/';
|
this.urlFragment = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,16 +12,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {Schema} from 'jsonschema';
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {JSONSchema7} from 'json-schema';
|
||||||
import {
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable,
|
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||||
SCPluginAlreadyRegisteredErrorResponse,
|
import {SCParametersNotAcceptable} from '../errors/parameters-not-acceptable';
|
||||||
SCPluginRegisteringFailedErrorResponse,
|
import {SCPluginAlreadyRegisteredErrorResponse} from '../errors/plugin-already-registered';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCPluginRegisteringFailedErrorResponse} from '../errors/plugin-registering-failed';
|
||||||
SCSyntaxErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
} from '../../errors/ErrorResponse';
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin register request
|
* Plugin register request
|
||||||
@@ -77,12 +78,12 @@ export interface SCPluginMetaData {
|
|||||||
/**
|
/**
|
||||||
* How the requests of the plugin looks like, a JSON schema for validation
|
* How the requests of the plugin looks like, a JSON schema for validation
|
||||||
*/
|
*/
|
||||||
requestSchema: Schema;
|
requestSchema: JSONSchema7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How the responses of the plugin looks like, a JSON schema for validation
|
* How the responses of the plugin looks like, a JSON schema for validation
|
||||||
*/
|
*/
|
||||||
responseSchema: Schema;
|
responseSchema: JSONSchema7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The desired route, for example /feedback.
|
* The desired route, for example /feedback.
|
||||||
@@ -90,6 +91,18 @@ export interface SCPluginMetaData {
|
|||||||
route: string;
|
route: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin register response
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCPluginRegisterResponse {
|
||||||
|
/**
|
||||||
|
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
|
||||||
|
*/
|
||||||
|
success: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route to register plugins
|
* Route to register plugins
|
||||||
*/
|
*/
|
||||||
@@ -99,6 +112,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
|||||||
this.errorNames = [
|
this.errorNames = [
|
||||||
SCInternalServerErrorResponse,
|
SCInternalServerErrorResponse,
|
||||||
SCMethodNotAllowedErrorResponse,
|
SCMethodNotAllowedErrorResponse,
|
||||||
|
SCNotFoundErrorResponse,
|
||||||
SCParametersNotAcceptable,
|
SCParametersNotAcceptable,
|
||||||
SCPluginAlreadyRegisteredErrorResponse,
|
SCPluginAlreadyRegisteredErrorResponse,
|
||||||
SCPluginRegisteringFailedErrorResponse,
|
SCPluginRegisteringFailedErrorResponse,
|
||||||
@@ -108,7 +122,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/plugin/register';
|
this.urlFragment = '/plugin/register';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,18 +12,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {OK} from 'http-status-codes';
|
||||||
import {SCMap} from '../../../types/Map';
|
import {SCMap} from '../../general/map';
|
||||||
import {
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCSyntaxErrorResponse,
|
import {SCTooManyRequestsErrorResponse} from '../errors/too-many-requests';
|
||||||
SCTooManyRequestsErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
SCValidationErrorResponse,
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
} from '../../errors/ErrorResponse';
|
import {SCSearchQuery} from '../search/query';
|
||||||
import {SCSearchQuery} from './SearchRequest';
|
import {SCSearchResult} from '../search/result';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A multi search request
|
* A multi search request
|
||||||
@@ -36,6 +36,15 @@ import {SCSearchQuery} from './SearchRequest';
|
|||||||
*/
|
*/
|
||||||
export type SCMultiSearchRequest = SCMap<SCSearchQuery>;
|
export type SCMultiSearchRequest = SCMap<SCSearchQuery>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A multi search response
|
||||||
|
*
|
||||||
|
* This is a map of [[SCSearchResponse]]s indexed by name
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export type SCMultiSearchResponse = SCMap<SCSearchResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for submission of multiple search requests at once
|
* Route for submission of multiple search requests at once
|
||||||
*/
|
*/
|
||||||
@@ -54,7 +63,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCMultiSearchRequest';
|
this.requestBodyName = 'SCMultiSearchRequest';
|
||||||
this.responseBodyName = 'SCMultiSearchResponse';
|
this.responseBodyName = 'SCMultiSearchResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/search/multi';
|
this.urlFragment = '/search/multi';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,18 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {OK} from 'http-status-codes';
|
||||||
import {SCSearchContext} from '../../../types/config/Backend';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCSearchFilter} from '../../../types/filters/Abstract';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
import {SCSearchSort} from '../../../types/sorts/Abstract';
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
import {
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
SCSyntaxErrorResponse,
|
import {SCSearchQuery} from '../search/query';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCSearchResult} from '../search/result';
|
||||||
SCValidationErrorResponse,
|
|
||||||
} from '../../errors/ErrorResponse';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A search request
|
* A search request
|
||||||
@@ -34,38 +32,11 @@ export interface SCSearchRequest extends SCSearchQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A search query
|
* A search response
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export interface SCSearchQuery {
|
export interface SCSearchResponse extends SCSearchResult {
|
||||||
/**
|
|
||||||
* The context name from where the search query was initiated
|
|
||||||
*/
|
|
||||||
context?: SCSearchContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
|
|
||||||
*/
|
|
||||||
filter?: SCSearchFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of things to skip in result set (paging)
|
|
||||||
*/
|
|
||||||
from?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A term to search for
|
|
||||||
*/
|
|
||||||
query?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of things to have in the result set (paging)
|
|
||||||
*/
|
|
||||||
size?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of sorting parameters to order the result set by
|
|
||||||
*/
|
|
||||||
sort?: SCSearchSort[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +56,7 @@ export class SCSearchRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCSearchRequest';
|
this.requestBodyName = 'SCSearchRequest';
|
||||||
this.responseBodyName = 'SCSearchResponse';
|
this.responseBodyName = 'SCSearchResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/search';
|
this.urlFragment = '/search';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,17 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThings} from '../../../../Classes';
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
import {SCThings} from '../../meta';
|
||||||
import {
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
SCInternalServerErrorResponse,
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
SCMethodNotAllowedErrorResponse,
|
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||||
SCNotFoundErrorResponse,
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
SCRequestBodyTooLargeErrorResponse,
|
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
|
||||||
SCSyntaxErrorResponse,
|
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
|
||||||
SCUnsupportedMediaTypeErrorResponse,
|
import {SCValidationErrorResponse} from '../errors/validation';
|
||||||
SCValidationErrorResponse,
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||||
} from '../../../errors/ErrorResponse';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to update an existing thing
|
* Request to update an existing thing
|
||||||
@@ -31,6 +30,14 @@ import {
|
|||||||
*/
|
*/
|
||||||
export type SCThingUpdateRequest = SCThings;
|
export type SCThingUpdateRequest = SCThings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response for an entity update request
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
*/
|
||||||
|
export interface SCThingUpdateResponse {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route for updating existing things
|
* Route for updating existing things
|
||||||
*/
|
*/
|
||||||
@@ -53,7 +60,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCThingUpdateRequest';
|
this.requestBodyName = 'SCThingUpdateRequest';
|
||||||
this.responseBodyName = 'SCThingUpdateResponse';
|
this.responseBodyName = 'SCThingUpdateResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/:TYPE/:UID';
|
this.urlFragment = '/:TYPE/:UID';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,37 +12,40 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCThingsField} from '../../meta';
|
||||||
|
import {SCThingType} from '../../things/abstract/thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A postal address
|
* A search facet
|
||||||
*/
|
*/
|
||||||
export interface SCPostalAddress {
|
export interface SCFacet {
|
||||||
/**
|
/**
|
||||||
* Country of the address
|
* Buckets for the aggregation
|
||||||
*/
|
*/
|
||||||
addressCountry: string;
|
buckets: SCFacetBucket[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* City of the address
|
* Field of the aggregation
|
||||||
*/
|
*/
|
||||||
addressLocality: string;
|
field: SCThingsField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the address
|
* Type of the aggregation
|
||||||
*/
|
*/
|
||||||
addressRegion?: string;
|
onlyOnType?: SCThingType;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Zip code of the address
|
/**
|
||||||
*/
|
* A bucket of a facet
|
||||||
postalCode: string;
|
*/
|
||||||
|
export interface SCFacetBucket {
|
||||||
/**
|
/**
|
||||||
* Optional post box number
|
* Count of matching search results
|
||||||
*/
|
*/
|
||||||
postOfficeBoxNumber?: string;
|
count: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Street of the address - with house number!
|
* Key of a bucket
|
||||||
*/
|
*/
|
||||||
streetAddress: string;
|
key: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,14 +12,15 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCMap} from '../Map';
|
import {SCMap} from '../../general/map';
|
||||||
/**
|
/**
|
||||||
* All available filter types
|
* All available filter types
|
||||||
*/
|
*/
|
||||||
import {SCSearchAvailabilityFilter} from './Availability';
|
import {SCSearchAvailabilityFilter} from './filters/availability';
|
||||||
import {SCSearchBooleanFilter} from './Boolean';
|
import {SCSearchBooleanFilter} from './filters/boolean';
|
||||||
import {SCSearchDistanceFilter} from './Distance';
|
import {SCSearchDistanceFilter} from './filters/distance';
|
||||||
import {SCSearchValueFilter} from './Value';
|
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
|
||||||
|
import {SCSearchValueFilter} from './filters/value';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter instruction types
|
* Filter instruction types
|
||||||
@@ -28,7 +29,9 @@ export type SCSearchFilterType =
|
|||||||
'availability'
|
'availability'
|
||||||
| 'boolean'
|
| 'boolean'
|
||||||
| 'distance'
|
| 'distance'
|
||||||
| 'value';
|
| 'value'
|
||||||
|
| 'date range'
|
||||||
|
| 'numeric range';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure of a filter instruction
|
* Structure of a filter instruction
|
||||||
@@ -48,7 +51,7 @@ export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArgument
|
|||||||
/**
|
/**
|
||||||
* Arguments for the filter instruction
|
* Arguments for the filter instruction
|
||||||
*/
|
*/
|
||||||
export type SCSearchAbstractFilterArguments = SCMap<any>;
|
export type SCSearchAbstractFilterArguments = SCMap<unknown>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available filter instructions
|
* Available filter instructions
|
||||||
@@ -57,4 +60,6 @@ export type SCSearchFilter =
|
|||||||
SCSearchAvailabilityFilter
|
SCSearchAvailabilityFilter
|
||||||
| SCSearchBooleanFilter
|
| SCSearchBooleanFilter
|
||||||
| SCSearchDistanceFilter
|
| SCSearchDistanceFilter
|
||||||
| SCSearchValueFilter;
|
| SCSearchValueFilter
|
||||||
|
| SCSearchNumericRangeFilter
|
||||||
|
| SCSearchDateRangeFilter;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingsField} from '../../Classes';
|
import {SCISO8601Date} from '../../../general/time';
|
||||||
import {SCISO8601Date} from '../Time';
|
import {SCThingsField} from '../../../meta';
|
||||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An availability filter
|
* An availability filter
|
||||||
@@ -22,6 +22,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
|||||||
* Filter for documents where it cannot be safely determined that they are not available
|
* Filter for documents where it cannot be safely determined that they are not available
|
||||||
*/
|
*/
|
||||||
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
|
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'availability';
|
type: 'availability';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from './Abstract';
|
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from '../filter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A boolean filter
|
* A boolean filter
|
||||||
@@ -20,6 +20,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter}
|
|||||||
* This filter can be used to combine multiple filters with boolean operations.
|
* This filter can be used to combine multiple filters with boolean operations.
|
||||||
*/
|
*/
|
||||||
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
|
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'boolean';
|
type: 'boolean';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,20 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Position} from 'geojson';
|
import {Position} from 'geojson';
|
||||||
import {SCThingsField} from '../../Classes';
|
import {SCThingsField} from '../../../meta';
|
||||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A distance filter
|
* A distance filter
|
||||||
*
|
*
|
||||||
* Filter for documents that are in the given distance of the given location
|
* Filter for documents that are in the given distance of the given location
|
||||||
*/
|
*/
|
||||||
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
|
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCDistanceFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'distance';
|
type: 'distance';
|
||||||
}
|
}
|
||||||
|
|
||||||
112
src/protocol/search/filters/range.ts
Normal file
112
src/protocol/search/filters/range.ts
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {SCThingsField} from '../../../meta';
|
||||||
|
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A date range filter
|
||||||
|
*
|
||||||
|
* Filter for documents with a date field that satisfies the given constraints
|
||||||
|
*
|
||||||
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_date_format_in_range_queries
|
||||||
|
*/
|
||||||
|
export interface SCSearchDateRangeFilter extends SCSearchAbstractFilter<SCDateRangeFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
|
type: 'date range';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A distance filter
|
||||||
|
*
|
||||||
|
* Filter for documents with a numeric field that satisfies the given constraints
|
||||||
|
*
|
||||||
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#query-dsl-range-query
|
||||||
|
*/
|
||||||
|
export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter<SCNumericRangeFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
|
type: 'numeric range';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional arguments for date range filters
|
||||||
|
*
|
||||||
|
* Filter uses a plain string to allow for date math expressions
|
||||||
|
* @see https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/date-math-expressions.html
|
||||||
|
*/
|
||||||
|
export interface SCDateRangeFilterArguments extends SCRangeFilterArguments<string> {
|
||||||
|
/**
|
||||||
|
* Optional date format specifier
|
||||||
|
*
|
||||||
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_date_format_in_range_queries
|
||||||
|
*/
|
||||||
|
format?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional timezone specifier
|
||||||
|
*
|
||||||
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_time_zone_in_range_queries
|
||||||
|
*/
|
||||||
|
timeZone?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional arguments for numeric range filters
|
||||||
|
*/
|
||||||
|
export type SCNumericRangeFilterArguments = SCRangeFilterArguments<number>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional arguments for range filters
|
||||||
|
*
|
||||||
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#query-dsl-range-query
|
||||||
|
*/
|
||||||
|
export interface SCRangeFilterArguments<T> extends SCSearchAbstractFilterArguments {
|
||||||
|
/**
|
||||||
|
* Bounds of the range
|
||||||
|
*/
|
||||||
|
bounds: Bounds<T>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field where the filter will be applied
|
||||||
|
*/
|
||||||
|
field: SCThingsField;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Bounds<T> {
|
||||||
|
/**
|
||||||
|
* The lower bound
|
||||||
|
*/
|
||||||
|
lowerBound?: Bound<T>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The upper bound
|
||||||
|
*/
|
||||||
|
upperBound?: Bound<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Bound<T> {
|
||||||
|
/**
|
||||||
|
* Limit of the bound
|
||||||
|
*/
|
||||||
|
limit: T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bound mode
|
||||||
|
*/
|
||||||
|
mode: 'inclusive' | 'exclusive';
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,13 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingsField} from '../../Classes';
|
import {SCThingsField} from '../../../meta';
|
||||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters for documents that match the value on the given field
|
* Filters for documents that match the value on the given field
|
||||||
*/
|
*/
|
||||||
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
|
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'value';
|
type: 'value';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +32,7 @@ export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments
|
|||||||
field: SCThingsField;
|
field: SCThingsField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value to filter. Value has to match the field exactly.
|
* Value to filter. One or more values has to match the field exactly.
|
||||||
*/
|
*/
|
||||||
value: string;
|
value: string | string[];
|
||||||
}
|
}
|
||||||
52
src/protocol/search/query.ts
Normal file
52
src/protocol/search/query.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
import {SCSearchContext} from '../../config/backend';
|
||||||
|
import {SCSearchFilter} from './filter';
|
||||||
|
import {SCSearchSort} from './sort';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A search query
|
||||||
|
*/
|
||||||
|
export interface SCSearchQuery {
|
||||||
|
/**
|
||||||
|
* The context name from where the search query was initiated
|
||||||
|
*/
|
||||||
|
context?: SCSearchContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
|
||||||
|
*/
|
||||||
|
filter?: SCSearchFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of things to skip in result set (paging)
|
||||||
|
*/
|
||||||
|
from?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A term to search for
|
||||||
|
*/
|
||||||
|
query?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of things to have in the result set (paging)
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of sorting parameters to order the result set by
|
||||||
|
*/
|
||||||
|
sort?: SCSearchSort[];
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,15 +12,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThings, SCThingsField} from '../../../Classes';
|
import {SCThings} from '../../meta';
|
||||||
|
import {SCFacet} from './facet';
|
||||||
/**
|
|
||||||
* A search response
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCSearchResponse extends SCSearchResult {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A search response
|
* A search response
|
||||||
@@ -39,48 +32,18 @@ export interface SCSearchResult {
|
|||||||
/**
|
/**
|
||||||
* Pagination information
|
* Pagination information
|
||||||
*/
|
*/
|
||||||
pagination: SCSearchResponsePagination;
|
pagination: SCSearchResultPagination;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stats of the search engine
|
* Stats of the search engine
|
||||||
*/
|
*/
|
||||||
stats: SCSearchResponseSearchEngineStats;
|
stats: SCSearchResultSearchEngineStats;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A search facet
|
|
||||||
*/
|
|
||||||
export interface SCFacet {
|
|
||||||
/**
|
|
||||||
* Buckets for the aggregation
|
|
||||||
*/
|
|
||||||
buckets: SCFacetBucket[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Field of the aggregation
|
|
||||||
*/
|
|
||||||
field: SCThingsField;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A bucket of a facet
|
|
||||||
*/
|
|
||||||
export interface SCFacetBucket {
|
|
||||||
/**
|
|
||||||
* Count of matching search results
|
|
||||||
*/
|
|
||||||
count: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Key of a bucket
|
|
||||||
*/
|
|
||||||
key: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores information about Pagination
|
* Stores information about Pagination
|
||||||
*/
|
*/
|
||||||
export interface SCSearchResponsePagination {
|
export interface SCSearchResultPagination {
|
||||||
/**
|
/**
|
||||||
* Count of given data. Same as data.length
|
* Count of given data. Same as data.length
|
||||||
*/
|
*/
|
||||||
@@ -100,7 +63,7 @@ export interface SCSearchResponsePagination {
|
|||||||
/**
|
/**
|
||||||
* Statistics of search engine
|
* Statistics of search engine
|
||||||
*/
|
*/
|
||||||
export interface SCSearchResponseSearchEngineStats {
|
export interface SCSearchResultSearchEngineStats {
|
||||||
/**
|
/**
|
||||||
* Response time of the search engine in ms
|
* Response time of the search engine in ms
|
||||||
*/
|
*/
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019, 2020 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,11 +12,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingsField} from '../../Classes';
|
import {SCMap} from '../../general/map';
|
||||||
import {SCMap} from '../Map';
|
import {SCThingsField} from '../../meta';
|
||||||
import {SCDistanceSort} from './Distance';
|
import {SCDistanceSort} from './sorts/distance';
|
||||||
import {SCDucetSort} from './Ducet';
|
import {SCDucetSort} from './sorts/ducet';
|
||||||
import {SCPriceSort} from './Price';
|
import {SCGenericSort} from './sorts/generic';
|
||||||
|
import {SCPriceSort} from './sorts/price';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract sort instruction
|
* Abstract sort instruction
|
||||||
@@ -41,7 +42,7 @@ export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
|
|||||||
/**
|
/**
|
||||||
* Map of arguments for the sort instruction
|
* Map of arguments for the sort instruction
|
||||||
*/
|
*/
|
||||||
export interface SCSearchAbstractSortArguments extends SCMap<any> {
|
export interface SCSearchAbstractSortArguments extends SCMap<unknown> {
|
||||||
/**
|
/**
|
||||||
* Field to sort by
|
* Field to sort by
|
||||||
*/
|
*/
|
||||||
@@ -51,9 +52,9 @@ export interface SCSearchAbstractSortArguments extends SCMap<any> {
|
|||||||
/**
|
/**
|
||||||
* Type of a sort instruction
|
* Type of a sort instruction
|
||||||
*/
|
*/
|
||||||
export type SCSearchSortType = 'distance' | 'price' | 'ducet';
|
export type SCSearchSortType = 'distance' | 'price' | 'ducet' | 'generic';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sort instruction
|
* A sort instruction
|
||||||
*/
|
*/
|
||||||
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort;
|
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort | SCGenericSort;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,13 +12,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Position} from 'geojson';
|
import {Position} from 'geojson';
|
||||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort instruction to sort by distance
|
* Sort instruction to sort by distance
|
||||||
*/
|
*/
|
||||||
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
|
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractSort.type
|
||||||
|
*/
|
||||||
type: 'distance';
|
type: 'distance';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,11 +12,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort instruction for ducet sort
|
* Sort instruction for ducet sort
|
||||||
*/
|
*/
|
||||||
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractSort.type
|
||||||
|
*/
|
||||||
type: 'ducet';
|
type: 'ducet';
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2020 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,15 +12,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin register response
|
* Sort instruction for generic sort such as date
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
*/
|
||||||
export interface SCPluginRegisterResponse {
|
export interface SCGenericSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
||||||
/**
|
/**
|
||||||
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
|
* @see SCSearchAbstractSort.type
|
||||||
*/
|
*/
|
||||||
success: boolean;
|
type: 'generic';
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,13 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCSportCoursePriceGroup} from '../../things/DateSeries';
|
import {SCSportCoursePriceGroup} from '../../../things/date-series';
|
||||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort instruction to sort by price
|
* Sort instruction to sort by price
|
||||||
*/
|
*/
|
||||||
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
|
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractSort.type
|
||||||
|
*/
|
||||||
type: 'price';
|
type: 'price';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations} from '../../general/i18n';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An academic degree without references
|
* An academic degree without references
|
||||||
@@ -28,12 +28,18 @@ export interface SCAcademicDegreeWithoutReferences
|
|||||||
/**
|
/**
|
||||||
* The achievable academic degree with academic field specification
|
* The achievable academic degree with academic field specification
|
||||||
* (eg. Master of Science)
|
* (eg. Master of Science)
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
academicDegreewithField: string;
|
academicDegreewithField: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The achievable academic degree with academic field specification
|
* The achievable academic degree with academic field specification
|
||||||
* shorted (eg. M.Sc.).
|
* shorted (eg. M.Sc.).
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
academicDegreewithFieldShort: string;
|
academicDegreewithFieldShort: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations} from '../../general/i18n';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An academic term without references
|
* An academic term without references
|
||||||
@@ -23,26 +23,38 @@ export interface SCAcademicTermWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Short name of the academic term, using the given pattern
|
* Short name of the academic term, using the given pattern
|
||||||
|
*
|
||||||
|
* @aggregatable
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
acronym: string;
|
acronym: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End date of the academic term
|
* End date of the academic term
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
endDate: SCISO8601Date;
|
endDate: SCISO8601Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End date of lectures in the academic term
|
* End date of lectures in the academic term
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
eventsEndDate?: SCISO8601Date;
|
eventsEndDate?: SCISO8601Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start date of lectures in the academic term
|
* Start date of lectures in the academic term
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
eventsStartDate?: SCISO8601Date;
|
eventsStartDate?: SCISO8601Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start date of the academic term
|
* Start date of the academic term
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
startDate: SCISO8601Date;
|
startDate: SCISO8601Date;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,36 +12,50 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCPersonWithoutReferences} from '../things/Person';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
import {
|
import {
|
||||||
SCAcademicPriceGroup,
|
SCAcademicPriceGroup,
|
||||||
SCThingThatCanBeOffered,
|
SCThingThatCanBeOffered,
|
||||||
SCThingThatCanBeOfferedMeta,
|
SCThingThatCanBeOfferedMeta,
|
||||||
SCThingThatCanBeOfferedTranslatableProperties,
|
SCThingThatCanBeOfferedTranslatableProperties,
|
||||||
SCThingThatCanBeOfferedWithoutReferences,
|
SCThingThatCanBeOfferedWithoutReferences,
|
||||||
} from './ThingThatCanBeOffered';
|
} from './thing-that-can-be-offered';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A creative work without references
|
* A creative work without references
|
||||||
*/
|
*/
|
||||||
export interface SCCreativeWorkWithoutReferences
|
export interface SCCreativeWorkWithoutReferences
|
||||||
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Languages this creative work is available in
|
||||||
|
*/
|
||||||
|
availableLanguages?: SCLanguageCode[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date the creative work was published
|
* Date the creative work was published
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
datePublished?: SCISO8601Date;
|
datePublished?: SCISO8601Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of languages this creative work is written/recorded/... in
|
* Languages this creative work is written/recorded/... in
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
inLanguages?: SCLanguage[];
|
inLanguage?: SCLanguageCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keywords of the creative work
|
* Keywords of the creative work
|
||||||
|
*
|
||||||
|
* @aggregatable
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
|
|
||||||
@@ -79,6 +93,8 @@ export interface SCCreativeWorkTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the keywords of the creative work
|
* Translation of the keywords of the creative work
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
}
|
}
|
||||||
@@ -93,20 +109,22 @@ export class SCCreativeWorkMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
|
||||||
authors: 'Authoren',
|
authors: 'Autoren',
|
||||||
|
availableLanguages: 'verfügbare Übersetzungen',
|
||||||
datePublished: 'Veröffentlichungsdatum',
|
datePublished: 'Veröffentlichungsdatum',
|
||||||
inLanguages: 'verfügbare Übersetzungen',
|
inLanguage: 'Inhaltssprache',
|
||||||
keywords: 'Schlagwörter',
|
keywords: 'Schlagwörter',
|
||||||
publishers: 'Verleger',
|
publishers: 'Verleger',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
|
||||||
authors: 'authors',
|
authors: 'authors',
|
||||||
|
availableLanguages: 'available languages',
|
||||||
datePublished: 'release date',
|
datePublished: 'release date',
|
||||||
inLanguages: 'available Languages',
|
inLanguage: 'content language',
|
||||||
keywords: 'keywords',
|
keywords: 'keywords',
|
||||||
publishers: 'publishers',
|
publishers: 'publishers',
|
||||||
},
|
},
|
||||||
@@ -118,11 +136,11 @@ export class SCCreativeWorkMeta
|
|||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||||
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,12 +12,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations} from '../../general/i18n';
|
||||||
import {SCCatalogWithoutReferences} from '../things/Catalog';
|
import {SCCatalogWithoutReferences} from '../catalog';
|
||||||
import {SCPersonWithoutReferences} from '../things/Person';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
import {SCSemesterWithoutReferences} from '../things/Semester';
|
import {SCSemesterWithoutReferences} from '../semester';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCCreativeWorkWithoutReferences} from './creative-work';
|
||||||
import {SCCreativeWorkWithoutReferences} from './CreativeWork';
|
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event without references
|
* An event without references
|
||||||
@@ -28,6 +28,8 @@ export interface SCEventWithoutReferences
|
|||||||
* Maximum number of participants of the event
|
* Maximum number of participants of the event
|
||||||
*
|
*
|
||||||
* A maximum number of people that can participate in the event.
|
* A maximum number of people that can participate in the event.
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
maximumParticipants?: number;
|
maximumParticipants?: number;
|
||||||
|
|
||||||
@@ -35,6 +37,8 @@ export interface SCEventWithoutReferences
|
|||||||
* Remaining attendee capacity of the event
|
* Remaining attendee capacity of the event
|
||||||
*
|
*
|
||||||
* This number represents the remaining open spots.
|
* This number represents the remaining open spots.
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
remainingAttendeeCapacity?: number;
|
remainingAttendeeCapacity?: number;
|
||||||
}
|
}
|
||||||
@@ -82,7 +86,7 @@ export class SCEventMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||||
academicTerms: 'Semester',
|
academicTerms: 'Semester',
|
||||||
catalogs: 'Verzeichnis',
|
catalogs: 'Verzeichnis',
|
||||||
creativeWorks: 'begleitende Werke',
|
creativeWorks: 'begleitende Werke',
|
||||||
@@ -92,7 +96,7 @@ export class SCEventMeta
|
|||||||
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
|
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||||
academicTerms: 'academic terms',
|
academicTerms: 'academic terms',
|
||||||
catalogs: 'catalogs',
|
catalogs: 'catalogs',
|
||||||
creativeWorks: 'related material',
|
creativeWorks: 'related material',
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,10 +12,74 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {SCGeoInformation} from '../types/GeoInformation';
|
import {Point, Polygon} from 'geojson';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCPostalAddress} from '../types/PostalAddress';
|
import {SCBuildingWithoutReferences} from '../building';
|
||||||
|
import {SCPointOfInterestWithoutReferences} from '../point-of-interest';
|
||||||
|
import {SCRoomWithoutReferences} from '../room';
|
||||||
|
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Positional information
|
||||||
|
*/
|
||||||
|
export interface SCGeoInformation {
|
||||||
|
/**
|
||||||
|
* Center point of a place
|
||||||
|
*/
|
||||||
|
point: Point;
|
||||||
|
/**
|
||||||
|
* Shape of a place
|
||||||
|
*/
|
||||||
|
polygon?: Polygon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A postal address
|
||||||
|
*/
|
||||||
|
export interface SCPostalAddress {
|
||||||
|
/**
|
||||||
|
* Country of the address
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
addressCountry: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* City of the address
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
addressLocality: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of the address
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
addressRegion?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zip code of the address
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
postalCode: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional post box number
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
postOfficeBoxNumber?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Street of the address - with house number!
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
streetAddress: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A place without references
|
* A place without references
|
||||||
@@ -37,7 +101,9 @@ export interface SCPlaceWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opening hours of the place
|
* Opening hours of the place
|
||||||
|
*
|
||||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
openingHours?: string;
|
openingHours?: string;
|
||||||
|
|
||||||
@@ -63,6 +129,9 @@ export interface SCPlace
|
|||||||
*/
|
*/
|
||||||
export interface SCPlaceWithoutReferencesTranslatableProperties
|
export interface SCPlaceWithoutReferencesTranslatableProperties
|
||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* Address of a place
|
||||||
|
*/
|
||||||
address?: SCPostalAddress;
|
address?: SCPostalAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,3 +170,19 @@ export class SCPlaceWithoutReferencesMeta
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Something that is or happens in a place
|
||||||
|
*
|
||||||
|
* !Important!
|
||||||
|
* This is not a SCThing.
|
||||||
|
*/
|
||||||
|
export interface SCInPlace {
|
||||||
|
/**
|
||||||
|
* Place the thing is or happens in
|
||||||
|
*/
|
||||||
|
inPlace?:
|
||||||
|
SCBuildingWithoutReferences
|
||||||
|
| SCPointOfInterestWithoutReferences
|
||||||
|
| SCRoomWithoutReferences;
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from '../Thing';
|
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta} from '../Thing';
|
import {SCMetaTranslations} from '../../general/i18n';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCInPlace} from './place';
|
||||||
import {SCInPlace} from '../types/Places';
|
import {SCThing, SCThingMeta} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A thing that is or happens in a place
|
* A thing that is or happens in a place
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations} from '../../general/i18n';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types of payment that are accepted at a place.
|
* Types of payment that are accepted at a place.
|
||||||
@@ -30,6 +30,8 @@ export interface SCThingThatAcceptsPaymentsWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Accepted payments of the place
|
* Accepted payments of the place
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
|
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
|
||||||
}
|
}
|
||||||
@@ -52,11 +54,11 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||||
paymentsAccepted: 'Bezahlmethoden',
|
paymentsAccepted: 'Bezahlmethoden',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||||
paymentsAccepted: 'accepted payment methods',
|
paymentsAccepted: 'accepted payment methods',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -66,7 +68,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||||
paymentsAccepted: {
|
paymentsAccepted: {
|
||||||
'cafeteria card': 'Mensakarte',
|
'cafeteria card': 'Mensakarte',
|
||||||
'cash': 'Bar',
|
'cash': 'Bar',
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,12 +12,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCOrganizationWithoutReferences} from '../things/Organization';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCPersonWithoutReferences} from '../things/Person';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
import {SCInPlace} from '../types/Places';
|
import {SCInPlace} from './place';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default price without distinction
|
* Default price without distinction
|
||||||
@@ -25,6 +25,9 @@ import {SCISO8601Date} from '../types/Time';
|
|||||||
export interface SCPriceGroup {
|
export interface SCPriceGroup {
|
||||||
/**
|
/**
|
||||||
* Default price of the thing
|
* Default price of the thing
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
default: number;
|
default: number;
|
||||||
}
|
}
|
||||||
@@ -36,16 +39,25 @@ export interface SCAcademicPriceGroup
|
|||||||
extends SCPriceGroup {
|
extends SCPriceGroup {
|
||||||
/**
|
/**
|
||||||
* Price for employees
|
* Price for employees
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
employee?: number;
|
employee?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Price for guests
|
* Price for guests
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
guest?: number;
|
guest?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Price for students
|
* Price for students
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
student?: number;
|
student?: number;
|
||||||
}
|
}
|
||||||
@@ -115,6 +127,8 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Availability of an offer
|
* Availability of an offer
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
'offers[].availability'?: string;
|
'offers[].availability'?: string;
|
||||||
}
|
}
|
||||||
@@ -138,21 +152,24 @@ export type SCThingThatCanBeOfferedAvailability =
|
|||||||
/**
|
/**
|
||||||
* Meta information about a thing without references that accepts payments
|
* Meta information about a thing without references that accepts payments
|
||||||
*/
|
*/
|
||||||
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
|
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
|
||||||
SCMetaTranslations<SCThingThatCanBeOffered<T>> {
|
implements SCMetaTranslations<SCThingThatCanBeOffered<T>> {
|
||||||
|
|
||||||
protected static _instance: any;
|
/**
|
||||||
|
* Instance
|
||||||
|
*/
|
||||||
|
protected static _instance = new Map<string, unknown>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of fields
|
* Translations of fields
|
||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
... SCThingMeta.getInstance().fieldTranslations.de,
|
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||||
offers: 'Angebote',
|
offers: 'Angebote',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
... SCThingMeta.getInstance().fieldTranslations.en,
|
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||||
offers: 'offers',
|
offers: 'offers',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -160,21 +177,28 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
|
|||||||
/**
|
/**
|
||||||
* Translations of values of fields
|
* Translations of values of fields
|
||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// tslint:disable:static-this
|
||||||
/**
|
/**
|
||||||
* Function to retrieve typed singleton instance (including generics)
|
* Function to retrieve typed singleton instance (including generics)
|
||||||
*/
|
*/
|
||||||
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
|
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
|
||||||
return this._instance || (this._instance = new this<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() {}
|
protected constructor() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,20 +12,24 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCMap} from '../../general/map';
|
||||||
import {SCMap} from '../types/Map';
|
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A thing without references with categories
|
* A thing without references with categories
|
||||||
*
|
*
|
||||||
* !!! BEWARE !!!
|
* !!! 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>
|
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
|
||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Categories of a thing with categories
|
* Categories of a thing with categories
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @aggregatable
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
categories: T[];
|
categories: T[];
|
||||||
|
|
||||||
@@ -60,6 +64,8 @@ export interface SCThingWithCategoriesTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* translations of the categories of a thing with categories
|
* translations of the categories of a thing with categories
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
*/
|
*/
|
||||||
categories?: string[];
|
categories?: string[];
|
||||||
}
|
}
|
||||||
@@ -72,26 +78,37 @@ export interface SCThingWithCategoriesTranslatableProperties
|
|||||||
export interface SCThingWithCategoriesSpecificValues {
|
export interface SCThingWithCategoriesSpecificValues {
|
||||||
/**
|
/**
|
||||||
* Category specific alternate names of a thing
|
* Category specific alternate names of a thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
alternateNames?: string[];
|
alternateNames?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category specific description of a thing
|
* Category specific description of a thing
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL of a category specific image of a thing
|
* URL of a category specific image of a thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category specific name of a thing
|
* Category specific name of a thing
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category specific URL of a thing
|
* Category specific URL of a thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
url?: string;
|
url?: string;
|
||||||
}
|
}
|
||||||
@@ -103,7 +120,10 @@ export interface SCThingWithCategoriesSpecificValues {
|
|||||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
||||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||||
|
|
||||||
protected static _instance: any;
|
/**
|
||||||
|
* Instance
|
||||||
|
*/
|
||||||
|
protected static _instance = new Map<string, unknown>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of fields
|
* Translations of fields
|
||||||
@@ -133,11 +153,18 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// tslint:disable:static-this
|
||||||
/**
|
/**
|
||||||
* Function to retrieve typed singleton instance (including generics)
|
* Function to retrieve typed singleton instance (including generics)
|
||||||
*/
|
*/
|
||||||
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
|
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() {
|
protected constructor() {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,11 +12,11 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCOrganizationWithoutReferences} from './things/Organization';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCPersonWithoutReferences} from './things/Person';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCMetaTranslations, SCTranslations} from './types/i18n';
|
import {SCUuid} from '../../general/uuid';
|
||||||
import {SCISO8601Date} from './types/Time';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
import {SCUuid} from './types/UUID';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types a thing can be
|
* Types a thing can be
|
||||||
@@ -27,6 +27,7 @@ export enum SCThingType {
|
|||||||
Book = 'book',
|
Book = 'book',
|
||||||
Building = 'building',
|
Building = 'building',
|
||||||
Catalog = 'catalog',
|
Catalog = 'catalog',
|
||||||
|
ContactPoint = 'contact point',
|
||||||
CourseOfStudies = 'course of studies',
|
CourseOfStudies = 'course of studies',
|
||||||
DateSeries = 'date series',
|
DateSeries = 'date series',
|
||||||
Diff = 'diff',
|
Diff = 'diff',
|
||||||
@@ -54,22 +55,31 @@ export enum SCThingType {
|
|||||||
export interface SCThingWithoutReferences {
|
export interface SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Alternate names of the thing
|
* Alternate names of the thing
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
alternateNames?: string[];
|
alternateNames?: string[];
|
||||||
/**
|
/**
|
||||||
* Description of the thing
|
* Description of the thing
|
||||||
*
|
*
|
||||||
* @minLength 1
|
* @minLength 1
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
/**
|
/**
|
||||||
* URL of an image of the thing
|
* URL of an image of the thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
/**
|
/**
|
||||||
* Name of the thing
|
* Name of the thing
|
||||||
*
|
*
|
||||||
|
* @filterable
|
||||||
* @minLength 1
|
* @minLength 1
|
||||||
|
* @sortable ducet
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
/**
|
/**
|
||||||
@@ -80,6 +90,10 @@ export interface SCThingWithoutReferences {
|
|||||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||||
/**
|
/**
|
||||||
* Type of the thing
|
* Type of the thing
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @filterable
|
||||||
|
* @aggregatable global
|
||||||
*/
|
*/
|
||||||
type: SCThingType;
|
type: SCThingType;
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +102,8 @@ export interface SCThingWithoutReferences {
|
|||||||
uid: SCUuid;
|
uid: SCUuid;
|
||||||
/**
|
/**
|
||||||
* URL of the thing
|
* URL of the thing
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
url?: string;
|
url?: string;
|
||||||
}
|
}
|
||||||
@@ -143,6 +159,8 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the origin
|
* Name of the origin
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@@ -200,10 +218,15 @@ export interface SCThingUserOrigin extends SCThingOrigin {
|
|||||||
export interface SCThingTranslatableProperties {
|
export interface SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the description of the thing
|
* Translation of the description of the thing
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
/**
|
/**
|
||||||
* Translation of the name of the thing
|
* Translation of the name of the thing
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name?: string;
|
name?: string;
|
||||||
/**
|
/**
|
||||||
@@ -218,6 +241,8 @@ export interface SCThingTranslatableProperties {
|
|||||||
export interface SCThingTranslatablePropertyOrigin {
|
export interface SCThingTranslatablePropertyOrigin {
|
||||||
/**
|
/**
|
||||||
* Translation of the name of the origin
|
* Translation of the name of the origin
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
@@ -271,14 +296,16 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// tslint:disable:static-this
|
||||||
/**
|
/**
|
||||||
* Function to retrieve typed singleton instance
|
* Function to retrieve typed singleton instance
|
||||||
*/
|
*/
|
||||||
public static getInstance<T extends SCThingMeta>(): T {
|
public static getInstance<T extends SCThingMeta>(): T {
|
||||||
if (!this._instance.has(this.name)) {
|
if (!SCThingMeta._instance.has(this.name)) {
|
||||||
this._instance.set(this.name, new this());
|
SCThingMeta._instance.set(this.name, new this());
|
||||||
}
|
}
|
||||||
return this._instance.get(this.name) as T;
|
|
||||||
|
return SCThingMeta._instance.get(this.name) as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected constructor() {
|
protected constructor() {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event';
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An academic event without references
|
* An academic event without references
|
||||||
@@ -31,11 +31,18 @@ export interface SCAcademicEventWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Majors of the academic event that this event belongs to
|
* Majors of the academic event that this event belongs to
|
||||||
|
*
|
||||||
|
* @aggregatable
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors?: string[];
|
majors?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Original unmapped category from the source of the academic event
|
* Original unmapped category from the source of the academic event
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
originalCategory?: string;
|
originalCategory?: string;
|
||||||
|
|
||||||
@@ -54,6 +61,7 @@ export interface SCAcademicEventWithoutReferences
|
|||||||
* An academic event
|
* An academic event
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCAcademicEvent
|
export interface SCAcademicEvent
|
||||||
extends SCEvent, SCAcademicEventWithoutReferences,
|
extends SCEvent, SCAcademicEventWithoutReferences,
|
||||||
@@ -86,6 +94,7 @@ export type SCAcademicEventCategories =
|
|||||||
| 'course'
|
| 'course'
|
||||||
| 'practicum introduction'
|
| 'practicum introduction'
|
||||||
| 'excursion'
|
| 'excursion'
|
||||||
|
| 'exercise'
|
||||||
| 'special';
|
| 'special';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,11 +104,15 @@ export interface SCAcademicEventTranslatableProperties
|
|||||||
extends SCThingWithCategoriesTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translations of the majors of the academic event that this event belongs to
|
* Translations of the majors of the academic event that this event belongs to
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors?: string[];
|
majors?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translation of the original unmapped category from the source of the academic event
|
* Translation of the original unmapped category from the source of the academic event
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
originalCategory?: string;
|
originalCategory?: string;
|
||||||
}
|
}
|
||||||
@@ -116,19 +129,15 @@ export class SCAcademicEventMeta
|
|||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||||
SCAcademicEventCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
majors: 'Hauptfächer',
|
majors: 'Hauptfächer',
|
||||||
originalCategory: 'ursprüngliche Kategorie',
|
originalCategory: 'ursprüngliche Kategorie',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||||
SCAcademicEventCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
majors: 'majors',
|
majors: 'majors',
|
||||||
originalCategory: 'original category',
|
originalCategory: 'original category',
|
||||||
},
|
},
|
||||||
@@ -140,15 +149,14 @@ export class SCAcademicEventMeta
|
|||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||||
SCAcademicEventCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
'colloquium': 'Kolloquium',
|
'colloquium': 'Kolloquium',
|
||||||
'course': 'Kurs',
|
'course': 'Kurs',
|
||||||
'excursion': 'Exkursion',
|
'excursion': 'Exkursion',
|
||||||
'integrated course': '',
|
'exercise': 'Übung',
|
||||||
|
'integrated course': 'Integrierter Kurs',
|
||||||
'introductory class': 'Einführungsveranstaltung',
|
'introductory class': 'Einführungsveranstaltung',
|
||||||
'lecture': 'Vorlesung',
|
'lecture': 'Vorlesung',
|
||||||
'oral exam': 'mündliche Prüfung',
|
'oral exam': 'mündliche Prüfung',
|
||||||
@@ -164,10 +172,8 @@ export class SCAcademicEventMeta
|
|||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||||
SCAcademicEventCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.AcademicEvent,
|
type: SCThingType.AcademicEvent,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,21 +12,21 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {
|
import {
|
||||||
SCCreativeWork,
|
SCCreativeWork,
|
||||||
SCCreativeWorkMeta,
|
SCCreativeWorkMeta,
|
||||||
SCCreativeWorkTranslatableProperties,
|
SCCreativeWorkTranslatableProperties,
|
||||||
SCCreativeWorkWithoutReferences,
|
SCCreativeWorkWithoutReferences,
|
||||||
} from '../base/CreativeWork';
|
} from './abstract/creative-work';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An article without references
|
* An article without references
|
||||||
@@ -36,6 +36,8 @@ export interface SCArticleWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Article itself as markdown
|
* Article itself as markdown
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
articleBody: string;
|
articleBody: string;
|
||||||
|
|
||||||
@@ -54,6 +56,7 @@ export interface SCArticleWithoutReferences
|
|||||||
* An article
|
* An article
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCArticle
|
export interface SCArticle
|
||||||
extends SCCreativeWork, SCArticleWithoutReferences,
|
extends SCCreativeWork, SCArticleWithoutReferences,
|
||||||
@@ -81,6 +84,8 @@ export interface SCArticleTranslatableProperties
|
|||||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the article itself as markdown
|
* Translation of the article itself as markdown
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
articleBody?: string[];
|
articleBody?: string[];
|
||||||
}
|
}
|
||||||
@@ -97,19 +102,15 @@ export class SCArticleMeta
|
|||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.de,
|
.de,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||||
SCArticleCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
articleBody: 'Artikelinhalt',
|
articleBody: 'Artikelinhalt',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.en,
|
.en,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||||
SCArticleCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
articleBody: 'article body',
|
articleBody: 'article body',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -121,10 +122,8 @@ export class SCArticleMeta
|
|||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||||
SCArticleCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
'unipedia': 'Unipedia',
|
'unipedia': 'Unipedia',
|
||||||
},
|
},
|
||||||
@@ -133,10 +132,8 @@ export class SCArticleMeta
|
|||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.en,
|
.fieldValueTranslations.en,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||||
SCArticleCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.Article,
|
type: SCThingType.Article,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {
|
import {
|
||||||
SCCreativeWork,
|
SCCreativeWork,
|
||||||
SCCreativeWorkMeta,
|
SCCreativeWorkMeta,
|
||||||
SCCreativeWorkTranslatableProperties,
|
SCCreativeWorkTranslatableProperties,
|
||||||
SCCreativeWorkWithoutReferences,
|
SCCreativeWorkWithoutReferences,
|
||||||
} from '../base/CreativeWork';
|
} from './abstract/creative-work';
|
||||||
import {SCThingWithCategoriesTranslatableProperties} from '../base/ThingWithCategories';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCThingWithCategoriesTranslatableProperties} from './abstract/thing-with-categories';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCPersonWithoutReferences} from './person';
|
||||||
import {SCPersonWithoutReferences} from './Person';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A book without references
|
* A book without references
|
||||||
@@ -30,16 +30,24 @@ export interface SCBookWithoutReferences
|
|||||||
extends SCCreativeWorkWithoutReferences {
|
extends SCCreativeWorkWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Edition of a book
|
* Edition of a book
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
bookEdition?: string;
|
bookEdition?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ISBN of a book
|
* ISBN of a book
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
isbn: string;
|
isbn?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of pages of a book
|
* Number of pages of a book
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
numberOfPages?: number;
|
numberOfPages?: number;
|
||||||
|
|
||||||
@@ -58,6 +66,7 @@ export interface SCBookWithoutReferences
|
|||||||
* A book
|
* A book
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCBook
|
export interface SCBook
|
||||||
extends SCCreativeWork, SCBookWithoutReferences {
|
extends SCCreativeWork, SCBookWithoutReferences {
|
||||||
@@ -84,6 +93,8 @@ export interface SCBookTranslatableFields
|
|||||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of an edition of a book
|
* Translation of an edition of a book
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
bookEdition?: string;
|
bookEdition?: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,21 +12,21 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {
|
import {
|
||||||
SCPlace,
|
SCPlace,
|
||||||
SCPlaceWithoutReferences,
|
SCPlaceWithoutReferences,
|
||||||
SCPlaceWithoutReferencesMeta,
|
SCPlaceWithoutReferencesMeta,
|
||||||
SCPlaceWithoutReferencesTranslatableProperties,
|
SCPlaceWithoutReferencesTranslatableProperties,
|
||||||
} from '../base/Place';
|
} from './abstract/place';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
export type SCBuildingCategories =
|
export type SCBuildingCategories =
|
||||||
'cafe'
|
'cafe'
|
||||||
@@ -41,13 +41,11 @@ export type SCBuildingCategories =
|
|||||||
export interface SCBuildingWithoutReferences
|
export interface SCBuildingWithoutReferences
|
||||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
||||||
SCPlaceWithoutReferences {
|
SCPlaceWithoutReferences {
|
||||||
/**
|
|
||||||
* Categories of a building
|
|
||||||
*/
|
|
||||||
categories: SCBuildingCategories[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of floor names of the place
|
* List of floor names of the place
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
floors?: string[];
|
floors?: string[];
|
||||||
|
|
||||||
@@ -66,6 +64,7 @@ export interface SCBuildingWithoutReferences
|
|||||||
* A building
|
* A building
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCBuilding
|
export interface SCBuilding
|
||||||
extends SCBuildingWithoutReferences, SCPlace,
|
extends SCBuildingWithoutReferences, SCPlace,
|
||||||
@@ -83,6 +82,9 @@ export interface SCBuilding
|
|||||||
|
|
||||||
export interface SCBuildingTranslatableProperties
|
export interface SCBuildingTranslatableProperties
|
||||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* @see SCBuilding.floors
|
||||||
|
*/
|
||||||
floors?: string[];
|
floors?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,23 +99,15 @@ export class SCBuildingMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||||
SCBuildingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
||||||
>().fieldTranslations.de,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
floors: 'Etagen',
|
floors: 'Etagen',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||||
SCBuildingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
||||||
>().fieldTranslations.en,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
floors: 'floors',
|
floors: 'floors',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -123,13 +117,9 @@ export class SCBuildingMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||||
SCBuildingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
'cafe': 'Café',
|
'cafe': 'Café',
|
||||||
'canteen': 'Kantine',
|
'canteen': 'Kantine',
|
||||||
@@ -143,13 +133,9 @@ export class SCBuildingMeta
|
|||||||
type: 'Gebäude',
|
type: 'Gebäude',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||||
SCBuildingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.Building,
|
type: SCThingType.Building,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCAcademicTermWithoutReferences} from './abstract/academic-term';
|
||||||
|
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A catalog without references
|
* A catalog without references
|
||||||
@@ -32,6 +32,9 @@ export interface SCCatalogWithoutReferences
|
|||||||
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
|
* 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.
|
* Needed for keeping order in catalog inheritance array.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
level: number;
|
level: number;
|
||||||
|
|
||||||
@@ -45,6 +48,7 @@ export interface SCCatalogWithoutReferences
|
|||||||
* A catalog
|
* A catalog
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCCatalog
|
export interface SCCatalog
|
||||||
extends SCCatalogWithoutReferences, SCThing,
|
extends SCCatalogWithoutReferences, SCThing,
|
||||||
@@ -85,20 +89,16 @@ export class SCCatalogMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||||
SCCatalogCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
academicTerm: 'Semester',
|
academicTerm: 'Semester',
|
||||||
level: 'Ebene',
|
level: 'Ebene',
|
||||||
superCatalog: 'übergeordnetes Verzeichniss',
|
superCatalog: 'übergeordnetes Verzeichniss',
|
||||||
superCatalogs: 'übergeordnete Verzeichnisse',
|
superCatalogs: 'übergeordnete Verzeichnisse',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||||
SCCatalogCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
academicTerm: 'academic term',
|
academicTerm: 'academic term',
|
||||||
level: 'level',
|
level: 'level',
|
||||||
superCatalog: 'parent catalog',
|
superCatalog: 'parent catalog',
|
||||||
@@ -111,20 +111,16 @@ export class SCCatalogMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||||
SCCatalogCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
'university events': 'Universitätsveranstaltung',
|
'university events': 'Universitätsveranstaltung',
|
||||||
},
|
},
|
||||||
type: 'Verzeichnis',
|
type: 'Verzeichnis',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||||
SCCatalogCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.Catalog,
|
type: SCThingType.Catalog,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
136
src/things/contact-point.ts
Normal file
136
src/things/contact-point.ts
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
|
import {
|
||||||
|
SCThing,
|
||||||
|
SCThingMeta,
|
||||||
|
SCThingType,
|
||||||
|
SCThingWithoutReferences,
|
||||||
|
} from './abstract/thing';
|
||||||
|
import {SCRoomWithoutReferences} from './room';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A contact point without references
|
||||||
|
*/
|
||||||
|
export interface SCContactPointWithoutReferences
|
||||||
|
extends SCThingWithoutReferences {
|
||||||
|
/**
|
||||||
|
* E-mail at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
email?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fax number at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
faxNumber?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Office hours for contacting someone at the work location
|
||||||
|
*
|
||||||
|
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
officeHours?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contact number at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
telephone?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of a contact point
|
||||||
|
*/
|
||||||
|
type: SCThingType.ContactPoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
url?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A contact point
|
||||||
|
*
|
||||||
|
* @see http://schema.org/ContactPoint
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
* @indexable
|
||||||
|
*/
|
||||||
|
export interface SCContactPoint
|
||||||
|
extends SCContactPointWithoutReferences, SCThing {
|
||||||
|
/**
|
||||||
|
* Exact place where work is performed
|
||||||
|
*/
|
||||||
|
areaServed?: SCRoomWithoutReferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of a contact point
|
||||||
|
*/
|
||||||
|
type: SCThingType.ContactPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta information about a contact point
|
||||||
|
*/
|
||||||
|
export class SCContactPointMeta
|
||||||
|
extends SCThingMeta
|
||||||
|
implements SCMetaTranslations<SCContactPoint> {
|
||||||
|
/**
|
||||||
|
* Translations of fields
|
||||||
|
*/
|
||||||
|
fieldTranslations = {
|
||||||
|
de: {
|
||||||
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||||
|
areaServed: 'Arbeitsraum',
|
||||||
|
email: 'E-Mail-Addresse',
|
||||||
|
faxNumber: 'Faxnummer',
|
||||||
|
officeHours: 'Sprechzeiten',
|
||||||
|
telephone: 'Telefonnummer',
|
||||||
|
url: 'Link',
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||||
|
areaServed: 'location',
|
||||||
|
email: 'email address',
|
||||||
|
faxNumber: 'fax number',
|
||||||
|
officeHours: 'office hours',
|
||||||
|
telephone: 'telephone number',
|
||||||
|
url: 'link',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translations of values of fields
|
||||||
|
*/
|
||||||
|
fieldValueTranslations = {
|
||||||
|
de: {
|
||||||
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||||
|
type: 'Kontaktinformation',
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||||
|
type: SCThingType.ContactPoint,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,18 +12,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from '../base/AcademicDegree';
|
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from './abstract/academic-degree';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCAcademicPriceGroup,
|
SCAcademicPriceGroup,
|
||||||
SCThingThatCanBeOffered,
|
SCThingThatCanBeOffered,
|
||||||
SCThingThatCanBeOfferedMeta,
|
SCThingThatCanBeOfferedMeta,
|
||||||
SCThingThatCanBeOfferedTranslatableProperties,
|
SCThingThatCanBeOfferedTranslatableProperties,
|
||||||
SCThingThatCanBeOfferedWithoutReferences,
|
SCThingThatCanBeOfferedWithoutReferences,
|
||||||
} from '../base/ThingThatCanBeOffered';
|
} from './abstract/thing-that-can-be-offered';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCDateSeriesWithoutReferences} from './date-series';
|
||||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCOrganizationWithoutReferences} from './organization';
|
||||||
import {SCDateSeriesWithoutReferences} from './DateSeries';
|
|
||||||
import {SCOrganizationWithoutReferences} from './Organization';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A course of studies without references
|
* A course of studies without references
|
||||||
@@ -38,6 +38,9 @@ export interface SCCourseOfStudiesWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Actual major of the course of studies (eg. physics)
|
* Actual major of the course of studies (eg. physics)
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
major: string;
|
major: string;
|
||||||
|
|
||||||
@@ -66,6 +69,7 @@ export interface SCCourseOfStudiesWithoutReferences
|
|||||||
* A course of studies
|
* A course of studies
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCCourseOfStudies
|
export interface SCCourseOfStudies
|
||||||
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
|
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,20 +12,20 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCISO8601Date, SCISO8601Duration} from '../general/time';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||||
import {
|
import {
|
||||||
SCAcademicPriceGroup,
|
SCAcademicPriceGroup,
|
||||||
SCThingThatCanBeOffered,
|
SCThingThatCanBeOffered,
|
||||||
|
SCThingThatCanBeOfferedMeta,
|
||||||
SCThingThatCanBeOfferedTranslatableProperties,
|
SCThingThatCanBeOfferedTranslatableProperties,
|
||||||
SCThingThatCanBeOfferedWithoutReferences,
|
SCThingThatCanBeOfferedWithoutReferences,
|
||||||
} from '../base/ThingThatCanBeOffered';
|
} from './abstract/thing-that-can-be-offered';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCAcademicEventWithoutReferences} from './academic-event';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCPersonWithoutReferences} from './person';
|
||||||
import {SCISO8601Date, SCISO8601Duration} from '../types/Time';
|
import {SCSportCourseWithoutReferences} from './sport-course';
|
||||||
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
|
|
||||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
|
||||||
import {SCPersonWithoutReferences} from './Person';
|
|
||||||
import {SCSportCourseWithoutReferences} from './SportCourse';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Price groups for sport courses
|
* Price groups for sport courses
|
||||||
@@ -34,6 +34,8 @@ export interface SCSportCoursePriceGroup
|
|||||||
extends SCAcademicPriceGroup {
|
extends SCAcademicPriceGroup {
|
||||||
/**
|
/**
|
||||||
* Price for alumnis
|
* Price for alumnis
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
alumni?: number;
|
alumni?: number;
|
||||||
}
|
}
|
||||||
@@ -45,6 +47,8 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
extends SCThingThatCanBeOfferedWithoutReferences {
|
extends SCThingThatCanBeOfferedWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Dates of the date series that are initially planned to be held
|
* Dates of the date series that are initially planned to be held
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
dates: SCISO8601Date[];
|
dates: SCISO8601Date[];
|
||||||
|
|
||||||
@@ -60,6 +64,8 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Frequency of the date series
|
* Frequency of the date series
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
frequency: string;
|
frequency: string;
|
||||||
|
|
||||||
@@ -78,6 +84,7 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
* A date series
|
* A date series
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCDateSeries
|
export interface SCDateSeries
|
||||||
extends SCDateSeriesWithoutReferences,
|
extends SCDateSeriesWithoutReferences,
|
||||||
@@ -167,5 +174,8 @@ export class SCDateSeriesMeta
|
|||||||
*/
|
*/
|
||||||
export interface SCDateSeriesTranslatableProperties
|
export interface SCDateSeriesTranslatableProperties
|
||||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* @see SCDateSeriesWithoutReferences.frequency
|
||||||
|
*/
|
||||||
frequency?: string;
|
frequency?: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import * as jsonpatch from 'json-patch';
|
import * as jsonpatch from 'json-patch';
|
||||||
import {SCThingsWithoutDiff} from '../Classes';
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
import {SCISO8601Date} from '../general/time';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCThingsWithoutDiff} from '../meta';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A diff without references
|
* A diff without references
|
||||||
@@ -48,6 +48,7 @@ export interface SCDiffWithoutReferences
|
|||||||
* A diff
|
* A diff
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCDiff
|
export interface SCDiff
|
||||||
extends SCDiffWithoutReferences, SCThing {
|
extends SCDiffWithoutReferences, SCThing {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,22 +12,22 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCAcademicPriceGroup,
|
SCAcademicPriceGroup,
|
||||||
SCThingThatCanBeOffered,
|
SCThingThatCanBeOffered,
|
||||||
|
SCThingThatCanBeOfferedMeta,
|
||||||
SCThingThatCanBeOfferedTranslatableProperties,
|
SCThingThatCanBeOfferedTranslatableProperties,
|
||||||
SCThingThatCanBeOfferedWithoutReferences,
|
SCThingThatCanBeOfferedWithoutReferences,
|
||||||
} from '../base/ThingThatCanBeOffered';
|
} from './abstract/thing-that-can-be-offered';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dish without references
|
* A dish without references
|
||||||
@@ -37,14 +37,12 @@ export interface SCDishWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Additives of the dish
|
* Additives of the dish
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
additives?: string[];
|
additives?: string[];
|
||||||
|
|
||||||
/**
|
|
||||||
* Category of the dish
|
|
||||||
*/
|
|
||||||
categories: SCDishCategories[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Characteristics of the dish
|
* Characteristics of the dish
|
||||||
*/
|
*/
|
||||||
@@ -70,6 +68,7 @@ export interface SCDishWithoutReferences
|
|||||||
* A dish
|
* A dish
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCDish
|
export interface SCDish
|
||||||
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||||
@@ -92,6 +91,13 @@ export interface SCDish
|
|||||||
|
|
||||||
export interface SCDishTranslatableProperties
|
export interface SCDishTranslatableProperties
|
||||||
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* Additives of the dish
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
additives?: string[];
|
||||||
/**
|
/**
|
||||||
* Characteristics of the dish
|
* Characteristics of the dish
|
||||||
*/
|
*/
|
||||||
@@ -104,11 +110,16 @@ export interface SCDishTranslatableProperties
|
|||||||
export interface SCDishCharacteristic {
|
export interface SCDishCharacteristic {
|
||||||
/**
|
/**
|
||||||
* URL of an image of the characteristic
|
* URL of an image of the characteristic
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the characteristic
|
* Name of the characteristic
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
@@ -132,36 +143,50 @@ export type SCDishCategories =
|
|||||||
export interface SCNutritionInformation {
|
export interface SCNutritionInformation {
|
||||||
/**
|
/**
|
||||||
* Number of calories contained (in kcal)
|
* Number of calories contained (in kcal)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
calories?: number;
|
calories?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of carbohydrates (in grams)
|
* Content of carbohydrates (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
carbohydrateContent?: number;
|
carbohydrateContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of fat (in grams)
|
* Content of fat (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
fatContent?: number;
|
fatContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of proteins (in grams)
|
* Content of proteins (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
proteinContent?: number;
|
proteinContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of salt (in grams)
|
* Content of salt (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
saltContent?: number;
|
saltContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of saturated fat (in grams)
|
* Content of saturated fat (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
saturatedFatContent?: number;
|
saturatedFatContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of sugar (in grams)
|
* Content of sugar (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
sugarContent?: number;
|
sugarContent?: number;
|
||||||
}
|
}
|
||||||
@@ -177,10 +202,8 @@ export class SCDishMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||||
SCDishCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||||
.fieldTranslations.de,
|
.fieldTranslations.de,
|
||||||
additives: 'Zusatzstoffe',
|
additives: 'Zusatzstoffe',
|
||||||
@@ -189,10 +212,8 @@ export class SCDishMeta
|
|||||||
nutrition: 'Nährwertangaben',
|
nutrition: 'Nährwertangaben',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||||
SCDishCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||||
.fieldTranslations.en,
|
.fieldTranslations.en,
|
||||||
additives: 'additives',
|
additives: 'additives',
|
||||||
@@ -207,10 +228,8 @@ export class SCDishMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||||
SCDishCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||||
.fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
categories: {
|
categories: {
|
||||||
@@ -224,10 +243,8 @@ export class SCDishMeta
|
|||||||
type: 'Essen',
|
type: 'Essen',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||||
SCDishCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||||
.fieldValueTranslations.en,
|
.fieldValueTranslations.en,
|
||||||
type: SCThingType.Dish,
|
type: SCThingType.Dish,
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCSaveableThing, SCSaveableThingWithoutReferences} from '../base/SaveableThing';
|
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
import {SCAcademicEventWithoutReferences} from './academic-event';
|
||||||
import {SCArticleWithoutReferences} from './Article';
|
import {SCArticleWithoutReferences} from './article';
|
||||||
import {SCBookWithoutReferences} from './Book';
|
import {SCBookWithoutReferences} from './book';
|
||||||
import {SCBuildingWithoutReferences} from './Building';
|
import {SCBuildingWithoutReferences} from './building';
|
||||||
import {SCPersonWithoutReferences} from './Person';
|
import {SCPersonWithoutReferences} from './person';
|
||||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||||
import {SCRoomWithoutReferences} from './Room';
|
import {SCRoomWithoutReferences} from './room';
|
||||||
import {SCSportCourseWithoutReferences} from './SportCourse';
|
import {SCSportCourseWithoutReferences} from './sport-course';
|
||||||
import {SCToDoWithoutReferences} from './ToDo';
|
import {SCToDoWithoutReferences} from './todo';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types that can be made a favorite (added as a favorite)
|
* Types that can be made a favorite (added as a favorite)
|
||||||
@@ -49,6 +49,7 @@ export interface SCFavoriteWithoutReferences
|
|||||||
* A favorite
|
* A favorite
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCFavorite
|
export interface SCFavorite
|
||||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,12 +12,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||||
import {SCRoomWithoutReferences} from './Room';
|
import {SCRoomWithoutReferences} from './room';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A floor without references
|
* A floor without references
|
||||||
@@ -26,13 +27,15 @@ export interface SCFloorWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
floorName: string;
|
floorName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Floor plan
|
* Floor plan
|
||||||
*/
|
*/
|
||||||
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
|
plan: SCFloorFeatureCollectionWithPlaces<LineString>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated fields of a floor
|
* Translated fields of a floor
|
||||||
@@ -49,6 +52,7 @@ export interface SCFloorWithoutReferences
|
|||||||
* A floor
|
* A floor
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCFloor
|
export interface SCFloor
|
||||||
extends SCFloorWithoutReferences, SCThingInPlace {
|
extends SCFloorWithoutReferences, SCThingInPlace {
|
||||||
@@ -66,19 +70,20 @@ export interface SCFloor
|
|||||||
/**
|
/**
|
||||||
* A feature collection
|
* A feature collection
|
||||||
*/
|
*/
|
||||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
|
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
|
||||||
extends FeatureCollection<T, P> {
|
extends FeatureCollection<T> {
|
||||||
/**
|
/**
|
||||||
* Features of the collection
|
* Features of the collection
|
||||||
*/
|
*/
|
||||||
features: Array<SCFloorFeatureWithPlace<T, P>>;
|
features: Array<SCFloorFeatureWithPlace<T>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* A feature with a place
|
* A feature with a place
|
||||||
*/
|
*/
|
||||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
|
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
|
||||||
extends Feature<T, P> {
|
// tslint:disable-next-line:no-any TODO
|
||||||
|
extends Feature<T, any> {
|
||||||
/**
|
/**
|
||||||
* The place of the feature
|
* The place of the feature
|
||||||
*/
|
*/
|
||||||
@@ -92,6 +97,8 @@ export interface SCFloorTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the floor name
|
* Translation of the floor name
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
floorName?: string;
|
floorName?: string;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,16 +12,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCISO8601Date} from '../general/time';
|
||||||
import {
|
import {
|
||||||
SCCreativeWork,
|
SCCreativeWork,
|
||||||
SCCreativeWorkMeta,
|
SCCreativeWorkMeta,
|
||||||
SCCreativeWorkTranslatableProperties,
|
SCCreativeWorkTranslatableProperties,
|
||||||
SCCreativeWorkWithoutReferences,
|
SCCreativeWorkWithoutReferences,
|
||||||
} from '../base/CreativeWork';
|
} from './abstract/creative-work';
|
||||||
import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCOrganizationWithoutReferences} from './organization';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message without references
|
* A message without references
|
||||||
@@ -29,20 +30,36 @@ import {SCISO8601Date} from '../types/Time';
|
|||||||
export interface SCMessageWithoutReferences
|
export interface SCMessageWithoutReferences
|
||||||
extends SCCreativeWorkWithoutReferences {
|
extends SCCreativeWorkWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Audience of the message
|
* Organizational unit for which the message is intended
|
||||||
|
*/
|
||||||
|
audienceOrganizations?: SCOrganizationWithoutReferences[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roles for which the message is intended
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
audiences: SCMessageAudience[];
|
audiences: SCMessageAudience[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the message was created
|
* When the message was created
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
dateCreated?: SCISO8601Date;
|
dateCreated?: SCISO8601Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message itself
|
* Message itself
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
messageBody: string;
|
messageBody: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An index for applying a custom sorting of multiple messages
|
||||||
|
*/
|
||||||
|
sequenceIndex?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated fields of a message
|
* Translated fields of a message
|
||||||
*/
|
*/
|
||||||
@@ -58,6 +75,7 @@ export interface SCMessageWithoutReferences
|
|||||||
* A message
|
* A message
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCMessage
|
export interface SCMessage
|
||||||
extends SCCreativeWork, SCMessageWithoutReferences {
|
extends SCCreativeWork, SCMessageWithoutReferences {
|
||||||
@@ -87,6 +105,8 @@ export interface SCMessageTranslatableProperties
|
|||||||
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Message itself
|
* Message itself
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
messageBody?: string;
|
messageBody?: string;
|
||||||
}
|
}
|
||||||
@@ -104,16 +124,20 @@ export class SCMessageMeta
|
|||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.de,
|
.de,
|
||||||
|
audienceOrganizations: 'Zielgruppenorganisationen',
|
||||||
audiences: 'Zielgruppen',
|
audiences: 'Zielgruppen',
|
||||||
dateCreated: 'Erstellungsdatum',
|
dateCreated: 'Erstellungsdatum',
|
||||||
messageBody: 'Nachrichteninhalt',
|
messageBody: 'Nachrichteninhalt',
|
||||||
|
sequenceIndex: 'Sequenzindex',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.en,
|
.en,
|
||||||
|
audienceOrganizations: 'audience organizations',
|
||||||
audiences: 'audiences',
|
audiences: 'audiences',
|
||||||
dateCreated: 'date created',
|
dateCreated: 'date created',
|
||||||
messageBody: 'message body',
|
messageBody: 'message body',
|
||||||
|
sequenceIndex: 'sequence index',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||||
|
import {SCContactPointWithoutReferences} from './contact-point';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An organization without references
|
* An organization without references
|
||||||
@@ -31,9 +32,15 @@ export interface SCOrganizationWithoutReferences
|
|||||||
* An organization
|
* An organization
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCOrganization
|
export interface SCOrganization
|
||||||
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||||
|
/**
|
||||||
|
* A list of contact points concerning the organization
|
||||||
|
*/
|
||||||
|
contactPoints?: SCContactPointWithoutReferences[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of an organization
|
* Type of an organization
|
||||||
*/
|
*/
|
||||||
@@ -51,9 +58,11 @@ export class SCOrganizationMeta
|
|||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
|
||||||
|
contactPoints: 'Kontaktinformationen',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
|
||||||
|
contactPoints: 'contact details',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,13 +12,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
import {SCMetaTranslations, SCNationality} from '../general/i18n';
|
||||||
import {SCMetaTranslations, SCNationality} from '../types/i18n';
|
import {SCISO8601Date} from '../general/time';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
import {SCBuildingWithoutReferences} from './Building';
|
import {SCBuildingWithoutReferences} from './building';
|
||||||
import {SCOrganizationWithoutReferences} from './Organization';
|
import {SCContactPointWithoutReferences} from './contact-point';
|
||||||
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
|
import {SCOrganizationWithoutReferences} from './organization';
|
||||||
import {SCRoomWithoutReferences} from './Room';
|
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||||
|
import {SCRoomWithoutReferences} from './room';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A person without references
|
* A person without references
|
||||||
@@ -27,11 +28,16 @@ export interface SCPersonWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Additional first names of the person.
|
* Additional first names of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
additionalName?: string;
|
additionalName?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The birth date of the person.
|
* The birth date of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
birthDate?: SCISO8601Date;
|
birthDate?: SCISO8601Date;
|
||||||
|
|
||||||
@@ -39,46 +45,72 @@ export interface SCPersonWithoutReferences
|
|||||||
* The private email address of the person.
|
* The private email address of the person.
|
||||||
*
|
*
|
||||||
* @TJS-format email
|
* @TJS-format email
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
email?: string;
|
email?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The family name of the person.
|
* The family name of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
familyName: string;
|
familyName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The private fax number of the person.
|
* The private fax number of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
faxNumber?: string;
|
faxNumber?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The gender of the person.
|
* The gender of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
gender?: SCPersonGender;
|
gender?: SCPersonGender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The first name of the person.
|
* The first name of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
givenName: string;
|
givenName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Honorific prefix of the person.
|
* Honorific prefix of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
honorificPrefix?: string;
|
honorificPrefix?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Honorific suffix of the person.
|
* Honorific suffix of the person.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
honorificSuffix?: string;
|
honorificSuffix?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Titles of jobs that the person has.
|
* Titles of jobs that the person has.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
jobTitles?: string[];
|
jobTitles?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The complete name of the person combining all the parts of the name into one.
|
* The complete name of the person combining all the parts of the name into one.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@@ -89,6 +121,8 @@ export interface SCPersonWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The private telephone number of the person.
|
* The private telephone number of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
telephone?: string;
|
telephone?: string;
|
||||||
|
|
||||||
@@ -102,6 +136,7 @@ export interface SCPersonWithoutReferences
|
|||||||
* A person
|
* A person
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCPerson
|
export interface SCPerson
|
||||||
extends SCPersonWithoutReferences, SCThing {
|
extends SCPersonWithoutReferences, SCThing {
|
||||||
@@ -125,7 +160,7 @@ export interface SCPerson
|
|||||||
/**
|
/**
|
||||||
* Locations where the person performs her/his work
|
* Locations where the person performs her/his work
|
||||||
*/
|
*/
|
||||||
workLocations?: SCContactPoint[];
|
workLocations?: SCContactPointWithoutReferences[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,13 +189,14 @@ export class SCPersonMeta
|
|||||||
jobTitles: 'Berufsbezeichnungen',
|
jobTitles: 'Berufsbezeichnungen',
|
||||||
nationality: 'Staatsangehörigkeit',
|
nationality: 'Staatsangehörigkeit',
|
||||||
telephone: 'Telefonnummer',
|
telephone: 'Telefonnummer',
|
||||||
workLocations: 'Arbeitsorte',
|
workLocations: 'Arbeitsstandorte',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||||
additionalName: 'additional name',
|
additionalName: 'additional name',
|
||||||
affiliations: 'affiliations',
|
affiliations: 'affiliations',
|
||||||
birthDate: 'birth date',
|
birthDate: 'birth date',
|
||||||
|
contactDetails: 'contact details',
|
||||||
email: 'email',
|
email: 'email',
|
||||||
familyName: 'family name',
|
familyName: 'family name',
|
||||||
faxNumber: 'fax',
|
faxNumber: 'fax',
|
||||||
@@ -197,43 +233,6 @@ export class SCPersonMeta
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A contact point
|
|
||||||
*
|
|
||||||
* @see http://schema.org/ContactPoint
|
|
||||||
*/
|
|
||||||
export interface SCContactPoint {
|
|
||||||
/**
|
|
||||||
* Exact place where work is performed
|
|
||||||
*/
|
|
||||||
areaServed?: SCRoomWithoutReferences;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* E-mail at the work location
|
|
||||||
*/
|
|
||||||
email?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fax number at the work location
|
|
||||||
*/
|
|
||||||
faxNumber?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Times available for contacting at the work location
|
|
||||||
*/
|
|
||||||
hoursAvailable?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contact number at the work location
|
|
||||||
*/
|
|
||||||
telephone?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* URL at the work location
|
|
||||||
*/
|
|
||||||
url?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gender of a person
|
* Gender of a person
|
||||||
*/
|
*/
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A point of interest without references
|
* A point of interest without references
|
||||||
@@ -45,6 +45,7 @@ export interface SCPointOfInterestWithoutReferences
|
|||||||
* A point of interest
|
* A point of interest
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCPointOfInterest
|
export interface SCPointOfInterest
|
||||||
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
||||||
@@ -81,24 +82,16 @@ export class SCPointOfInterestMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||||
SCPointOfInterestCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
||||||
>().fieldTranslations.de,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||||
.de,
|
.de,
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||||
SCPointOfInterestCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
||||||
>().fieldTranslations.en,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||||
.en,
|
.en,
|
||||||
},
|
},
|
||||||
@@ -109,13 +102,9 @@ export class SCPointOfInterestMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||||
SCPointOfInterestCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
'card charger': 'Kartenaufwerter',
|
'card charger': 'Kartenaufwerter',
|
||||||
'computer': 'Computer',
|
'computer': 'Computer',
|
||||||
@@ -126,13 +115,9 @@ export class SCPointOfInterestMeta
|
|||||||
type: 'Sonderziel',
|
type: 'Sonderziel',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||||
SCPointOfInterestCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
|
||||||
SCPlaceWithoutReferencesMeta
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.PointOfInterest,
|
type: SCThingType.PointOfInterest,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,24 +12,24 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCMap} from '../general/map';
|
||||||
|
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
|
||||||
|
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||||
import {
|
import {
|
||||||
SCThingThatAcceptsPayments,
|
SCThingThatAcceptsPayments,
|
||||||
SCThingThatAcceptsPaymentsWithoutReferences,
|
SCThingThatAcceptsPaymentsWithoutReferences,
|
||||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta,
|
SCThingThatAcceptsPaymentsWithoutReferencesMeta,
|
||||||
} from '../base/ThingThatAcceptsPayments';
|
} from './abstract/thing-that-accepts-payments';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
|
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
import {SCMap} from '../types/Map';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Categories of a room
|
* Categories of a room
|
||||||
@@ -57,6 +57,9 @@ export interface SCRoomWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* The name of the floor in which the room is in.
|
* The name of the floor in which the room is in.
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
floorName?: string;
|
floorName?: string;
|
||||||
|
|
||||||
@@ -82,6 +85,7 @@ export interface SCRoomWithoutReferences
|
|||||||
* A room
|
* A room
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCRoom
|
export interface SCRoom
|
||||||
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
|
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
|
||||||
@@ -106,6 +110,8 @@ export interface SCRoomSpecificValues
|
|||||||
extends SCThingWithCategoriesSpecificValues {
|
extends SCThingWithCategoriesSpecificValues {
|
||||||
/**
|
/**
|
||||||
* Category specific opening hours of the room
|
* Category specific opening hours of the room
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
openingHours?: string;
|
openingHours?: string;
|
||||||
}
|
}
|
||||||
@@ -121,32 +127,22 @@ export class SCRoomMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
||||||
SCPlaceWithoutReferencesMeta
|
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||||
>().fieldTranslations.de,
|
.fieldTranslations.de,
|
||||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
SCRoomSpecificValues>().fieldTranslations.de,
|
||||||
>().fieldTranslations.de,
|
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
|
||||||
SCRoomCategories,
|
|
||||||
SCRoomSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||||
.de,
|
.de,
|
||||||
floorName: 'Etagenbezeichnung',
|
floorName: 'Etagenbezeichnung',
|
||||||
inventory: 'Bestand',
|
inventory: 'Bestand',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
||||||
SCPlaceWithoutReferencesMeta
|
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||||
>().fieldTranslations.en,
|
.fieldTranslations.en,
|
||||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
SCRoomSpecificValues>().fieldTranslations.en,
|
||||||
>().fieldTranslations.en,
|
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
|
||||||
SCRoomCategories,
|
|
||||||
SCRoomSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||||
.en,
|
.en,
|
||||||
floorName: 'floor name',
|
floorName: 'floor name',
|
||||||
@@ -159,16 +155,11 @@ export class SCRoomMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
||||||
SCPlaceWithoutReferencesMeta
|
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||||
>().fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
SCRoomSpecificValues>().fieldValueTranslations.de,
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
|
||||||
SCRoomCategories,
|
|
||||||
SCRoomSpecificValues
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||||
.fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
categories: {
|
categories: {
|
||||||
@@ -189,16 +180,11 @@ export class SCRoomMeta
|
|||||||
type: 'Raum',
|
type: 'Raum',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCPlaceWithoutReferencesMeta.getInstance<
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
||||||
SCPlaceWithoutReferencesMeta
|
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||||
>().fieldValueTranslations.en,
|
.fieldValueTranslations.en,
|
||||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||||
SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
SCRoomSpecificValues>().fieldValueTranslations.en,
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
|
||||||
SCRoomCategories,
|
|
||||||
SCRoomSpecificValues
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||||
.fieldValueTranslations.en,
|
.fieldValueTranslations.en,
|
||||||
type: SCThingType.Room,
|
type: SCThingType.Room,
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,13 +12,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {
|
import {
|
||||||
SCAcademicTerm,
|
SCAcademicTerm,
|
||||||
SCAcademicTermWithoutReferences,
|
SCAcademicTermWithoutReferences,
|
||||||
SCAcademicTermWithoutReferencesMeta,
|
SCAcademicTermWithoutReferencesMeta,
|
||||||
} from '../base/AcademicTerm';
|
} from './abstract/academic-term';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A semester without references
|
* A semester without references
|
||||||
@@ -28,7 +28,9 @@ export interface SCSemesterWithoutReferences
|
|||||||
/**
|
/**
|
||||||
* The short name of the semester, using the given pattern.
|
* The short name of the semester, using the given pattern.
|
||||||
*
|
*
|
||||||
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
|
* @filterable
|
||||||
|
* @pattern ^(WS|SS|WiSe|SoSe) [0-9]{4}(/[0-9]{2})?$
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
acronym: string;
|
acronym: string;
|
||||||
|
|
||||||
@@ -42,6 +44,7 @@ export interface SCSemesterWithoutReferences
|
|||||||
* A semester
|
* A semester
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCSemester
|
export interface SCSemester
|
||||||
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||||
@@ -62,9 +65,7 @@ export class SCSemesterMeta
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.de,
|
||||||
SCAcademicTermWithoutReferencesMeta
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
acronym: 'Abkürzung',
|
acronym: 'Abkürzung',
|
||||||
endDate: 'Ende',
|
endDate: 'Ende',
|
||||||
eventsEndDate: 'Vorlesungsschluss',
|
eventsEndDate: 'Vorlesungsschluss',
|
||||||
@@ -72,9 +73,7 @@ export class SCSemesterMeta
|
|||||||
startDate: 'Beginn',
|
startDate: 'Beginn',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.en,
|
||||||
SCAcademicTermWithoutReferencesMeta
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
acronym: 'acronym',
|
acronym: 'acronym',
|
||||||
endDate: 'end date',
|
endDate: 'end date',
|
||||||
eventsEndDate: 'semester ending',
|
eventsEndDate: 'semester ending',
|
||||||
@@ -88,15 +87,13 @@ export class SCSemesterMeta
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
|
||||||
SCAcademicTermWithoutReferencesMeta
|
.fieldValueTranslations.de,
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
type: 'Semester',
|
type: 'Semester',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCAcademicTermWithoutReferencesMeta.getInstance<
|
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
|
||||||
SCAcademicTermWithoutReferencesMeta
|
.fieldValueTranslations.en,
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.Semester,
|
type: SCThingType.Semester,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,25 +12,21 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting without references
|
* A setting without references
|
||||||
*/
|
*/
|
||||||
export interface SCSettingWithoutReferences
|
export interface SCSettingWithoutReferences
|
||||||
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
|
||||||
* Categories of a setting
|
|
||||||
*/
|
|
||||||
categories: SCSettingCategories[];
|
|
||||||
/**
|
/**
|
||||||
* The default value of a setting
|
* The default value of a setting
|
||||||
*/
|
*/
|
||||||
@@ -41,6 +37,8 @@ export interface SCSettingWithoutReferences
|
|||||||
inputType: SCSettingInputType;
|
inputType: SCSettingInputType;
|
||||||
/**
|
/**
|
||||||
* The order number this setting should show up in its category list
|
* The order number this setting should show up in its category list
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
order: number;
|
order: number;
|
||||||
/**
|
/**
|
||||||
@@ -85,6 +83,7 @@ export enum SCSettingInputType {
|
|||||||
* A setting with references
|
* A setting with references
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCSetting
|
export interface SCSetting
|
||||||
extends SCSettingWithoutReferences, SCThing,
|
extends SCSettingWithoutReferences, SCThing,
|
||||||
@@ -115,6 +114,8 @@ export type SCSettingValues = SCSettingValue[];
|
|||||||
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* The translations of the possible values of a setting
|
* The translations of the possible values of a setting
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
values?: string[];
|
values?: string[];
|
||||||
}
|
}
|
||||||
@@ -128,10 +129,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||||
SCSettingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
defaultValue: 'Standard Wert',
|
defaultValue: 'Standard Wert',
|
||||||
inputType: 'Eingabetyp',
|
inputType: 'Eingabetyp',
|
||||||
order: 'Position',
|
order: 'Position',
|
||||||
@@ -139,10 +138,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
|||||||
values: 'Werte',
|
values: 'Werte',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||||
SCSettingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
defaultValue: 'default value',
|
defaultValue: 'default value',
|
||||||
inputType: 'input type',
|
inputType: 'input type',
|
||||||
order: 'position',
|
order: 'position',
|
||||||
@@ -156,10 +153,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
|||||||
*/
|
*/
|
||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||||
SCSettingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
credentials: 'Anmeldedaten',
|
credentials: 'Anmeldedaten',
|
||||||
others: 'Andere',
|
others: 'Andere',
|
||||||
@@ -176,10 +171,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
|||||||
type: 'Einstellung',
|
type: 'Einstellung',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||||
SCSettingCategories,
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.Setting,
|
type: SCThingType.Setting,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event';
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sport course without references
|
* A sport course without references
|
||||||
@@ -31,6 +31,7 @@ export interface SCSportCourseWithoutReferences
|
|||||||
* A sport course
|
* A sport course
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCSportCourse
|
export interface SCSportCourse
|
||||||
extends SCEvent, SCSportCourseWithoutReferences {
|
extends SCEvent, SCSportCourseWithoutReferences {
|
||||||
@@ -12,19 +12,19 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCMap} from '../general/map';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCAcademicPriceGroup,
|
SCAcademicPriceGroup,
|
||||||
SCThingThatCanBeOffered,
|
SCThingThatCanBeOffered,
|
||||||
|
SCThingThatCanBeOfferedMeta,
|
||||||
SCThingThatCanBeOfferedTranslatableProperties,
|
SCThingThatCanBeOfferedTranslatableProperties,
|
||||||
SCThingThatCanBeOfferedWithoutReferences,
|
SCThingThatCanBeOfferedWithoutReferences,
|
||||||
} from '../base/ThingThatCanBeOffered';
|
} from './abstract/thing-that-can-be-offered';
|
||||||
import {SCThingMeta, SCThingType} from '../Thing';
|
import {SCAcademicEventWithoutReferences} from './academic-event';
|
||||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
|
import {SCOrganizationWithoutReferences} from './organization';
|
||||||
import {SCMap} from '../types/Map';
|
import {SCPersonWithoutReferences} from './person';
|
||||||
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
|
|
||||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
|
||||||
import {SCOrganizationWithoutReferences} from './Organization';
|
|
||||||
import {SCPersonWithoutReferences} from './Person';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A study module without references
|
* A study module without references
|
||||||
@@ -34,6 +34,8 @@ export interface SCStudyModuleWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ECTS points (European Credit Transfer System)
|
* ECTS points (European Credit Transfer System)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
ects: number;
|
ects: number;
|
||||||
|
|
||||||
@@ -44,6 +46,9 @@ export interface SCStudyModuleWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Majors that this study module is meant for
|
* Majors that this study module is meant for
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors: string[];
|
majors: string[];
|
||||||
|
|
||||||
@@ -67,6 +72,7 @@ export interface SCStudyModuleWithoutReferences
|
|||||||
* A study module
|
* A study module
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCStudyModule
|
export interface SCStudyModule
|
||||||
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||||
@@ -111,6 +117,8 @@ export interface SCStudyModuleTranslatableProperties
|
|||||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translations of the majors that this study module is meant for
|
* Translations of the majors that this study module is meant for
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors?: string[];
|
majors?: string[];
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018, 2019 StApps
|
* Copyright (C) 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
|
import {SCISO8601Duration} from '../general/time';
|
||||||
import {SCMetaTranslations} from '../types/i18n';
|
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
import {SCISO8601Duration} from '../types/Time';
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ticket without references
|
* A ticket without references
|
||||||
@@ -29,13 +29,15 @@ export interface SCTicketWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Waiting number of the ticket
|
* Waiting number of the ticket
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
currentTicketNumber: string;
|
currentTicketNumber: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service type of the ticket
|
* Service type of the ticket
|
||||||
*/
|
*/
|
||||||
serviceType: any;
|
serviceType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a ticket
|
* Type of a ticket
|
||||||
@@ -47,6 +49,7 @@ export interface SCTicketWithoutReferences
|
|||||||
* A ticket
|
* A ticket
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCTicket
|
export interface SCTicket
|
||||||
extends SCTicketWithoutReferences, SCThingInPlace {
|
extends SCTicketWithoutReferences, SCThingInPlace {
|
||||||
@@ -12,16 +12,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCISO8601Date} from '../general/time';
|
||||||
|
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from '../base/ThingWithCategories';
|
} from './abstract/thing-with-categories';
|
||||||
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
|
||||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
|
||||||
import {SCISO8601Date} from '../types/Time';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A "to do" without references
|
* A "to do" without references
|
||||||
@@ -35,6 +35,8 @@ export interface SCToDoWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A date when the "to do" is due
|
* A date when the "to do" is due
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
*/
|
*/
|
||||||
dueDate?: SCISO8601Date;
|
dueDate?: SCISO8601Date;
|
||||||
|
|
||||||
@@ -53,6 +55,7 @@ export interface SCToDoWithoutReferences
|
|||||||
* A "to do"
|
* A "to do"
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCToDo
|
export interface SCToDo
|
||||||
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
||||||
@@ -85,19 +88,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||||
string,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.de,
|
|
||||||
done: 'Erledigt',
|
done: 'Erledigt',
|
||||||
dueDate: 'Fälligkeitsdatum',
|
dueDate: 'Fälligkeitsdatum',
|
||||||
priority: 'Priorität',
|
priority: 'Priorität',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||||
string,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
SCThingWithCategoriesSpecificValues
|
|
||||||
>().fieldTranslations.en,
|
|
||||||
done: 'done',
|
done: 'done',
|
||||||
dueDate: 'due date',
|
dueDate: 'due date',
|
||||||
priority: 'priority',
|
priority: 'priority',
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user