mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-13 01:36:22 +00:00
Compare commits
236 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ed3c11f1 | ||
|
|
b183198029 | ||
|
|
6e50b89b1a | ||
|
|
62ab6384d3 | ||
|
|
f864c64efa | ||
|
|
c1dc7b4e8f | ||
|
|
a096d5be62 | ||
|
|
ed6358a0c8 | ||
|
|
7f22cbb54c | ||
|
|
8b9bb45868 | ||
|
|
77f1f0a5b8 | ||
|
|
1015fd24ac | ||
|
|
618a9046bc | ||
|
|
c43e2b38e6 | ||
|
|
9d0ff36af5 | ||
|
|
31bb7e89ea | ||
|
|
942f04e250 | ||
|
|
930b574618 | ||
|
|
7b88be3a75 | ||
|
|
5277f7601c | ||
|
|
5241a01b55 | ||
| 484be6a890 | |||
|
|
45e0f26391 | ||
|
|
ead47aca19 | ||
|
|
f9c2414000 | ||
|
|
523de51160 | ||
|
|
d912c03eb0 | ||
|
|
a638f5447b | ||
|
|
cecf95aa46 | ||
|
|
6fd8c5adf3 | ||
|
|
db24b41d99 | ||
|
|
b1fcd22ab2 | ||
|
|
268588fb6f | ||
|
|
d3048a12d8 | ||
|
|
e14993114f | ||
|
|
4237f6ad60 | ||
|
|
e7c1000bc4 | ||
|
|
e0adb2332e | ||
|
|
e5696b23e7 | ||
|
|
659d0974f7 | ||
|
|
e8304eeeb4 | ||
|
|
dca9d26c66 | ||
|
|
852e0f5373 | ||
|
|
26dd531d24 | ||
|
|
52bdf93356 | ||
|
|
7509610145 | ||
|
|
972cdf392d | ||
|
|
4f758f7d0c | ||
|
|
980e899807 | ||
|
|
d1c5bb9595 | ||
|
|
dc9c0f528f | ||
|
|
66d64e0858 | ||
|
|
06339786c2 | ||
|
|
8ed68481fa | ||
|
|
e26042957c | ||
|
|
7553620a5d | ||
|
|
322c001e70 | ||
|
|
830e249ac4 | ||
|
|
8c9df3ea9a | ||
|
|
f85768d32e | ||
|
|
580ace368f | ||
|
|
522be6643a | ||
|
|
8784309ddb | ||
|
|
3d8f996690 | ||
|
|
36a4bfcbbc | ||
|
|
db347bf324 | ||
|
|
7a2e0f20d1 | ||
|
|
b2d18da82a | ||
|
|
fae7395cf0 | ||
|
|
0745b1af72 | ||
|
|
a2b2cefe8e | ||
|
|
04b21a7c5d | ||
|
|
ca7626db17 | ||
|
|
e8d492a18a | ||
|
|
aa294c4e29 | ||
|
|
369bb906c1 | ||
|
|
aa38fef293 | ||
|
|
ded8e7dfd5 | ||
|
|
d47897c7e8 | ||
|
|
9ab5280b2e | ||
|
|
596788f3a1 | ||
|
|
70271a4849 | ||
|
|
98ab64403f | ||
|
|
3d1bb6ef13 | ||
|
|
d5f39517e8 | ||
|
|
dfe35d71a3 | ||
|
|
cdaa83122f | ||
|
|
937919f1a7 | ||
|
|
3249300dac | ||
|
|
5acf49fd52 | ||
|
|
07b5ad1618 | ||
|
|
d56c3d11a8 | ||
|
|
83f00f40bf | ||
|
|
782ee3758a | ||
|
|
8a28d6fa86 | ||
|
|
ed53c6595e | ||
|
|
49ea2c59ab | ||
|
|
869fa831ea | ||
|
|
21eeecd5ee | ||
|
|
2dfb64bafd | ||
|
|
4ab8770fbc | ||
|
|
2cf1027796 | ||
|
|
3aed37ecb4 | ||
|
|
ddb26b8207 | ||
|
|
805c1f0937 | ||
|
|
5377d026f3 | ||
|
|
148fd77f4d | ||
|
|
4036bfd193 | ||
|
|
f4f372b9ad | ||
|
|
872c1f5fc3 | ||
|
|
4f2ca30dab | ||
|
|
882483ee24 | ||
|
|
c998166938 | ||
|
|
d61e33de39 | ||
|
|
07d6c4770a | ||
|
|
aab3e9fa6c | ||
|
|
4a4cd4e6d4 | ||
|
|
942cd11469 | ||
|
|
fe090c7387 | ||
|
|
f0782d8820 | ||
|
|
a2461d5904 | ||
|
|
d2e0069dc2 | ||
|
|
9c6972af78 | ||
|
|
56b03aa0b9 | ||
|
|
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 |
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
resources
|
||||
openapi
|
||||
29
.eslintrc.json
Normal file
29
.eslintrc.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"extends": "@openstapps",
|
||||
"rules": {
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"jsdoc/check-tag-names": [
|
||||
"error",
|
||||
{
|
||||
"definedTags": [
|
||||
"internal",
|
||||
"aggregatable",
|
||||
"float",
|
||||
"indexable",
|
||||
"integer",
|
||||
"keyword",
|
||||
"sortable",
|
||||
"text",
|
||||
"date",
|
||||
"validatable",
|
||||
"filterable",
|
||||
"inheritTags",
|
||||
"minLength",
|
||||
"pattern",
|
||||
"typeparam",
|
||||
"TJS-format"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@ pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
.DS_Store
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
image: registry.gitlab.com/openstapps/projectmanagement/node
|
||||
|
||||
cache:
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
paths:
|
||||
- node_modules
|
||||
|
||||
before_script:
|
||||
- npm install
|
||||
|
||||
stages:
|
||||
- build
|
||||
- review
|
||||
- test
|
||||
- audit
|
||||
- deploy
|
||||
- publish
|
||||
|
||||
build:
|
||||
tags:
|
||||
@@ -24,8 +22,48 @@ build:
|
||||
- lib
|
||||
expire_in: 1 week
|
||||
|
||||
build-ts-3.8.3:
|
||||
tags:
|
||||
- performance
|
||||
stage: build
|
||||
script:
|
||||
- npm uninstall typescript
|
||||
- npm install typescript@3.8.3
|
||||
- npm run build
|
||||
|
||||
docs_review:
|
||||
dependencies:
|
||||
- build
|
||||
stage: review
|
||||
script:
|
||||
- npm run documentation
|
||||
- ./node_modules/.bin/surge -p ./docs -d https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
||||
when: manual
|
||||
environment:
|
||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
||||
url: https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
||||
on_stop: stop_review
|
||||
except:
|
||||
- master
|
||||
- develop
|
||||
tags:
|
||||
- secrecy
|
||||
|
||||
stop_review:
|
||||
stage: review
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
- ./node_modules/.bin/surge teardown $CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh
|
||||
when: manual
|
||||
environment:
|
||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
||||
action: stop
|
||||
tags:
|
||||
- secrecy
|
||||
|
||||
audit:
|
||||
stage: test
|
||||
stage: audit
|
||||
script:
|
||||
- npm audit
|
||||
allow_failure: true
|
||||
@@ -33,9 +71,9 @@ audit:
|
||||
- schedules
|
||||
|
||||
scheduled-audit:
|
||||
stage: test
|
||||
stage: audit
|
||||
script:
|
||||
- npm audit
|
||||
- npm audit --audit-level=high
|
||||
only:
|
||||
- schedules
|
||||
|
||||
@@ -45,17 +83,37 @@ test:
|
||||
stage: test
|
||||
script:
|
||||
- npm test
|
||||
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
|
||||
artifacts:
|
||||
paths:
|
||||
- report
|
||||
- coverage
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: coverage/cobertura-coverage.xml
|
||||
|
||||
mapping:
|
||||
tags:
|
||||
- performance
|
||||
dependencies:
|
||||
- build
|
||||
stage: test
|
||||
services:
|
||||
- name: registry.gitlab.com/openstapps/database:master
|
||||
alias: elasticsearch
|
||||
script:
|
||||
- npm run mappings-integration
|
||||
artifacts:
|
||||
paths:
|
||||
- lib
|
||||
|
||||
package:
|
||||
dependencies:
|
||||
- build
|
||||
tags:
|
||||
- secrecy
|
||||
stage: deploy
|
||||
stage: publish
|
||||
script:
|
||||
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
|
||||
- npm publish
|
||||
|
||||
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>
|
||||
467
CHANGELOG.md
467
CHANGELOG.md
@@ -1,3 +1,404 @@
|
||||
# [0.69.0](https://gitlab.com/openstapps/core/compare/v0.68.0...v0.69.0) (2022-08-17)
|
||||
|
||||
|
||||
|
||||
# [0.68.0](https://gitlab.com/openstapps/core/compare/v0.67.0...v0.68.0) (2022-06-27)
|
||||
|
||||
|
||||
|
||||
# [0.67.0](https://gitlab.com/openstapps/core/compare/v0.66.1...v0.67.0) (2022-05-31)
|
||||
|
||||
|
||||
|
||||
## [0.66.1](https://gitlab.com/openstapps/core/compare/v0.66.0...v0.66.1) (2022-05-27)
|
||||
|
||||
|
||||
|
||||
# [0.66.0](https://gitlab.com/openstapps/core/compare/v0.65.1...v0.66.0) (2022-05-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add geo filter envelope support ([484be6a](https://gitlab.com/openstapps/core/commit/484be6a890d743601efa5d40d33ea2c619f3126d))
|
||||
|
||||
|
||||
|
||||
## [0.65.1](https://gitlab.com/openstapps/core/compare/v0.65.0...v0.65.1) (2022-04-04)
|
||||
|
||||
|
||||
|
||||
# [0.65.0](https://gitlab.com/openstapps/core/compare/v0.64.0...v0.65.0) (2022-04-04)
|
||||
|
||||
|
||||
|
||||
# [0.64.0](https://gitlab.com/openstapps/core/compare/v0.63.0...v0.64.0) (2022-03-21)
|
||||
|
||||
|
||||
|
||||
# [0.63.0](https://gitlab.com/openstapps/core/compare/v0.62.0...v0.63.0) (2022-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add auth object to index route ([e149931](https://gitlab.com/openstapps/core/commit/e14993114f0ec370775010eee4ad0d302a0beebb))
|
||||
|
||||
|
||||
|
||||
# [0.62.0](https://gitlab.com/openstapps/core/compare/v0.61.0...v0.62.0) (2022-01-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing lastPublished to SCCreativeWork ([e0adb23](https://gitlab.com/openstapps/core/commit/e0adb2332ec24ce388c4c008b51b7aa941948532))
|
||||
|
||||
|
||||
|
||||
# [0.61.0](https://gitlab.com/openstapps/core/compare/v0.60.0...v0.61.0) (2022-01-21)
|
||||
|
||||
|
||||
|
||||
# [0.60.0](https://gitlab.com/openstapps/core/compare/v0.59.0...v0.60.0) (2022-01-21)
|
||||
|
||||
|
||||
|
||||
# [0.59.0](https://gitlab.com/openstapps/core/compare/v0.58.0...v0.59.0) (2022-01-20)
|
||||
|
||||
|
||||
|
||||
# [0.58.0](https://gitlab.com/openstapps/core/compare/v0.57.0...v0.58.0) (2022-01-18)
|
||||
|
||||
|
||||
|
||||
# [0.57.0](https://gitlab.com/openstapps/core/compare/v0.56.0...v0.57.0) (2022-01-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* extend config to describe auth providers ([7553620](https://gitlab.com/openstapps/core/commit/7553620a5d330ebfb66461afeab700e36bd37165))
|
||||
|
||||
|
||||
|
||||
# [0.56.0](https://gitlab.com/openstapps/core/compare/v0.55.0...v0.56.0) (2021-12-17)
|
||||
|
||||
|
||||
|
||||
# [0.55.0](https://gitlab.com/openstapps/core/compare/v0.54.0...v0.55.0) (2021-12-15)
|
||||
|
||||
|
||||
|
||||
# [0.54.0](https://gitlab.com/openstapps/core/compare/v0.53.0...v0.54.0) (2021-11-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add SCAssessment ([7a2e0f2](https://gitlab.com/openstapps/core/commit/7a2e0f20d1c64ab1deb7ab30bfb4bab4daaabd6d))
|
||||
|
||||
|
||||
|
||||
# [0.53.0](https://gitlab.com/openstapps/core/compare/v0.52.0...v0.53.0) (2021-10-19)
|
||||
|
||||
|
||||
|
||||
# [0.52.0](https://gitlab.com/openstapps/core/compare/v0.51.0...v0.52.0) (2021-09-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add about config ([aa294c4](https://gitlab.com/openstapps/core/commit/aa294c4e29e9191bef6d79487b0b321fbc34f6fb))
|
||||
|
||||
|
||||
|
||||
# [0.51.0](https://gitlab.com/openstapps/core/compare/v0.50.0...v0.51.0) (2021-09-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add physicalobject to book categories ([ded8e7d](https://gitlab.com/openstapps/core/commit/ded8e7dfd51094c02a86e1383a4e94c069c10e64))
|
||||
|
||||
|
||||
|
||||
# [0.50.0](https://gitlab.com/openstapps/core/compare/v0.49.5...v0.50.0) (2021-09-01)
|
||||
|
||||
|
||||
|
||||
## [0.49.5](https://gitlab.com/openstapps/core/compare/v0.49.3...v0.49.5) (2021-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test resources from hds2 ([dfe35d7](https://gitlab.com/openstapps/core/commit/dfe35d71a38c35064726365f99714abff3b30ba6))
|
||||
|
||||
|
||||
|
||||
## [0.49.3](https://gitlab.com/openstapps/core/compare/v0.49.2...v0.49.3) (2021-08-18)
|
||||
|
||||
|
||||
|
||||
## [0.49.2](https://gitlab.com/openstapps/core/compare/v0.49.1...v0.49.2) (2021-08-17)
|
||||
|
||||
|
||||
|
||||
## [0.49.1](https://gitlab.com/openstapps/core/compare/v0.49.0...v0.49.1) (2021-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* documentation generation ([8a28d6f](https://gitlab.com/openstapps/core/commit/8a28d6fa8657d778d6ae0d38cda7da3531d6478c))
|
||||
|
||||
|
||||
|
||||
# [0.49.0](https://gitlab.com/openstapps/core/compare/v0.48.0...v0.49.0) (2021-08-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add elasticsearch mappings to build ([21eeecd](https://gitlab.com/openstapps/core/commit/21eeecd5ee0d68a4faa93bb70d2187ce35807b01))
|
||||
|
||||
|
||||
|
||||
# [0.48.0](https://gitlab.com/openstapps/core/compare/v0.47.0...v0.48.0) (2021-07-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct parameter name of thing update route ([872c1f5](https://gitlab.com/openstapps/core/commit/872c1f5fc3884b6df6f5025287873d98b27dd6b1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support geo shape queries ([882483e](https://gitlab.com/openstapps/core/commit/882483ee2490938014904bc26687bd1648992ae6))
|
||||
|
||||
|
||||
|
||||
# [0.47.0](https://gitlab.com/openstapps/core/compare/v0.46.0...v0.47.0) (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* set date-series frequency non translatable ([4a4cd4e](https://gitlab.com/openstapps/core/commit/4a4cd4e6d4b01ac34b5338dfcf4aeb959f54461d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make SCDateSeries.frequency compliant with schema.org ([942cd11](https://gitlab.com/openstapps/core/commit/942cd1146966aa9e60321160489a6605877925e9))
|
||||
|
||||
|
||||
|
||||
# [0.46.0](https://gitlab.com/openstapps/core/compare/v0.45.0...v0.46.0) (2021-05-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* change range offer to use date range ([9c6972a](https://gitlab.com/openstapps/core/commit/9c6972af787678567409877b6bc9f9417e1374e2))
|
||||
|
||||
|
||||
|
||||
# [0.45.0](https://gitlab.com/openstapps/core/compare/v0.44.0...v0.45.0) (2021-04-26)
|
||||
|
||||
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
@@ -7,8 +408,8 @@
|
||||
|
||||
### Features
|
||||
|
||||
* add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0))
|
||||
* add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
|
||||
* 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)
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +418,8 @@
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2a))
|
||||
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64ba))
|
||||
* 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))
|
||||
|
||||
|
||||
|
||||
@@ -27,9 +428,9 @@
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507e)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* 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/ca72c20bd098032745ed0eb6978902b6ff6feac5)), 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)
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +439,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -55,13 +456,13 @@
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042))
|
||||
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed61)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
||||
* 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/623ed613a9405b53a86a33c13d48bc49d48de1ce)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
||||
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +471,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -79,14 +480,14 @@
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9))
|
||||
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fca))
|
||||
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9eb810de94ca0bb6e1298799ee3f550145))
|
||||
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fcac42c21c68b5c6aa6bcf9bbdecfdf84de7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2e)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
|
||||
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
||||
* 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/5d1e79d4879e6ce8f43d4cebb9d8c8500d5d16b7)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
||||
|
||||
|
||||
|
||||
@@ -95,12 +496,12 @@
|
||||
|
||||
### 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
|
||||
|
||||
* 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))
|
||||
|
||||
|
||||
|
||||
@@ -109,8 +510,8 @@
|
||||
|
||||
### 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 maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e))
|
||||
* 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/b5bd09e40bfb49463815538ebaa44ff53b5d7b92))
|
||||
|
||||
|
||||
|
||||
@@ -119,7 +520,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -132,7 +533,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -149,7 +550,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -158,7 +559,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -167,13 +568,13 @@
|
||||
|
||||
### 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
|
||||
|
||||
* 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 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 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/a4f3fab033ca18352c0119061f2d0e64252d4bbb)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||
|
||||
|
||||
|
||||
@@ -182,7 +583,7 @@
|
||||
|
||||
### 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))
|
||||
|
||||
|
||||
|
||||
@@ -191,9 +592,9 @@
|
||||
|
||||
### Features
|
||||
|
||||
* add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc4))
|
||||
* add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a))
|
||||
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2))
|
||||
* 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/2d4a76a555603a395c81a7a92ce5d95ed04de9de))
|
||||
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2d676895264f43b0138645d7c13f60c9db))
|
||||
|
||||
|
||||
|
||||
@@ -201,12 +602,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
|
||||
|
||||
* 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.
|
||||
|
||||
## 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
|
||||
|
||||
### Extract inline type definitions
|
||||
|
||||
25
README.md
25
README.md
@@ -35,15 +35,18 @@ node --require ts-node/register src/cli.ts routes PATH/TO/ROUTES.md
|
||||
Annotations are used to add additional informations to fields, which are used to autogenerate mappings from the core objects.
|
||||
External dependencies can not be covered by the annotations. Documentation about some of the annotations can be found in: [typedoc](https://typedoc.org/guides/doccomments/)
|
||||
|
||||
| annotation | description | parameters |
|
||||
|-------------------|-------------------------------------------|---------------|
|
||||
| `@aggregatable` | used for generating of aggregations of the field if the core schema is used to put data into a database/key-value store | |
|
||||
| `@float` | number field is interpreted as float | |
|
||||
| `@indexable` | marks the type as indexable if the core schema is used to put data into a database/key-value store| |
|
||||
| `@integer` | number field is interpreted as integer | |
|
||||
| `@keyword` | string field is interpreted as keyword | |
|
||||
| `@sortable` | field is sortable if the core schema is used to put data into a database/key-value store | sort method to be used: ducet, price, distance |
|
||||
| `@text` | string field is interpreted as text | |
|
||||
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |
|
||||
|
||||
| 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 for json schema generation, which can be checked at runtime. Any top-level type that is put into a database should always be marked as validatable. | |
|
||||
| `@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.*
|
||||
|
||||
7536
package-lock.json
generated
7536
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
86
package.json
86
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openstapps/core",
|
||||
"version": "0.23.0",
|
||||
"version": "0.70.0",
|
||||
"description": "StAppsCore - Generalized model of data",
|
||||
"keywords": [
|
||||
"Model",
|
||||
@@ -14,66 +14,83 @@
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "npm run tslint && npm run compile && npm run pack && npm run schema",
|
||||
"build": "npm run lint && npm run compile && npm run pack && npm run schema && npm run mappings",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'",
|
||||
"check-configuration": "openstapps-configuration",
|
||||
"compile": "rimraf lib && tsc",
|
||||
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
||||
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
|
||||
"pack": "openstapps-core-tools pack",
|
||||
"postversion": "npm run changelog",
|
||||
"prepublishOnly": "npm ci && npm run build",
|
||||
"preversion": "npm run prepublishOnly",
|
||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src lib/schema",
|
||||
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
|
||||
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
||||
"mappings": "mkdir lib/mappings && openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json",
|
||||
"mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/",
|
||||
"test": "nyc mocha --recursive 'test/*.spec.ts'",
|
||||
"lint": "eslint --ext .ts src/"
|
||||
},
|
||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"contributors": [
|
||||
"Andreas Lehmann",
|
||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||
"Axel Nieder-Vahrenholz",
|
||||
"Benjamin Jöckel",
|
||||
"Imran Hossain",
|
||||
"Frank Nagel",
|
||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||
"Michel Jonathan Schmitz",
|
||||
"Rainer Killinger",
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||
"Roman Klopsch",
|
||||
"Sebastian Lange",
|
||||
"Wieland Schöbl"
|
||||
"Thea Schöbl"
|
||||
],
|
||||
"dependencies": {
|
||||
"@openstapps/core-tools": "0.32.0",
|
||||
"@types/geojson": "1.0.6",
|
||||
"@types/json-patch": "0.0.30",
|
||||
"@types/node": "10.14.10",
|
||||
"fast-clone": "1.5.13",
|
||||
"http-status-codes": "1.3.2",
|
||||
"@types/json-schema": "7.0.11",
|
||||
"@types/node": "14.18.24",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"http-status-codes": "2.2.0",
|
||||
"json-patch": "0.7.0",
|
||||
"jsonschema": "1.2.4",
|
||||
"ts-optchain": "0.1.3"
|
||||
"json-schema": "0.4.0",
|
||||
"rfdc": "1.3.0",
|
||||
"ts-optchain": "0.1.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@krlwlfrt/async-pool": "0.1.0",
|
||||
"@openstapps/configuration": "0.21.0",
|
||||
"@openstapps/core-tools": "0.7.0",
|
||||
"@openstapps/logger": "0.3.1",
|
||||
"@types/chai": "4.1.7",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"chai": "4.2.0",
|
||||
"commander": "2.20.0",
|
||||
"conditional-type-checks": "1.0.1",
|
||||
"conventional-changelog-cli": "2.0.21",
|
||||
"mocha": "6.1.4",
|
||||
"mocha-typescript": "1.1.17",
|
||||
"nyc": "14.1.1",
|
||||
"rimraf": "2.6.3",
|
||||
"source-map-support": "0.5.12",
|
||||
"ts-node": "8.3.0",
|
||||
"tslint": "5.18.0",
|
||||
"typedoc": "0.14.2",
|
||||
"typescript": "3.5.2"
|
||||
"@openstapps/configuration": "0.33.0",
|
||||
"@openstapps/es-mapping-generator": "0.3.0",
|
||||
"@openstapps/eslint-config": "1.1.0",
|
||||
"@openstapps/logger": "1.0.0",
|
||||
"@testdeck/mocha": "0.2.0",
|
||||
"@types/chai": "4.3.3",
|
||||
"@types/lodash": "4.14.182",
|
||||
"@types/mocha": "9.1.1",
|
||||
"@types/rimraf": "3.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "5.33.1",
|
||||
"@typescript-eslint/parser": "5.33.1",
|
||||
"chai": "4.3.6",
|
||||
"conditional-type-checks": "1.0.6",
|
||||
"conventional-changelog-cli": "2.2.2",
|
||||
"eslint": "8.22.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-jsdoc": "39.3.6",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-unicorn": "43.0.2",
|
||||
"lodash": "4.17.21",
|
||||
"mocha": "10.0.0",
|
||||
"nyc": "15.1.0",
|
||||
"prettier": "2.7.1",
|
||||
"rimraf": "3.0.2",
|
||||
"source-map-support": "0.5.21",
|
||||
"surge": "0.23.1",
|
||||
"ts-node": "10.9.1",
|
||||
"typedoc": "0.22.18",
|
||||
"typescript": "4.4.4"
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"branches": 85,
|
||||
"branches": 90,
|
||||
"check-coverage": true,
|
||||
"exclude": [],
|
||||
"extension": [
|
||||
@@ -83,12 +100,15 @@
|
||||
"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": [
|
||||
"cobertura",
|
||||
"html",
|
||||
"text-summary"
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,15 +12,23 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// tslint:disable-next-line:no-implicit-dependencies
|
||||
import {Polygon} from 'geojson';
|
||||
import {SCTranslations} from '../general/i18n';
|
||||
import {SCSetting} from '../things/setting';
|
||||
import {SCMap} from '../general/map';
|
||||
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
|
||||
import {SCAuthorizationProviderType} from './authorization';
|
||||
import {SCFeatureConfiguration} from './feature';
|
||||
|
||||
/**
|
||||
* An app configuration menu item
|
||||
*/
|
||||
export interface SCAppConfigurationMenuItem {
|
||||
/**
|
||||
* Key of authorization provider available in SCConfigFile
|
||||
* Restricting and enabling the usage of this item
|
||||
*/
|
||||
authProvider?: SCAuthorizationProviderType;
|
||||
|
||||
/**
|
||||
* Icon for the menu item
|
||||
*/
|
||||
@@ -54,11 +62,7 @@ export interface SCAppConfigurationMenuCategory {
|
||||
/**
|
||||
* ID of the menu category
|
||||
*/
|
||||
id:
|
||||
'main'
|
||||
| 'meta'
|
||||
| 'personal'
|
||||
| 'external';
|
||||
id: 'main' | 'meta' | 'personal' | 'external';
|
||||
|
||||
/**
|
||||
* A list of items that belong to the category
|
||||
@@ -80,15 +84,22 @@ export interface SCAppConfigurationMenuCategory {
|
||||
* An app configuration
|
||||
*/
|
||||
export interface SCAppConfiguration {
|
||||
/**
|
||||
* The about page
|
||||
*
|
||||
* Mapping route -> page config
|
||||
*/
|
||||
aboutPages: SCMap<SCAboutPage>;
|
||||
|
||||
/**
|
||||
* Polygon that encapsulates the main campus
|
||||
*/
|
||||
campusPolygon: Polygon;
|
||||
|
||||
/**
|
||||
* A list of features to en- or disable
|
||||
* Maps of enabled features (plugins and external services)
|
||||
*/
|
||||
features: SCAppConfigurationFeature;
|
||||
features: SCFeatureConfiguration;
|
||||
|
||||
/**
|
||||
* A URL where images are available
|
||||
@@ -112,8 +123,9 @@ export interface SCAppConfiguration {
|
||||
|
||||
/**
|
||||
* A list of available settings in the app
|
||||
* !Important! Use provided specific settings, for other settings use general SCSetting
|
||||
*/
|
||||
settings: SCSetting[];
|
||||
settings: Array<SCUserGroupSetting | SCLanguageSetting | SCSetting>;
|
||||
|
||||
/**
|
||||
* Map of store URLs
|
||||
@@ -126,16 +138,6 @@ export interface SCAppConfiguration {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map of features
|
||||
*/
|
||||
export interface SCAppConfigurationFeature {
|
||||
/**
|
||||
* Whether or not widgets are enabled
|
||||
*/
|
||||
widgets: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* URLs of published apps
|
||||
*/
|
||||
@@ -173,3 +175,147 @@ export interface SCAppConfigurationMenuCategoryTranslationName {
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export enum SCAboutPageContentType {
|
||||
SECTION = 'section',
|
||||
ROUTER_LINK = 'router link',
|
||||
TABLE = 'table',
|
||||
MARKDOWN = 'markdown',
|
||||
}
|
||||
|
||||
export interface SCAboutPageTranslationTitle {
|
||||
/**
|
||||
* Translation of the title
|
||||
*/
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface SCAboutPageTranslationValue {
|
||||
/**
|
||||
* Translation of the value
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A (mostly) self-contained section, akin to markdown `# Title`
|
||||
*/
|
||||
export interface SCAboutPageSection {
|
||||
/**
|
||||
* If the section should be contained in a card
|
||||
*/
|
||||
card?: true;
|
||||
|
||||
/**
|
||||
* The content of the section
|
||||
*/
|
||||
content: SCAboutPageContent;
|
||||
|
||||
/**
|
||||
* The title of the section
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Translations
|
||||
*/
|
||||
translations: SCTranslations<SCAboutPageTranslationTitle>;
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
type: SCAboutPageContentType.SECTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* A router link that can lead to a new page
|
||||
*
|
||||
* For external links, prefer markdown `[destination](link)`
|
||||
*/
|
||||
export interface SCAboutPageRouterLink {
|
||||
/**
|
||||
* Icon of the destination
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
/**
|
||||
* Router link
|
||||
*/
|
||||
link: string;
|
||||
|
||||
/**
|
||||
* Title of the destination
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Translations
|
||||
*/
|
||||
translations: SCTranslations<SCAboutPageTranslationTitle>;
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
type: SCAboutPageContentType.ROUTER_LINK;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple table element
|
||||
*/
|
||||
export interface SCAboutPageTable {
|
||||
/**
|
||||
* Rows of the table
|
||||
*/
|
||||
rows: SCAboutPageContent[][];
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
type: SCAboutPageContentType.TABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* A markdown element
|
||||
*/
|
||||
export interface SCAboutPageMarkdown {
|
||||
/**
|
||||
* Translations
|
||||
*/
|
||||
translations: SCTranslations<SCAboutPageTranslationValue>;
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
type: SCAboutPageContentType.MARKDOWN;
|
||||
|
||||
/**
|
||||
* Value (Markdown)
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type SCAboutPageContent =
|
||||
| SCAboutPageMarkdown
|
||||
| SCAboutPageTable
|
||||
| SCAboutPageSection
|
||||
| SCAboutPageRouterLink;
|
||||
|
||||
/**
|
||||
* Root of the about page
|
||||
*/
|
||||
export interface SCAboutPage {
|
||||
/**
|
||||
* Content of the page
|
||||
*/
|
||||
content: SCAboutPageContent[];
|
||||
|
||||
/**
|
||||
* Header (title) of the page
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Translations
|
||||
*/
|
||||
translations: SCTranslations<SCAboutPageTranslationTitle>;
|
||||
}
|
||||
|
||||
96
src/config/authorization.ts
Normal file
96
src/config/authorization.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCUserConfigurationMap} from './user';
|
||||
|
||||
/**
|
||||
* Supported authorization provider types
|
||||
*
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1
|
||||
* @see https://github.com/gbv/paia
|
||||
*/
|
||||
export type SCAuthorizationProviderType = 'default' | 'paia';
|
||||
|
||||
/**
|
||||
* An authorization provider complete configuration
|
||||
*/
|
||||
export interface SCAuthorizationProvider {
|
||||
/**
|
||||
* An authorization provider client configuration
|
||||
*/
|
||||
client: SCAuthorizationProviderClient;
|
||||
|
||||
/**
|
||||
* An authorization provider endpoints configuration
|
||||
*/
|
||||
endpoints: SCAuthorizationProviderEndpoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* An authorization provider client configuration
|
||||
*/
|
||||
export interface SCAuthorizationProviderClient {
|
||||
/**
|
||||
* Client ID
|
||||
*/
|
||||
clientId: string;
|
||||
|
||||
/**
|
||||
* Scopes to request
|
||||
*/
|
||||
scopes: string;
|
||||
|
||||
/**
|
||||
* Main url to reach authorization provider
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An authorization provider endpoints configuration
|
||||
*/
|
||||
export interface SCAuthorizationProviderEndpoints {
|
||||
/**
|
||||
* URL to start authentication flow
|
||||
*/
|
||||
authorization: string;
|
||||
|
||||
/**
|
||||
* URL to end current session
|
||||
*/
|
||||
endSession?: string;
|
||||
|
||||
/**
|
||||
* Mapping of how to create SCUser from userinfo endpoint response (using JSONPath syntax)
|
||||
*
|
||||
* @see https://www.npmjs.com/package/jsonpath
|
||||
*/
|
||||
mapping: SCUserConfigurationMap;
|
||||
|
||||
/**
|
||||
* URL to revoke a token
|
||||
*/
|
||||
revoke?: string;
|
||||
|
||||
/**
|
||||
* URL to get access Token
|
||||
*/
|
||||
token: string;
|
||||
|
||||
/**
|
||||
* URL to general user info endpoint
|
||||
*/
|
||||
userinfo: string;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -22,6 +22,13 @@ import {SCMonitoringConfiguration} from './monitoring';
|
||||
* A backend configuration
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -30,6 +37,13 @@ export interface SCBackendConfiguration {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -81,29 +95,25 @@ export interface SCBackendConfigurationSortableField {
|
||||
* A list of supported sorts on this field
|
||||
*/
|
||||
sortTypes: SCSearchSortType[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible context names to be used by the search request
|
||||
*/
|
||||
export type SCSearchContext =
|
||||
| 'default'
|
||||
| 'dining'
|
||||
| 'place';
|
||||
export type SCSearchContext = 'default' | 'dining' | 'place';
|
||||
|
||||
/**
|
||||
* A boosting configuration for one context
|
||||
*/
|
||||
export type SCBackendConfigurationSearchBoostingContext =
|
||||
SCRestrictedMap<SCSearchContext,
|
||||
SCBackendConfigurationSearchBoostingType[]>;
|
||||
export type SCBackendConfigurationSearchBoostingContext = SCRestrictedMap<
|
||||
SCSearchContext,
|
||||
SCBackendConfigurationSearchBoostingType[]
|
||||
>;
|
||||
|
||||
/**
|
||||
* A boosting configuration for one SCType
|
||||
*/
|
||||
export interface SCBackendConfigurationSearchBoostingType {
|
||||
|
||||
/**
|
||||
* The factor of which the scores matching this type should be multiplied by
|
||||
*/
|
||||
|
||||
48
src/config/feature.ts
Normal file
48
src/config/feature.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCMap} from '../general/map';
|
||||
import {SCAuthorizationProviderType} from './authorization';
|
||||
|
||||
export interface SCFeatureConfiguration {
|
||||
/**
|
||||
* Map of extern services mapped by their name (statically)
|
||||
*/
|
||||
extern?: SCMap<SCFeatureConfigurationExtern>;
|
||||
|
||||
/**
|
||||
* Map of plugins registered with the backend mapped by their name.
|
||||
*/
|
||||
plugins?: SCMap<SCFeatureConfigurationPlugin>;
|
||||
}
|
||||
|
||||
export interface SCFeatureConfigurationPlugin {
|
||||
/**
|
||||
* URL path registered with the backend
|
||||
*/
|
||||
urlPath: string;
|
||||
}
|
||||
|
||||
export interface SCFeatureConfigurationExtern {
|
||||
/**
|
||||
* Key of authorization provider available in SCConfigFile
|
||||
*/
|
||||
authProvider?: SCAuthorizationProviderType;
|
||||
|
||||
/**
|
||||
* URL of extern service
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,19 +14,25 @@
|
||||
*/
|
||||
import {SCLicensePlate} from '../general/namespaces';
|
||||
import {SCAppConfiguration} from './app';
|
||||
import {SCAuthorizationProvider, SCAuthorizationProviderType} from './authorization';
|
||||
import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend';
|
||||
|
||||
/**
|
||||
* A configuration file that configures app and backend
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCConfigFile {
|
||||
|
||||
/**
|
||||
* Configuration for the app that is visible to clients
|
||||
*/
|
||||
app: SCAppConfiguration;
|
||||
|
||||
/**
|
||||
* Configuration for the supported authorization providers
|
||||
*/
|
||||
auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider};
|
||||
|
||||
/**
|
||||
* Configuration for the backend that is visible to clients
|
||||
*/
|
||||
|
||||
66
src/config/user.ts
Normal file
66
src/config/user.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* User configuration keys mapped to string type while including their requiredness
|
||||
*/
|
||||
export type SCUserConfigurationMap = {[K in keyof SCUserConfigurationOptional]?: string} & {
|
||||
[K in keyof SCUserConfigurationRequired]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* A user configuration
|
||||
*/
|
||||
export type SCUserConfiguration = SCUserConfigurationRequired & SCUserConfigurationOptional;
|
||||
|
||||
/**
|
||||
* A user configurations required properties
|
||||
*/
|
||||
interface SCUserConfigurationRequired {
|
||||
/**
|
||||
* ID given to the user
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The complete name of the user combining all the parts of the name into one
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A user configurations optional properties
|
||||
*/
|
||||
interface SCUserConfigurationOptional {
|
||||
/**
|
||||
* User's e-mail
|
||||
*/
|
||||
email?: string;
|
||||
/**
|
||||
* User's family name
|
||||
*/
|
||||
familyName?: string;
|
||||
/**
|
||||
* User's given name
|
||||
*/
|
||||
givenName?: string;
|
||||
/**
|
||||
* Role assigned to the user
|
||||
*/
|
||||
role?: string;
|
||||
/**
|
||||
* Student ID given to the user
|
||||
*/
|
||||
studentId?: string;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -18,11 +18,15 @@
|
||||
export interface SCLanguage {
|
||||
/**
|
||||
* The two letter ISO 639-1 Code of the Language
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
code: SCLanguageCode;
|
||||
|
||||
/**
|
||||
* The Fulltext name of the Language
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
name: SCLanguageName;
|
||||
}
|
||||
@@ -33,7 +37,7 @@ export interface SCLanguage {
|
||||
* @see https://en.wikipedia.org/wiki/ISO_639-1
|
||||
*/
|
||||
export type SCLanguageName =
|
||||
'afar'
|
||||
| 'afar'
|
||||
| 'abkhazian'
|
||||
| 'avestan'
|
||||
| 'afrikaans'
|
||||
@@ -225,7 +229,7 @@ export type SCLanguageName =
|
||||
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
*/
|
||||
export type SCLanguageCode =
|
||||
'aa'
|
||||
| 'aa'
|
||||
| 'ab'
|
||||
| 'ae'
|
||||
| 'af'
|
||||
@@ -417,7 +421,7 @@ export type SCLanguageCode =
|
||||
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
||||
*/
|
||||
export type SCNationality =
|
||||
'Afghanistan'
|
||||
| 'Afghanistan'
|
||||
| 'Åland Islands'
|
||||
| 'Albania'
|
||||
| 'Algeria'
|
||||
@@ -471,7 +475,7 @@ export type SCNationality =
|
||||
| 'Congo (Democratic Republic of the)'
|
||||
| 'Cook Islands'
|
||||
| 'Costa Rica'
|
||||
| 'Côte d\'Ivoire'
|
||||
| "Côte d'Ivoire"
|
||||
| 'Croatia'
|
||||
| 'Cuba'
|
||||
| 'Curaçao'
|
||||
@@ -534,11 +538,11 @@ export type SCNationality =
|
||||
| 'Kazakhstan'
|
||||
| 'Kenya'
|
||||
| 'Kiribati'
|
||||
| 'Korea (Democratic People\'s Republic of)'
|
||||
| "Korea (Democratic People's Republic of)"
|
||||
| 'Korea (Republic of)'
|
||||
| 'Kuwait'
|
||||
| 'Kyrgyzstan'
|
||||
| 'Lao People\'s Democratic Republic'
|
||||
| "Lao People's Democratic Republic"
|
||||
| 'Latvia'
|
||||
| 'Lebanon'
|
||||
| 'Lesotho'
|
||||
@@ -690,10 +694,11 @@ export interface SCTranslations<T> {
|
||||
* (Source: https://stackoverflow.com/a/51365037)
|
||||
*/
|
||||
type RecursivePartial<T> = {
|
||||
[P in keyof T]-?:
|
||||
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
|
||||
T[P] extends object ? RecursivePartial<T[P]> :
|
||||
T[P];
|
||||
[P in keyof T]-?: T[P] extends Array<infer U>
|
||||
? Array<RecursivePartial<U>>
|
||||
: T[P] extends object
|
||||
? RecursivePartial<T[P]>
|
||||
: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -42,5 +42,5 @@ export type SCRestrictedMap<U extends string | number, T> = {
|
||||
/**
|
||||
* One value for each key
|
||||
*/
|
||||
[key in U]: T
|
||||
[key in U]: T;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,17 +12,15 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* tslint:disable:max-line-length */
|
||||
/**
|
||||
* An ISO8601 date
|
||||
*
|
||||
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
|
||||
* @pattern ^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])(T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])([\.,][0-9]{0,7})?(Z|[+-](?:2[0-3]|[01][0-9])(:?[0-5][0-9])?)?)?$
|
||||
* @see https://gist.github.com/philipashlock/8830168
|
||||
* @date
|
||||
*/
|
||||
export type SCISO8601Date = string;
|
||||
/* tslint:enable */
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
/**
|
||||
* An ISO8601 duration
|
||||
*
|
||||
@@ -30,11 +28,10 @@ export type SCISO8601Date = string;
|
||||
* @see https://gist.github.com/philipashlock/8830168
|
||||
*/
|
||||
export type SCISO8601Duration = string;
|
||||
/* tslint:enable */
|
||||
|
||||
/**
|
||||
* An ISO8601 time
|
||||
*
|
||||
* @pattern \d{2}:\d{2}(:\d{2})?
|
||||
* @pattern ^(2[0-3]|[01][0-9]):?([0-5][0-9]):?([0-5][0-9])$
|
||||
*/
|
||||
export type SCISO8601Time = string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -15,6 +15,7 @@
|
||||
/**
|
||||
* 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}$
|
||||
* @see http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -16,7 +16,12 @@ import {SCTranslations} from './general/i18n';
|
||||
import {SCBulkResponse} from './protocol/routes/bulk-request';
|
||||
import {SCSearchResponse} from './protocol/routes/search';
|
||||
import {SCMultiSearchResponse} from './protocol/routes/search-multi';
|
||||
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing';
|
||||
import {
|
||||
SCThing,
|
||||
SCThingTranslatableProperties,
|
||||
SCThingType,
|
||||
SCThingWithoutReferences,
|
||||
} from './things/abstract/thing';
|
||||
|
||||
/**
|
||||
* Type guard to check if something is a SCThing
|
||||
@@ -32,16 +37,13 @@ export function isThing(something: unknown): something is SCThing {
|
||||
return false;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:completed-docs
|
||||
const type = (something as { type: unknown; }).type;
|
||||
const type = (something as {type: unknown}).type;
|
||||
|
||||
if (typeof type !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Object
|
||||
.values(SCThingType)
|
||||
.indexOf(type) >= 0;
|
||||
return Object.values(SCThingType).includes(type as SCThingType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,9 +51,9 @@ export function isThing(something: unknown): something is SCThing {
|
||||
*
|
||||
* @param thing Thing to check
|
||||
*/
|
||||
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
||||
// tslint:disable-next-line:completed-docs
|
||||
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
|
||||
export function isThingWithTranslations(
|
||||
thing: SCThingWithoutReferences,
|
||||
): thing is SCThingWithoutReferences & {translations: SCTranslations<SCThingTranslatableProperties>} {
|
||||
return typeof thing.translations !== 'undefined';
|
||||
}
|
||||
|
||||
@@ -65,29 +67,31 @@ export function isBulkResponse(something: unknown): something is SCBulkResponse
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!('expiration' in something)
|
||||
|| !('source' in something)
|
||||
|| !('state' in something)
|
||||
|| !('type' in something)
|
||||
|| !('uid' in something)) {
|
||||
if (
|
||||
!('expiration' in something) ||
|
||||
!('source' in something) ||
|
||||
!('state' in something) ||
|
||||
!('type' in something) ||
|
||||
!('uid' in something)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const {expiration, source, state, type, uid} = something as {
|
||||
// tslint:disable:completed-docs
|
||||
expiration: unknown;
|
||||
source: unknown;
|
||||
state: unknown;
|
||||
type: unknown;
|
||||
uid: unknown;
|
||||
// tslint:enable
|
||||
};
|
||||
|
||||
return typeof expiration === 'string'
|
||||
&& typeof source === 'string'
|
||||
&& typeof state === 'string'
|
||||
&& typeof type === 'string'
|
||||
&& typeof uid === 'string';
|
||||
return (
|
||||
typeof expiration === 'string' &&
|
||||
typeof source === 'string' &&
|
||||
typeof state === 'string' &&
|
||||
typeof type === 'string' &&
|
||||
typeof uid === 'string'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,16 +103,18 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
|
||||
if (!(typeof something === 'object') || something === null) {
|
||||
return false;
|
||||
}
|
||||
const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
|
||||
const somethingObject = something as {[key: string]: {[key: string]: string}};
|
||||
|
||||
return Array.isArray(somethingObject.data)
|
||||
&& Array.isArray(somethingObject.facets)
|
||||
&& typeof somethingObject.pagination !== 'undefined'
|
||||
&& typeof somethingObject.pagination.count === 'number'
|
||||
&& typeof somethingObject.pagination.offset === 'number'
|
||||
&& typeof somethingObject.pagination.total === 'number'
|
||||
&& typeof somethingObject.stats !== 'undefined'
|
||||
&& typeof somethingObject.stats.time === 'number';
|
||||
return (
|
||||
Array.isArray(somethingObject.data) &&
|
||||
Array.isArray(somethingObject.facets) &&
|
||||
typeof somethingObject.pagination !== 'undefined' &&
|
||||
typeof somethingObject.pagination.count === 'number' &&
|
||||
typeof somethingObject.pagination.offset === 'number' &&
|
||||
typeof somethingObject.pagination.total === 'number' &&
|
||||
typeof somethingObject.stats !== 'undefined' &&
|
||||
typeof somethingObject.stats.time === 'number'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,10 +123,10 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
|
||||
* @param something Something to check
|
||||
*/
|
||||
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
|
||||
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
|
||||
const initialValue = Object.keys(something as {[key: string]: string}).length > 0 ? true : false;
|
||||
|
||||
return Object.keys(something as { [key: string]: string; })
|
||||
.reduce((previousOnesAreSearchResponses, key) => {
|
||||
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
|
||||
}, initialValue as boolean);
|
||||
// eslint-disable-next-line unicorn/no-array-reduce
|
||||
return Object.keys(something as {[key: string]: string}).reduce((previousOnesAreSearchResponses, key) => {
|
||||
return previousOnesAreSearchResponses && isSearchResponse((something as {[key: string]: string})[key]);
|
||||
}, initialValue as boolean);
|
||||
}
|
||||
|
||||
220
src/meta.ts
220
src/meta.ts
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,12 +13,22 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingType} from './things/abstract/thing';
|
||||
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event';
|
||||
import {
|
||||
SCAcademicEvent,
|
||||
SCAcademicEventMeta,
|
||||
SCAcademicEventWithoutReferences,
|
||||
} from './things/academic-event';
|
||||
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article';
|
||||
import {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment';
|
||||
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
|
||||
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
|
||||
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
|
||||
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/course-of-studies';
|
||||
import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point';
|
||||
import {
|
||||
SCCourseOfStudy,
|
||||
SCCourseOfStudyMeta,
|
||||
SCCourseOfStudyWithoutReferences,
|
||||
} from './things/course-of-study';
|
||||
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
|
||||
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
|
||||
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish';
|
||||
@@ -26,8 +36,18 @@ import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/
|
||||
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
|
||||
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
|
||||
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
|
||||
import {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical';
|
||||
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
|
||||
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
|
||||
import {
|
||||
SCPointOfInterest,
|
||||
SCPointOfInterestMeta,
|
||||
SCPointOfInterestWithoutReferences,
|
||||
} from './things/point-of-interest';
|
||||
import {
|
||||
SCPublicationEvent,
|
||||
SCPublicationEventMeta,
|
||||
SCPublicationEventWithoutReferences,
|
||||
} from './things/publication-event';
|
||||
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
|
||||
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
|
||||
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
|
||||
@@ -38,18 +58,18 @@ import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
|
||||
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
|
||||
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
|
||||
|
||||
/* tslint:disable:variable-name */
|
||||
/**
|
||||
* A map of things, from type to meta data
|
||||
*/
|
||||
export const SCClasses: { [K in SCThingType]: object } = {
|
||||
/* tslint:enable */
|
||||
export const SCClasses: {[K in SCThingType]: object} = {
|
||||
'assessment': SCAssessmentMeta,
|
||||
'academic event': SCAcademicEventMeta,
|
||||
'article': SCArticleMeta,
|
||||
'book': SCBookMeta,
|
||||
'building': SCBuildingMeta,
|
||||
'catalog': SCCatalogMeta,
|
||||
'course of studies': SCCourseOfStudiesMeta,
|
||||
'contact point': SCContactPointMeta,
|
||||
'course of study': SCCourseOfStudyMeta,
|
||||
'date series': SCDateSeriesMeta,
|
||||
'diff': SCDiffMeta,
|
||||
'dish': SCDishMeta,
|
||||
@@ -57,8 +77,10 @@ export const SCClasses: { [K in SCThingType]: object } = {
|
||||
'floor': SCFloorMeta,
|
||||
'message': SCMessageMeta,
|
||||
'organization': SCOrganizationMeta,
|
||||
'periodical': SCPeriodicalMeta,
|
||||
'person': SCPersonMeta,
|
||||
'point of interest': SCPointOfInterestMeta,
|
||||
'publication event': SCPublicationEventMeta,
|
||||
'room': SCRoomMeta,
|
||||
'semester': SCSemesterMeta,
|
||||
'setting': SCSettingMeta,
|
||||
@@ -70,24 +92,26 @@ export const SCClasses: { [K in SCThingType]: object } = {
|
||||
'video': SCVideoMeta,
|
||||
};
|
||||
|
||||
export type SCThingsWithoutDiff =
|
||||
SCAcademicEvent
|
||||
export type SCIndexableThings =
|
||||
| SCAssessment
|
||||
| SCAcademicEvent
|
||||
| SCArticle
|
||||
| SCBook
|
||||
| SCBuilding
|
||||
| SCCatalog
|
||||
| SCCourseOfStudies
|
||||
| SCContactPoint
|
||||
| SCCourseOfStudy
|
||||
| SCDateSeries
|
||||
| SCDish
|
||||
| SCFavorite
|
||||
| SCFloor
|
||||
| SCMessage
|
||||
| SCOrganization
|
||||
| SCPeriodical
|
||||
| SCPerson
|
||||
| SCPointOfInterest
|
||||
| SCPublicationEvent
|
||||
| SCRoom
|
||||
| SCSemester
|
||||
| SCSetting
|
||||
| SCSportCourse
|
||||
| SCStudyModule
|
||||
| SCTicket
|
||||
@@ -98,9 +122,7 @@ export type SCThingsWithoutDiff =
|
||||
/**
|
||||
* An object that exists in the StAppsCore
|
||||
*/
|
||||
export type SCThings =
|
||||
SCThingsWithoutDiff
|
||||
| SCDiff;
|
||||
export type SCThings = SCIndexableThings | SCDiff | SCFavorite | SCSetting;
|
||||
|
||||
/**
|
||||
* A field of a thing
|
||||
@@ -110,59 +132,121 @@ export type SCThingsField = keyof SCThings | string;
|
||||
/**
|
||||
* Thing without references for a thing
|
||||
*/
|
||||
export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
|
||||
THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences :
|
||||
THING extends SCArticle ? SCArticleWithoutReferences :
|
||||
THING extends SCBook ? SCBookWithoutReferences :
|
||||
THING extends SCBuilding ? SCBuildingWithoutReferences :
|
||||
THING extends SCCatalog ? SCCatalogWithoutReferences :
|
||||
THING extends SCCourseOfStudies ? SCCourseOfStudiesWithoutReferences :
|
||||
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
|
||||
THING extends SCDiff ? SCDiffWithoutReferences :
|
||||
THING extends SCDish ? SCDishWithoutReferences :
|
||||
THING extends SCFavorite ? SCFavoriteWithoutReferences :
|
||||
THING extends SCFloor ? SCFloorWithoutReferences :
|
||||
THING extends SCMessage ? SCMessageWithoutReferences :
|
||||
THING extends SCOrganization ? SCOrganizationWithoutReferences :
|
||||
THING extends SCPerson ? SCPersonWithoutReferences :
|
||||
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
|
||||
THING extends SCRoom ? SCRoomWithoutReferences :
|
||||
THING extends SCSemester ? SCSemesterWithoutReferences :
|
||||
THING extends SCSetting ? SCSettingWithoutReferences :
|
||||
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
|
||||
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
|
||||
THING extends SCTicket ? SCTicketWithoutReferences :
|
||||
THING extends SCToDo ? SCToDoWithoutReferences :
|
||||
THING extends SCTour ? SCTourWithoutReferences :
|
||||
THING extends SCVideo ? SCVideoWithoutReferences :
|
||||
never;
|
||||
export type SCAssociatedThingWithoutReferences<THING extends SCThings> = THING extends SCAssessment
|
||||
? SCAssessmentWithoutReferences
|
||||
: THING extends SCAcademicEvent
|
||||
? SCAcademicEventWithoutReferences
|
||||
: THING extends SCArticle
|
||||
? SCArticleWithoutReferences
|
||||
: THING extends SCBook
|
||||
? SCBookWithoutReferences
|
||||
: THING extends SCBuilding
|
||||
? SCBuildingWithoutReferences
|
||||
: THING extends SCCatalog
|
||||
? SCCatalogWithoutReferences
|
||||
: THING extends SCContactPoint
|
||||
? SCContactPointWithoutReferences
|
||||
: THING extends SCCourseOfStudy
|
||||
? SCCourseOfStudyWithoutReferences
|
||||
: THING extends SCDateSeries
|
||||
? SCDateSeriesWithoutReferences
|
||||
: THING extends SCDiff
|
||||
? SCDiffWithoutReferences
|
||||
: THING extends SCDish
|
||||
? SCDishWithoutReferences
|
||||
: THING extends SCFavorite
|
||||
? SCFavoriteWithoutReferences
|
||||
: THING extends SCFloor
|
||||
? SCFloorWithoutReferences
|
||||
: THING extends SCMessage
|
||||
? SCMessageWithoutReferences
|
||||
: THING extends SCOrganization
|
||||
? SCOrganizationWithoutReferences
|
||||
: THING extends SCPeriodical
|
||||
? SCPeriodicalWithoutReferences
|
||||
: THING extends SCPerson
|
||||
? SCPersonWithoutReferences
|
||||
: THING extends SCPointOfInterest
|
||||
? SCPointOfInterestWithoutReferences
|
||||
: THING extends SCPublicationEvent
|
||||
? SCPublicationEventWithoutReferences
|
||||
: THING extends SCRoom
|
||||
? SCRoomWithoutReferences
|
||||
: THING extends SCSemester
|
||||
? SCSemesterWithoutReferences
|
||||
: THING extends SCSetting
|
||||
? SCSettingWithoutReferences
|
||||
: THING extends SCSportCourse
|
||||
? SCSportCourseWithoutReferences
|
||||
: THING extends SCStudyModule
|
||||
? SCStudyModuleWithoutReferences
|
||||
: THING extends SCTicket
|
||||
? SCTicketWithoutReferences
|
||||
: THING extends SCToDo
|
||||
? SCToDoWithoutReferences
|
||||
: THING extends SCTour
|
||||
? SCTourWithoutReferences
|
||||
: THING extends SCVideo
|
||||
? SCVideoWithoutReferences
|
||||
: never;
|
||||
|
||||
/**
|
||||
* Thing for a thing without references
|
||||
*/
|
||||
export type SCAssociatedThing<THING extends SCThings> =
|
||||
THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent :
|
||||
THING extends SCArticleWithoutReferences ? SCArticle :
|
||||
THING extends SCBookWithoutReferences ? SCBook :
|
||||
THING extends SCBuildingWithoutReferences ? SCBuilding :
|
||||
THING extends SCCatalogWithoutReferences ? SCCatalog :
|
||||
THING extends SCCourseOfStudiesWithoutReferences ? SCCourseOfStudies :
|
||||
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
|
||||
THING extends SCDiffWithoutReferences ? SCDiff :
|
||||
THING extends SCDishWithoutReferences ? SCDish :
|
||||
THING extends SCFavoriteWithoutReferences ? SCFavorite :
|
||||
THING extends SCFloorWithoutReferences ? SCFloor :
|
||||
THING extends SCMessageWithoutReferences ? SCMessage :
|
||||
THING extends SCOrganizationWithoutReferences ? SCOrganization :
|
||||
THING extends SCPersonWithoutReferences ? SCPerson :
|
||||
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
|
||||
THING extends SCRoomWithoutReferences ? SCRoom :
|
||||
THING extends SCSemesterWithoutReferences ? SCSemester :
|
||||
THING extends SCSettingWithoutReferences ? SCSetting :
|
||||
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
|
||||
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
|
||||
THING extends SCTicketWithoutReferences ? SCTicket :
|
||||
THING extends SCToDoWithoutReferences ? SCToDo :
|
||||
THING extends SCTourWithoutReferences ? SCTour :
|
||||
THING extends SCVideoWithoutReferences ? SCVideo :
|
||||
never;
|
||||
export type SCAssociatedThing<THING extends SCThings> = THING extends SCAssessmentWithoutReferences
|
||||
? SCAssessment
|
||||
: THING extends SCAcademicEventWithoutReferences
|
||||
? SCAcademicEvent
|
||||
: THING extends SCArticleWithoutReferences
|
||||
? SCArticle
|
||||
: THING extends SCBookWithoutReferences
|
||||
? SCBook
|
||||
: THING extends SCBuildingWithoutReferences
|
||||
? SCBuilding
|
||||
: THING extends SCCatalogWithoutReferences
|
||||
? SCCatalog
|
||||
: THING extends SCContactPointWithoutReferences
|
||||
? SCContactPoint
|
||||
: THING extends SCCourseOfStudyWithoutReferences
|
||||
? SCCourseOfStudy
|
||||
: THING extends SCDateSeriesWithoutReferences
|
||||
? SCDateSeries
|
||||
: THING extends SCDiffWithoutReferences
|
||||
? SCDiff
|
||||
: THING extends SCDishWithoutReferences
|
||||
? SCDish
|
||||
: THING extends SCFavoriteWithoutReferences
|
||||
? SCFavorite
|
||||
: THING extends SCFloorWithoutReferences
|
||||
? SCFloor
|
||||
: THING extends SCMessageWithoutReferences
|
||||
? SCMessage
|
||||
: THING extends SCOrganizationWithoutReferences
|
||||
? SCOrganization
|
||||
: THING extends SCPeriodicalWithoutReferences
|
||||
? SCPeriodical
|
||||
: THING extends SCPersonWithoutReferences
|
||||
? SCPerson
|
||||
: THING extends SCPointOfInterestWithoutReferences
|
||||
? SCPointOfInterest
|
||||
: THING extends SCPublicationEventWithoutReferences
|
||||
? SCPublicationEvent
|
||||
: THING extends SCRoomWithoutReferences
|
||||
? SCRoom
|
||||
: THING extends SCSemesterWithoutReferences
|
||||
? SCSemester
|
||||
: THING extends SCSettingWithoutReferences
|
||||
? SCSetting
|
||||
: THING extends SCSportCourseWithoutReferences
|
||||
? SCSportCourse
|
||||
: THING extends SCStudyModuleWithoutReferences
|
||||
? SCStudyModule
|
||||
: THING extends SCTicketWithoutReferences
|
||||
? SCTicket
|
||||
: THING extends SCToDoWithoutReferences
|
||||
? SCToDo
|
||||
: THING extends SCTourWithoutReferences
|
||||
? SCTour
|
||||
: THING extends SCVideoWithoutReferences
|
||||
? SCVideo
|
||||
: never;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -50,7 +50,8 @@ export abstract class SCError implements SCErrorResponse {
|
||||
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
|
||||
// generate stacktrace if needed
|
||||
if (stack) {
|
||||
this.stack = (new Error()).stack;
|
||||
// eslint-disable-next-line unicorn/error-message
|
||||
this.stack = new Error().stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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 {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned, when an internal server error occurred
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCInternalServerErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -27,15 +29,15 @@ export class SCInternalServerErrorResponse extends SCError {
|
||||
/**
|
||||
* Create a SCInternalServerErrorResponse
|
||||
*
|
||||
* @param err Internal server error
|
||||
* @param error Internal server error
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
* and the internal server error should be displayed to the client
|
||||
*/
|
||||
constructor(err?: Error, stack = false) {
|
||||
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
|
||||
constructor(error?: Error, stack = false) {
|
||||
super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack);
|
||||
|
||||
if (stack) {
|
||||
this.additionalData = err;
|
||||
this.additionalData = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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 {StatusCodes} 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
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -25,6 +27,11 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
|
||||
super(
|
||||
'MethodNotAllowedError',
|
||||
'HTTP method is not allowed on this route',
|
||||
StatusCodes.METHOD_NOT_ALLOWED,
|
||||
stack,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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_FOUND} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned when the requested route or resource was not found
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCNotFoundErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -25,6 +27,6 @@ export class SCNotFoundErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
|
||||
super('NotFoundError', 'Resource not found', StatusCodes.NOT_FOUND, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,12 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {NOT_ACCEPTABLE} from 'http-status-codes';
|
||||
import {StatusCodes} 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.
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCParametersNotAcceptable extends SCError {
|
||||
/**
|
||||
@@ -27,6 +29,6 @@ export class SCParametersNotAcceptable extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
|
||||
super('ParametersNotAcceptable', message, StatusCodes.NOT_ACCEPTABLE, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {CONFLICT} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
import {SCPluginMetaData} from '../routes/plugin-register';
|
||||
|
||||
@@ -20,6 +20,8 @@ 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.
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -36,7 +38,7 @@ export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
|
||||
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
|
||||
super('SCPluginAlreadyRegisteredError', message, StatusCodes.CONFLICT, stack);
|
||||
if (stack) {
|
||||
this.additionalData = plugin;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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 {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned whenever there is an unexpected error while creating a plugin
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -26,6 +28,6 @@ export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
|
||||
super('PluginRegisteringFailedError', message, StatusCodes.INTERNAL_SERVER_ERROR, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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 {REQUEST_TOO_LONG} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned, when the request body is too large.
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -25,6 +27,6 @@ export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
|
||||
super('RequestBodyTooLargeError', 'The request body is too large.', StatusCodes.REQUEST_TOO_LONG, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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_REQUEST} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned whenever there is a syntax error
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCSyntaxErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -26,6 +28,6 @@ export class SCSyntaxErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(message: string, stack?: boolean) {
|
||||
super('SyntaxError', message, BAD_REQUEST, stack);
|
||||
super('SyntaxError', message, StatusCodes.BAD_REQUEST, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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 {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned, when to many request are submitted at once
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -28,7 +30,7 @@ export class SCTooManyRequestsErrorResponse extends SCError {
|
||||
super(
|
||||
'TooManyRequestsError',
|
||||
'Too many requests. You can not submit more than 5 queries an once',
|
||||
TOO_MANY_REQUESTS,
|
||||
StatusCodes.TOO_MANY_REQUESTS,
|
||||
stack,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,11 +12,13 @@
|
||||
* 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 {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned when the content type of the request is not supported
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -25,6 +27,6 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(stack?: boolean) {
|
||||
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
|
||||
super('UnsupportedMediaTypeError', 'Unsupported media type', StatusCodes.UNSUPPORTED_MEDIA_TYPE, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,12 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {BAD_REQUEST} from 'http-status-codes';
|
||||
import {ValidationError} from 'jsonschema';
|
||||
import {ValidationError} from '@openstapps/core-tools/lib/types/validator';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error';
|
||||
|
||||
/**
|
||||
* An error that is returned when the validation of a request fails
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export class SCValidationErrorResponse extends SCError {
|
||||
/**
|
||||
@@ -32,7 +34,7 @@ export class SCValidationErrorResponse extends SCError {
|
||||
* @param stack Set to true if a stack trace should be created
|
||||
*/
|
||||
constructor(errors: ValidationError[], stack?: boolean) {
|
||||
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
|
||||
super('ValidationError', 'Validation of request failed', StatusCodes.BAD_REQUEST, stack);
|
||||
this.additionalData = errors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,15 +14,19 @@
|
||||
*/
|
||||
import {SCMap} from '../general/map';
|
||||
import {SCErrorResponse} from './error';
|
||||
import {SCIndexRequest, SCIndexResponse} from './routes';
|
||||
import {SCBookAvailabilityRequest, SCBookAvailabilityResponse} from './routes/book-availability';
|
||||
import {SCBulkAddRequest, SCBulkAddResponse} from './routes/bulk-add';
|
||||
import {SCBulkDoneRequest, SCBulkDoneResponse} from './routes/bulk-done';
|
||||
import {SCBulkRequest, SCBulkResponse} from './routes/bulk-request';
|
||||
import {SCFeedbackRequest, SCFeedbackResponse} from './routes/feedback';
|
||||
import {SCSearchRequest, SCSearchResponse} from './routes/search';
|
||||
import {SCMultiSearchRequest, SCMultiSearchResponse} from './routes/search-multi';
|
||||
import {SCThingUpdateRequest, SCThingUpdateResponse} from './routes/thing-update';
|
||||
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
|
||||
@@ -36,8 +40,8 @@ export enum SCRouteHttpVerbs {
|
||||
/**
|
||||
* The constructor of an error response
|
||||
*/
|
||||
// tslint:disable-next-line:no-any
|
||||
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type SCErrorResponseConstructor = new (...arguments_: any[]) => SCErrorResponse;
|
||||
|
||||
/**
|
||||
* A description of a route
|
||||
@@ -74,9 +78,9 @@ export interface SCRoute {
|
||||
statusCodeSuccess: number;
|
||||
|
||||
/**
|
||||
* URL fragment of the route
|
||||
* URL path of the route
|
||||
*/
|
||||
urlFragment: string;
|
||||
urlPath: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,37 +91,43 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
* @see SCRoute.errorNames
|
||||
*/
|
||||
errorNames: SCErrorResponseConstructor[] = [];
|
||||
|
||||
/**
|
||||
* @see SCRoute.method
|
||||
*/
|
||||
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
|
||||
|
||||
/**
|
||||
* @see SCRoute.obligatoryParameters
|
||||
*/
|
||||
obligatoryParameters?: SCMap<string>;
|
||||
|
||||
/**
|
||||
* @see SCRoute.requestBodyName
|
||||
*/
|
||||
requestBodyName = 'any';
|
||||
|
||||
/**
|
||||
* @see SCRoute.responseBodyName
|
||||
*/
|
||||
responseBodyName = 'any';
|
||||
|
||||
/**
|
||||
* @see SCRoute.statusCodeSuccess
|
||||
*/
|
||||
statusCodeSuccess = 200;
|
||||
/**
|
||||
* @see SCRoute.urlFragment
|
||||
*/
|
||||
urlFragment = '/';
|
||||
|
||||
/**
|
||||
* Get "compiled" URL fragment
|
||||
*
|
||||
* @param parameters Parameters to compile URL fragment with
|
||||
* @see SCRoute.urlPath
|
||||
*/
|
||||
public getUrlFragment(parameters: SCMap<string> = {}): string {
|
||||
urlPath = '/';
|
||||
|
||||
/**
|
||||
* Get "compiled" URL path
|
||||
*
|
||||
* @param parameters Parameters to compile URL path with
|
||||
*/
|
||||
public getUrlPath(parameters: SCMap<string> = {}): string {
|
||||
let obligatoryParameters: string[] = [];
|
||||
|
||||
if (typeof this.obligatoryParameters === 'object') {
|
||||
@@ -128,17 +138,17 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
throw new Error('Extraneous parameters provided.');
|
||||
}
|
||||
|
||||
return this.urlFragment
|
||||
return this.urlPath
|
||||
.split('/')
|
||||
.map((part) => {
|
||||
.map(part => {
|
||||
if (part.indexOf(':') !== 0) {
|
||||
return part;
|
||||
}
|
||||
|
||||
const parameter = part.substr(1);
|
||||
const parameter = part.slice(1);
|
||||
|
||||
if (typeof parameters[parameter] === 'undefined') {
|
||||
throw new Error(`Parameter '${parameter}' not provided.`);
|
||||
throw new TypeError(`Parameter '${parameter}' not provided.`);
|
||||
}
|
||||
|
||||
return parameters[parameter];
|
||||
@@ -151,7 +161,7 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
* Possible requests
|
||||
*/
|
||||
export type SCRequests =
|
||||
SCBookAvailabilityRequest
|
||||
| SCBookAvailabilityRequest
|
||||
| SCBulkRequest
|
||||
| SCBulkAddRequest
|
||||
| SCBulkDoneRequest
|
||||
@@ -165,7 +175,7 @@ export type SCRequests =
|
||||
* Possible responses
|
||||
*/
|
||||
export type SCResponses =
|
||||
SCBookAvailabilityResponse
|
||||
| SCBookAvailabilityResponse
|
||||
| SCBulkResponse
|
||||
| SCBulkAddResponse
|
||||
| SCBulkDoneResponse
|
||||
@@ -178,29 +188,91 @@ export type SCResponses =
|
||||
/**
|
||||
* Associated response for a request
|
||||
*/
|
||||
export type SCAssociatedResponse<REQUEST> =
|
||||
REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse :
|
||||
REQUEST extends SCBulkRequest ? SCBulkResponse :
|
||||
REQUEST extends SCBulkAddRequest ? SCBulkAddResponse :
|
||||
REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse :
|
||||
REQUEST extends SCFeedbackRequest ? SCFeedbackResponse :
|
||||
REQUEST extends SCIndexRequest ? SCIndexResponse :
|
||||
REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse :
|
||||
REQUEST extends SCSearchRequest ? SCSearchResponse :
|
||||
REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse :
|
||||
never;
|
||||
export type SCAssociatedResponse<REQUEST> = REQUEST extends SCBookAvailabilityRequest
|
||||
? SCBookAvailabilityResponse
|
||||
: REQUEST extends SCBulkRequest
|
||||
? SCBulkResponse
|
||||
: REQUEST extends SCBulkAddRequest
|
||||
? SCBulkAddResponse
|
||||
: REQUEST extends SCBulkDoneRequest
|
||||
? SCBulkDoneResponse
|
||||
: REQUEST extends SCFeedbackRequest
|
||||
? SCFeedbackResponse
|
||||
: REQUEST extends SCIndexRequest
|
||||
? SCIndexResponse
|
||||
: REQUEST extends SCMultiSearchRequest
|
||||
? SCMultiSearchResponse
|
||||
: REQUEST extends SCSearchRequest
|
||||
? SCSearchResponse
|
||||
: REQUEST extends SCThingUpdateRequest
|
||||
? SCThingUpdateResponse
|
||||
: never;
|
||||
|
||||
/**
|
||||
* Associated request for a response
|
||||
*/
|
||||
export type SCAssociatedRequest<RESPONSE> =
|
||||
RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest :
|
||||
RESPONSE extends SCBulkResponse ? SCBulkRequest :
|
||||
RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest :
|
||||
RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest :
|
||||
RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest :
|
||||
RESPONSE extends SCIndexResponse ? SCIndexRequest :
|
||||
RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest :
|
||||
RESPONSE extends SCSearchResponse ? SCSearchRequest :
|
||||
RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest :
|
||||
never;
|
||||
export type SCAssociatedRequest<RESPONSE> = RESPONSE extends SCBookAvailabilityResponse
|
||||
? SCBookAvailabilityRequest
|
||||
: RESPONSE extends SCBulkResponse
|
||||
? SCBulkRequest
|
||||
: RESPONSE extends SCBulkAddResponse
|
||||
? SCBulkAddRequest
|
||||
: RESPONSE extends SCBulkDoneResponse
|
||||
? SCBulkDoneRequest
|
||||
: RESPONSE extends SCFeedbackResponse
|
||||
? SCFeedbackRequest
|
||||
: RESPONSE extends SCIndexResponse
|
||||
? SCIndexRequest
|
||||
: RESPONSE extends SCMultiSearchResponse
|
||||
? SCMultiSearchRequest
|
||||
: RESPONSE extends SCSearchResponse
|
||||
? SCSearchRequest
|
||||
: RESPONSE extends SCThingUpdateResponse
|
||||
? SCThingUpdateRequest
|
||||
: never;
|
||||
|
||||
/**
|
||||
* Associated request for a route
|
||||
*/
|
||||
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> = ROUTE extends SCBookAvailabilityRoute
|
||||
? SCBookAvailabilityRequest
|
||||
: ROUTE extends SCBulkRoute
|
||||
? SCBulkRequest
|
||||
: ROUTE extends SCBulkAddRoute
|
||||
? SCBulkAddRequest
|
||||
: ROUTE extends SCBulkDoneRoute
|
||||
? SCBulkDoneRequest
|
||||
: ROUTE extends SCFeedbackRoute
|
||||
? SCFeedbackRequest
|
||||
: ROUTE extends SCIndexRoute
|
||||
? SCIndexRequest
|
||||
: ROUTE extends SCMultiSearchRoute
|
||||
? SCMultiSearchRequest
|
||||
: ROUTE extends SCSearchRoute
|
||||
? SCSearchRequest
|
||||
: ROUTE extends SCThingUpdateRoute
|
||||
? SCThingUpdateRequest
|
||||
: never;
|
||||
|
||||
/**
|
||||
* 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) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,9 +12,12 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCUuid} from '../../general/uuid';
|
||||
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOfferedOffer,
|
||||
} from '../../things/abstract/thing-that-can-be-offered';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||
@@ -88,7 +91,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/bookAvailability';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/bookAvailability';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {CREATED} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCThings} from '../../meta';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
@@ -35,8 +35,7 @@ export type SCBulkAddRequest = SCThings;
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkAddResponse {
|
||||
}
|
||||
export interface SCBulkAddResponse {}
|
||||
|
||||
/**
|
||||
* Route for indexing SC things in a bulk
|
||||
@@ -59,7 +58,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
|
||||
};
|
||||
this.requestBodyName = 'SCBulkAddRequest';
|
||||
this.responseBodyName = 'SCBulkAddResponse';
|
||||
this.statusCodeSuccess = CREATED;
|
||||
this.urlFragment = '/bulk/:UID';
|
||||
this.statusCodeSuccess = StatusCodes.CREATED;
|
||||
this.urlPath = '/bulk/:UID';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {NO_CONTENT} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||
@@ -27,16 +27,14 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkDoneRequest {
|
||||
}
|
||||
export interface SCBulkDoneRequest {}
|
||||
|
||||
/**
|
||||
* Response to a request to change the state of a bulk to done
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkDoneResponse {
|
||||
}
|
||||
export interface SCBulkDoneResponse {}
|
||||
|
||||
/**
|
||||
* Route for closing bulks
|
||||
@@ -59,7 +57,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
|
||||
};
|
||||
this.requestBodyName = 'SCBulkDoneRequest';
|
||||
this.responseBodyName = 'SCBulkDoneResponse';
|
||||
this.statusCodeSuccess = NO_CONTENT;
|
||||
this.urlFragment = '/bulk/:UID/done';
|
||||
this.statusCodeSuccess = StatusCodes.NO_CONTENT;
|
||||
this.urlPath = '/bulk/:UID/done';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCUuid} from '../../general/uuid';
|
||||
import {SCThingType} from '../../things/abstract/thing';
|
||||
@@ -31,8 +31,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCBulkRequest extends SCBulkParameters {
|
||||
}
|
||||
export type SCBulkRequest = SCBulkParameters;
|
||||
|
||||
/**
|
||||
* Parameters for a bulk
|
||||
@@ -98,7 +97,7 @@ export class SCBulkRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCBulkRequest';
|
||||
this.responseBodyName = 'SCBulkResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/bulk';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/bulk';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {NO_CONTENT} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCMessage} from '../../things/message';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
@@ -39,8 +39,7 @@ export interface SCFeedbackRequest extends SCMessage {
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCFeedbackResponse {
|
||||
}
|
||||
export interface SCFeedbackResponse {}
|
||||
|
||||
/**
|
||||
* Route for feedback submission
|
||||
@@ -59,8 +58,8 @@ export class SCFeedbackRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCFeedbackRequest';
|
||||
this.responseBodyName = 'SCFeedbackResponse';
|
||||
this.statusCodeSuccess = NO_CONTENT;
|
||||
this.urlFragment = '/feedback';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/feedback';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,8 +12,9 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCAppConfiguration} from '../../config/app';
|
||||
import {SCAuthorizationProvider, SCAuthorizationProviderType} from '../../config/authorization';
|
||||
import {SCBackendConfiguration} from '../../config/backend';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
@@ -28,8 +29,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCIndexRequest {
|
||||
}
|
||||
export interface SCIndexRequest {}
|
||||
|
||||
/**
|
||||
* A response to an index request
|
||||
@@ -42,6 +42,11 @@ export interface SCIndexResponse {
|
||||
*/
|
||||
app: SCAppConfiguration;
|
||||
|
||||
/**
|
||||
* @see SCAuthorizationProvider
|
||||
*/
|
||||
auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider};
|
||||
|
||||
/**
|
||||
* @see SCBackendConfiguration
|
||||
*/
|
||||
@@ -65,7 +70,7 @@ export class SCIndexRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCIndexRequest';
|
||||
this.responseBodyName = 'SCIndexResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,8 +12,8 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {Schema} from 'jsonschema';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {JSONSchema7} from 'json-schema';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||
@@ -78,12 +78,12 @@ export interface SCPluginMetaData {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
responseSchema: Schema;
|
||||
responseSchema: JSONSchema7;
|
||||
|
||||
/**
|
||||
* The desired route, for example /feedback.
|
||||
@@ -122,7 +122,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/plugin/register';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/plugin/register';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCMap} from '../../general/map';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
@@ -63,7 +63,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCMultiSearchRequest';
|
||||
this.responseBodyName = 'SCMultiSearchResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/search/multi';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/search/multi';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||
@@ -28,16 +28,14 @@ import {SCSearchResult} from '../search/result';
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSearchRequest extends SCSearchQuery {
|
||||
}
|
||||
export type SCSearchRequest = SCSearchQuery;
|
||||
|
||||
/**
|
||||
* A search response
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCSearchResponse extends SCSearchResult {
|
||||
}
|
||||
export type SCSearchResponse = SCSearchResult;
|
||||
|
||||
/**
|
||||
* Route for searching things
|
||||
@@ -56,7 +54,7 @@ export class SCSearchRoute extends SCAbstractRoute {
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCSearchRequest';
|
||||
this.responseBodyName = 'SCSearchResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/search';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/search';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OK} from 'http-status-codes';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCThings} from '../../meta';
|
||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||
@@ -35,8 +35,7 @@ export type SCThingUpdateRequest = SCThings;
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCThingUpdateResponse {
|
||||
}
|
||||
export interface SCThingUpdateResponse {}
|
||||
|
||||
/**
|
||||
* Route for updating existing things
|
||||
@@ -55,12 +54,12 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
||||
];
|
||||
this.method = SCRouteHttpVerbs.PUT;
|
||||
this.obligatoryParameters = {
|
||||
TYPE: 'SCThingTypes',
|
||||
TYPE: 'SCThingType',
|
||||
UID: 'SCUuid',
|
||||
};
|
||||
this.requestBodyName = 'SCThingUpdateRequest';
|
||||
this.responseBodyName = 'SCThingUpdateResponse';
|
||||
this.statusCodeSuccess = OK;
|
||||
this.urlFragment = '/:TYPE/:UID';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/:TYPE/:UID';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsField} from '../../meta';
|
||||
import {SCThingType} from '../../things/abstract/thing';
|
||||
|
||||
/**
|
||||
* A search facet
|
||||
@@ -27,6 +28,11 @@ export interface SCFacet {
|
||||
* Field of the aggregation
|
||||
*/
|
||||
field: SCThingsField;
|
||||
|
||||
/**
|
||||
* Type of the aggregation
|
||||
*/
|
||||
onlyOnType?: SCThingType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,16 +19,21 @@ import {SCMap} from '../../general/map';
|
||||
import {SCSearchAvailabilityFilter} from './filters/availability';
|
||||
import {SCSearchBooleanFilter} from './filters/boolean';
|
||||
import {SCSearchDistanceFilter} from './filters/distance';
|
||||
import {SCGeoFilter} from './filters/geo';
|
||||
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
|
||||
import {SCSearchValueFilter} from './filters/value';
|
||||
|
||||
/**
|
||||
* Filter instruction types
|
||||
*/
|
||||
export type SCSearchFilterType =
|
||||
'availability'
|
||||
| 'availability'
|
||||
| 'boolean'
|
||||
| 'distance'
|
||||
| 'value';
|
||||
| 'value'
|
||||
| 'date range'
|
||||
| 'numeric range'
|
||||
| 'geo';
|
||||
|
||||
/**
|
||||
* Structure of a filter instruction
|
||||
@@ -54,7 +59,10 @@ export type SCSearchAbstractFilterArguments = SCMap<unknown>;
|
||||
* Available filter instructions
|
||||
*/
|
||||
export type SCSearchFilter =
|
||||
SCSearchAvailabilityFilter
|
||||
| SCSearchAvailabilityFilter
|
||||
| SCSearchBooleanFilter
|
||||
| SCSearchDistanceFilter
|
||||
| SCSearchValueFilter;
|
||||
| SCSearchValueFilter
|
||||
| SCSearchNumericRangeFilter
|
||||
| SCSearchDateRangeFilter
|
||||
| SCGeoFilter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2021 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.
|
||||
@@ -33,17 +33,17 @@ export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAva
|
||||
*/
|
||||
export interface SCAvailabilityFilterArguments extends SCSearchAbstractFilterArguments {
|
||||
/**
|
||||
* Field which marks the start of the availability
|
||||
* Field which marks availability range
|
||||
*/
|
||||
fromField: SCThingsField;
|
||||
field: SCThingsField;
|
||||
|
||||
/**
|
||||
* Time to check. Defaults to 'now'
|
||||
* If set, the provided time will apply to the full hour, day, week, etc.
|
||||
*/
|
||||
time?: SCISO8601Date | 'now';
|
||||
scope?: 's' | 'm' | 'H' | 'd' | 'w' | 'M' | 'y';
|
||||
|
||||
/**
|
||||
* Field which marks the end of the availability
|
||||
* Time to check. Defaults current time if not set
|
||||
*/
|
||||
toField: SCThingsField;
|
||||
time?: SCISO8601Date;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,6 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// tslint:disable-next-line:no-implicit-dependencies
|
||||
import {Position} from 'geojson';
|
||||
import {SCThingsField} from '../../../meta';
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
|
||||
@@ -22,7 +21,7 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
72
src/protocol/search/filters/geo.ts
Normal file
72
src/protocol/search/filters/geo.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Polygon, Position} from 'geojson';
|
||||
import {SCThingsField} from '../../../meta';
|
||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
|
||||
|
||||
/**
|
||||
* A geo filter
|
||||
*
|
||||
* Filter for documents that are in relation to some geo data
|
||||
*/
|
||||
export interface SCGeoFilter extends SCSearchAbstractFilter<SCGeoFilterArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractFilter.type
|
||||
*/
|
||||
type: 'geo';
|
||||
}
|
||||
|
||||
/**
|
||||
* A rectangular geo shape, representing the top-left and bottom-right corners
|
||||
*
|
||||
* This is an extension of the Geojson type
|
||||
* http://geojson.org/geojson-spec.html
|
||||
*/
|
||||
export interface Envelope {
|
||||
/**
|
||||
* The top-left and bottom-right corners of the bounding box
|
||||
*/
|
||||
coordinates: [Position, Position];
|
||||
|
||||
/**
|
||||
* The type of the geometry
|
||||
*/
|
||||
type: 'envelope';
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for filter instruction by geo data
|
||||
*/
|
||||
export interface SCGeoFilterArguments extends SCSearchAbstractFilterArguments {
|
||||
/**
|
||||
* Field on which to filter
|
||||
*/
|
||||
field: SCThingsField;
|
||||
|
||||
/**
|
||||
* Geo data to check up on
|
||||
*/
|
||||
shape: Polygon | Envelope;
|
||||
|
||||
/**
|
||||
* Spatial relation between the provided shape and the shape of the field.
|
||||
*
|
||||
* intersects - both shapes intersect (default)
|
||||
* disjoint - both shapes don't intersect
|
||||
* within - the search shape contains the field shape
|
||||
* contains - the search shape is contained in the field shape
|
||||
*/
|
||||
spatialRelation?: 'intersects' | 'disjoint' | 'within' | 'contains';
|
||||
}
|
||||
122
src/protocol/search/filters/range.ts
Normal file
122
src/protocol/search/filters/range.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Relation when searching on other range fields
|
||||
*
|
||||
* Intersects (Default): Both search and field range intersect
|
||||
* Within: Search range is within the field range
|
||||
* Contains: Search range contains the field range
|
||||
*/
|
||||
relation?: 'intersects' | 'within' | 'contains';
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
@@ -32,7 +32,7 @@ export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments
|
||||
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[];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -16,6 +16,7 @@ import {SCMap} from '../../general/map';
|
||||
import {SCThingsField} from '../../meta';
|
||||
import {SCDistanceSort} from './sorts/distance';
|
||||
import {SCDucetSort} from './sorts/ducet';
|
||||
import {SCGenericSort} from './sorts/generic';
|
||||
import {SCPriceSort} from './sorts/price';
|
||||
|
||||
/**
|
||||
@@ -51,9 +52,9 @@ export interface SCSearchAbstractSortArguments extends SCMap<unknown> {
|
||||
/**
|
||||
* Type of a sort instruction
|
||||
*/
|
||||
export type SCSearchSortType = 'distance' | 'price' | 'ducet';
|
||||
export type SCSearchSortType = 'distance' | 'price' | 'ducet' | 'generic';
|
||||
|
||||
/**
|
||||
* A sort instruction
|
||||
*/
|
||||
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort;
|
||||
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort | SCGenericSort;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,6 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// tslint:disable-next-line:no-implicit-dependencies
|
||||
import {Position} from 'geojson';
|
||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
|
||||
|
||||
|
||||
25
src/protocol/search/sorts/generic.ts
Normal file
25
src/protocol/search/sorts/generic.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
|
||||
|
||||
/**
|
||||
* Sort instruction for generic sort such as date
|
||||
*/
|
||||
export interface SCGenericSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
||||
/**
|
||||
* @see SCSearchAbstractSort.type
|
||||
*/
|
||||
type: 'generic';
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -18,55 +18,53 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
/**
|
||||
* An academic degree without references
|
||||
*/
|
||||
export interface SCAcademicDegreeWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* The achievable academic degree
|
||||
*
|
||||
* @filterable
|
||||
* @sortable ducet
|
||||
*/
|
||||
academicDegree: SCGermanAcademicDegree;
|
||||
academicDegree: string;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* (eg. Master of Science)
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
academicDegreewithField: string;
|
||||
academicDegreewithField?: string;
|
||||
|
||||
/**
|
||||
* The achievable academic degree with academic field specification
|
||||
* shorted (eg. M.Sc.).
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
academicDegreewithFieldShort: string;
|
||||
academicDegreewithFieldShort?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An academic degree
|
||||
*/
|
||||
export interface SCAcademicDegree
|
||||
extends SCAcademicDegreeWithoutReferences, SCThing {
|
||||
export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic degrees
|
||||
*/
|
||||
export class SCAcademicDegreeMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
|
||||
export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicDegree> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
academicDegree: 'Hochschulgrad',
|
||||
academicDegreewithField: 'Abschlussbezeichnungen',
|
||||
academicDegreewithFieldShort: 'Abschlussbezeichnungen (kurz)',
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
academicDegree: 'Abschlussgrad',
|
||||
academicDegreewithField: 'Abschlussbezeichnung',
|
||||
academicDegreewithFieldShort: 'Abschlussbezeichnung (kurz)',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
academicDegree: 'academic degree',
|
||||
academicDegreewithField: 'acedemic degree and discipline',
|
||||
academicDegreewithFieldShort: 'acedemic degree and discipline (short)',
|
||||
@@ -78,33 +76,10 @@ export class SCAcademicDegreeMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
academicDegree: {
|
||||
'bachelor': 'Bachelor',
|
||||
'diploma': 'Diplom',
|
||||
'doctor': 'Doktor',
|
||||
'licentiate': 'Lizenziat',
|
||||
'magister': 'Magister',
|
||||
'master': 'Master',
|
||||
'masterstudent': 'Meisterschüler',
|
||||
'state examination': 'Staatsexamen',
|
||||
},
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Types of (german) academic degrees
|
||||
*/
|
||||
export type SCGermanAcademicDegree =
|
||||
'bachelor'
|
||||
| 'diploma'
|
||||
| 'doctor'
|
||||
| 'licentiate'
|
||||
| 'magister'
|
||||
| 'master'
|
||||
| 'master pupil'
|
||||
| 'state examination' ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,33 +19,41 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
/**
|
||||
* An academic term without references
|
||||
*/
|
||||
export interface SCAcademicTermWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCAcademicTermWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Short name of the academic term, using the given pattern
|
||||
*
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
/**
|
||||
* End date of the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
endDate: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* End date of lectures in the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
eventsEndDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Start date of lectures in the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
eventsStartDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Start date of the academic term
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
startDate: SCISO8601Date;
|
||||
}
|
||||
@@ -53,22 +61,20 @@ export interface SCAcademicTermWithoutReferences
|
||||
/**
|
||||
* An academic term
|
||||
*/
|
||||
export interface SCAcademicTerm
|
||||
extends SCAcademicTermWithoutReferences, SCThing {
|
||||
export interface SCAcademicTerm extends SCAcademicTermWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic terms
|
||||
*/
|
||||
export class SCAcademicTermWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
acronym: 'Akronym',
|
||||
endDate: 'Enddatum',
|
||||
eventsEndDate: 'Enddatum der Veranstaltungen',
|
||||
@@ -76,7 +82,7 @@ export class SCAcademicTermWithoutReferencesMeta
|
||||
startDate: 'Startdatum',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
acronym: 'acronym',
|
||||
endDate: 'end date',
|
||||
eventsEndDate: 'end date of events',
|
||||
@@ -90,10 +96,10 @@ export class SCAcademicTermWithoutReferencesMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,42 +12,64 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCOrganizationWithoutReferences} from '../organization';
|
||||
import {SCPersonWithoutReferences} from '../person';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './thing-that-can-be-offered';
|
||||
import {SCPublicationEventWithoutReferences} from '../publication-event';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* A creative work without references
|
||||
*/
|
||||
export interface SCCreativeWorkWithoutReferences
|
||||
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||
export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Languages this creative work is available in
|
||||
*/
|
||||
availableLanguages?: SCLanguageCode[];
|
||||
|
||||
/**
|
||||
* Date the creative work was published
|
||||
*/
|
||||
datePublished?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* List of languages this creative work is written/recorded/... in
|
||||
* Edition of a creative work (e.g. the book edition or edition of an article)
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
inLanguages?: SCLanguage[];
|
||||
edition?: string;
|
||||
|
||||
/**
|
||||
* Date (in text form) the creative work was published for the first time
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
firstPublished?: string;
|
||||
|
||||
/**
|
||||
* Languages this creative work is written/recorded/... in
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
inLanguage?: SCLanguageCode;
|
||||
|
||||
/**
|
||||
* Keywords of the creative work
|
||||
*
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
* Date (in text form) the creative work was most recently
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
lastPublished?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of the creative work
|
||||
*/
|
||||
@@ -57,18 +79,32 @@ export interface SCCreativeWorkWithoutReferences
|
||||
/**
|
||||
* A creative work
|
||||
*/
|
||||
export interface SCCreativeWork
|
||||
extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThing {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
authors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* A creative work to which the creative work belongs
|
||||
*/
|
||||
isPartOf?: SCCreativeWorkWithoutReferences;
|
||||
|
||||
/**
|
||||
* List of events at which the creative work was published
|
||||
*/
|
||||
publications?: SCPublicationEventWithoutReferences[];
|
||||
|
||||
/**
|
||||
* List of publishers of the creative work
|
||||
*/
|
||||
publishers?: Array<SCPersonWithoutReferences | SCOrganizationWithoutReferences>;
|
||||
|
||||
/**
|
||||
* A text representing on organization on whose behalf the creator was working
|
||||
*/
|
||||
sourceOrganization?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of the creative work
|
||||
*/
|
||||
@@ -78,8 +114,7 @@ export interface SCCreativeWork
|
||||
/**
|
||||
* Translatable properties of creative works
|
||||
*/
|
||||
export interface SCCreativeWorkTranslatableProperties
|
||||
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
export interface SCCreativeWorkTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the keywords of the creative work
|
||||
*
|
||||
@@ -91,29 +126,42 @@ export interface SCCreativeWorkTranslatableProperties
|
||||
/**
|
||||
* Meta information about creative works
|
||||
*/
|
||||
export class SCCreativeWorkMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
|
||||
export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations<SCCreativeWork> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
|
||||
authors: 'Authoren',
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
name: 'Titel',
|
||||
authors: 'beteiligte Personen',
|
||||
availableLanguages: 'verfügbare Übersetzungen',
|
||||
datePublished: 'Veröffentlichungsdatum',
|
||||
inLanguages: 'verfügbare Übersetzungen',
|
||||
edition: 'Ausgabe',
|
||||
firstPublished: 'erste Veröffentlichung',
|
||||
inLanguage: 'Inhaltssprache',
|
||||
isPartOf: 'erschienen in',
|
||||
keywords: 'Schlagwörter',
|
||||
lastPublished: 'aktuellste Veröffentlichung',
|
||||
publishers: 'Verleger',
|
||||
publications: 'Veröffentlichungen',
|
||||
sourceOrganization: 'Körperschaft',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
|
||||
authors: 'authors',
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
name: 'title',
|
||||
authors: 'involved persons',
|
||||
availableLanguages: 'available languages',
|
||||
datePublished: 'release date',
|
||||
inLanguages: 'available Languages',
|
||||
edition: 'edition',
|
||||
firstPublished: 'first published',
|
||||
inLanguage: 'content language',
|
||||
isPartOf: 'published in',
|
||||
keywords: 'keywords',
|
||||
lastPublished: 'last published',
|
||||
publishers: 'publishers',
|
||||
publications: 'publications',
|
||||
sourceOrganization: 'corporation',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -122,12 +170,10 @@ export class SCCreativeWorkMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -22,8 +22,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
/**
|
||||
* An event without references
|
||||
*/
|
||||
export interface SCEventWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCEventWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Maximum number of participants of the event
|
||||
*
|
||||
@@ -46,8 +45,7 @@ export interface SCEventWithoutReferences
|
||||
/**
|
||||
* An event
|
||||
*/
|
||||
export interface SCEvent
|
||||
extends SCEventWithoutReferences, SCThing {
|
||||
export interface SCEvent extends SCEventWithoutReferences, SCThing {
|
||||
/**
|
||||
* Academic terms that an event belongs to, e.g. semester(s).
|
||||
*/
|
||||
@@ -79,14 +77,13 @@ export interface SCEvent
|
||||
/**
|
||||
* Meta information about events
|
||||
*/
|
||||
export class SCEventMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
academicTerms: 'Semester',
|
||||
catalogs: 'Verzeichnis',
|
||||
creativeWorks: 'begleitende Werke',
|
||||
@@ -96,7 +93,7 @@ export class SCEventMeta
|
||||
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
academicTerms: 'academic terms',
|
||||
catalogs: 'catalogs',
|
||||
creativeWorks: 'related material',
|
||||
@@ -112,10 +109,10 @@ export class SCEventMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,6 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// tslint:disable-next-line:no-implicit-dependencies
|
||||
import {Point, Polygon} from 'geojson';
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCBuildingWithoutReferences} from '../building';
|
||||
@@ -40,31 +39,43 @@ export interface SCGeoInformation {
|
||||
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;
|
||||
}
|
||||
@@ -72,8 +83,7 @@ export interface SCPostalAddress {
|
||||
/**
|
||||
* A place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCPlaceWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Address of the place
|
||||
*/
|
||||
@@ -104,8 +114,7 @@ export interface SCPlaceWithoutReferences
|
||||
/**
|
||||
* A place
|
||||
*/
|
||||
export interface SCPlace
|
||||
extends SCPlaceWithoutReferences, SCThing {
|
||||
export interface SCPlace extends SCPlaceWithoutReferences, SCThing {
|
||||
/**
|
||||
* Translated fields of a place
|
||||
*/
|
||||
@@ -115,8 +124,7 @@ export interface SCPlace
|
||||
/**
|
||||
* Translatable properties of a place without references
|
||||
*/
|
||||
export interface SCPlaceWithoutReferencesTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Address of a place
|
||||
*/
|
||||
@@ -127,19 +135,21 @@ export interface SCPlaceWithoutReferencesTranslatableProperties
|
||||
* Meta information about creative works
|
||||
*/
|
||||
export class SCPlaceWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> {
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPlaceWithoutReferences>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
address: 'Adresse',
|
||||
geo: 'Geoinformation',
|
||||
openingHours: 'Öffnungszeiten',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
address: 'address',
|
||||
geo: 'geographic information',
|
||||
openingHours: 'opening hours',
|
||||
@@ -151,10 +161,10 @@ export class SCPlaceWithoutReferencesMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -169,8 +179,5 @@ export interface SCInPlace {
|
||||
/**
|
||||
* Place the thing is or happens in
|
||||
*/
|
||||
inPlace?:
|
||||
SCBuildingWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences;
|
||||
inPlace?: SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences;
|
||||
}
|
||||
|
||||
66
src/things/abstract/range.ts
Normal file
66
src/things/abstract/range.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
|
||||
/**
|
||||
* Date Range
|
||||
*
|
||||
* CAUTION: Changing the name requires changes in the core-tools premaps
|
||||
*/
|
||||
export type SCISO8601DateRange = SCRange<SCISO8601Date>;
|
||||
|
||||
/**
|
||||
* Generic range type
|
||||
*/
|
||||
export type SCRange<T> =
|
||||
| {
|
||||
/**
|
||||
* Greater than value
|
||||
*/
|
||||
gt?: never;
|
||||
|
||||
/**
|
||||
* Greater or equal to value
|
||||
*/
|
||||
gte?: T;
|
||||
|
||||
/**
|
||||
* Greater than value
|
||||
*/
|
||||
lt?: never;
|
||||
|
||||
/**
|
||||
* Greater or equal to value
|
||||
*/
|
||||
lte?: T;
|
||||
}
|
||||
| {
|
||||
gt?: T;
|
||||
gte?: never;
|
||||
lt?: T;
|
||||
lte?: never;
|
||||
}
|
||||
| {
|
||||
gt?: T;
|
||||
gte?: never;
|
||||
lt?: never;
|
||||
lte?: T;
|
||||
}
|
||||
| {
|
||||
gt?: never;
|
||||
gte?: T;
|
||||
lt?: T;
|
||||
lte?: never;
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,25 +12,22 @@
|
||||
* 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 {SCIndexableThings} from '../../meta';
|
||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||
*/
|
||||
export interface SCSaveableThingWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
// noop
|
||||
}
|
||||
export type SCSaveableThingWithoutReferences = SCThingWithoutReferences;
|
||||
|
||||
/**
|
||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||
*/
|
||||
export interface SCSaveableThing<T extends SCThingWithoutReferences>
|
||||
extends SCSaveableThingWithoutReferences, SCThing {
|
||||
export interface SCSaveableThing extends SCSaveableThingWithoutReferences, SCThing {
|
||||
/**
|
||||
* The contained data
|
||||
*/
|
||||
data: T;
|
||||
data: SCIndexableThings;
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,26 +19,24 @@ import {SCThing, SCThingMeta} from './thing';
|
||||
/**
|
||||
* A thing that is or happens in a place
|
||||
*/
|
||||
export interface SCThingInPlace
|
||||
extends SCThing, SCInPlace {
|
||||
export interface SCThingInPlace extends SCThing, SCInPlace {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about thing in a place
|
||||
*/
|
||||
export class SCThingInPlaceMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
|
||||
export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
inPlace: 'Ort',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
inPlace: 'location',
|
||||
},
|
||||
};
|
||||
@@ -48,10 +46,10 @@ export class SCThingInPlaceMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -18,18 +18,16 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
|
||||
/**
|
||||
* Types of payment that are accepted at a place.
|
||||
*/
|
||||
export type SCThingThatAcceptsPaymentsAcceptedPayments =
|
||||
'cash'
|
||||
| 'credit'
|
||||
| 'cafeteria card';
|
||||
export type SCThingThatAcceptsPaymentsAcceptedPayments = 'cash' | 'credit' | 'cafeteria card';
|
||||
|
||||
/**
|
||||
* A thing without references that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Accepted payments of the place
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
|
||||
}
|
||||
@@ -37,8 +35,7 @@ export interface SCThingThatAcceptsPaymentsWithoutReferences
|
||||
/**
|
||||
* A thing that accepts payments
|
||||
*/
|
||||
export interface SCThingThatAcceptsPayments
|
||||
extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
|
||||
export interface SCThingThatAcceptsPayments extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing {
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -46,17 +43,19 @@ export interface SCThingThatAcceptsPayments
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences> {
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCThingThatAcceptsPaymentsWithoutReferences>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
paymentsAccepted: 'Bezahlmethoden',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
paymentsAccepted: 'accepted payment methods',
|
||||
},
|
||||
};
|
||||
@@ -66,7 +65,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
paymentsAccepted: {
|
||||
'cafeteria card': 'Mensakarte',
|
||||
'cash': 'Bar',
|
||||
@@ -74,7 +73,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
},
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,10 +13,10 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCOrganizationWithoutReferences} from '../organization';
|
||||
import {SCPersonWithoutReferences} from '../person';
|
||||
import {SCInPlace} from './place';
|
||||
import {SCISO8601DateRange} from './range';
|
||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
@@ -35,8 +35,7 @@ export interface SCPriceGroup {
|
||||
/**
|
||||
* Price distinctions for academic context
|
||||
*/
|
||||
export interface SCAcademicPriceGroup
|
||||
extends SCPriceGroup {
|
||||
export interface SCAcademicPriceGroup extends SCPriceGroup {
|
||||
/**
|
||||
* Price for employees
|
||||
*
|
||||
@@ -65,8 +64,7 @@ export interface SCAcademicPriceGroup
|
||||
/**
|
||||
* A thing without references that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCThingThatCanBeOfferedWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Translations of a thing that can be offered
|
||||
*/
|
||||
@@ -77,7 +75,8 @@ export interface SCThingThatCanBeOfferedWithoutReferences
|
||||
* A thing that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
|
||||
extends SCThing, SCThingThatCanBeOfferedWithoutReferences {
|
||||
extends SCThing,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* List of offers for that thing
|
||||
*/
|
||||
@@ -92,27 +91,21 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
|
||||
/**
|
||||
* Offer of a thing
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
|
||||
extends SCInPlace {
|
||||
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> extends SCInPlace {
|
||||
/**
|
||||
* Availability of an offer
|
||||
*/
|
||||
availability: SCThingThatCanBeOfferedAvailability;
|
||||
|
||||
/**
|
||||
* The time when the thing becomes unavailable as an SCISO8601Date formatted string.
|
||||
* The time when the thing is available.
|
||||
*/
|
||||
availabilityEnds?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* The time when the thing becomes available as an SCISO8601Date formatted string.
|
||||
*/
|
||||
availabilityStarts?: SCISO8601Date;
|
||||
availabilityRange?: SCISO8601DateRange;
|
||||
|
||||
/**
|
||||
* List of prices that are distinct for specific groups
|
||||
*/
|
||||
prices: T;
|
||||
prices?: T;
|
||||
|
||||
/**
|
||||
* Provider of an offer
|
||||
@@ -123,8 +116,7 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
|
||||
/**
|
||||
* Translatable properties of a thing that can be offered
|
||||
*/
|
||||
export interface SCThingThatCanBeOfferedTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Availability of an offer
|
||||
*
|
||||
@@ -136,9 +128,7 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
|
||||
/**
|
||||
* Entity responsible for the offer
|
||||
*/
|
||||
export type SCThingThatCanBeOfferedProvider =
|
||||
| SCOrganizationWithoutReferences
|
||||
| SCPersonWithoutReferences;
|
||||
export type SCThingThatCanBeOfferedProvider = SCOrganizationWithoutReferences | SCPersonWithoutReferences;
|
||||
|
||||
/**
|
||||
* Availability of an Offer
|
||||
@@ -153,23 +143,18 @@ export type SCThingThatCanBeOfferedAvailability =
|
||||
* Meta information about a thing without references that accepts payments
|
||||
*/
|
||||
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
|
||||
implements SCMetaTranslations<SCThingThatCanBeOffered<T>> {
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*/
|
||||
protected static _instance = new Map<string, unknown>();
|
||||
|
||||
implements SCMetaTranslations<SCThingThatCanBeOffered<T>>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
offers: 'Angebote',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
offers: 'offers',
|
||||
},
|
||||
};
|
||||
@@ -179,26 +164,10 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
// tslint:disable:static-this
|
||||
/**
|
||||
* Function to retrieve typed singleton instance (including generics)
|
||||
*/
|
||||
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
|
||||
if (!SCThingThatCanBeOfferedMeta._instance.has(this.name)) {
|
||||
SCThingThatCanBeOfferedMeta._instance.set(this.name, new SCThingThatCanBeOfferedMeta<T>());
|
||||
}
|
||||
|
||||
return SCThingThatCanBeOfferedMeta._instance
|
||||
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
|
||||
}
|
||||
|
||||
protected constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -29,6 +29,7 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
*/
|
||||
categories: T[];
|
||||
|
||||
@@ -49,7 +50,8 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
|
||||
* A thing with categories
|
||||
*/
|
||||
export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecificValues>
|
||||
extends SCThing, SCThingWithCategoriesWithoutReferences<T, U> {
|
||||
extends SCThing,
|
||||
SCThingWithCategoriesWithoutReferences<T, U> {
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
@@ -59,10 +61,11 @@ export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecifi
|
||||
/**
|
||||
* Translatable properties of a thing with categories
|
||||
*/
|
||||
export interface SCThingWithCategoriesTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* translations of the categories of a thing with categories
|
||||
*
|
||||
* @sortable ducet
|
||||
*/
|
||||
categories?: string[];
|
||||
}
|
||||
@@ -97,6 +100,7 @@ export interface SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific name of a thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name?: string;
|
||||
@@ -114,24 +118,19 @@ export interface SCThingWithCategoriesSpecificValues {
|
||||
* It intentionally does not extend the SCThingMeta implementation to be able to include generics.
|
||||
*/
|
||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*/
|
||||
protected static _instance = new Map<string, unknown>();
|
||||
|
||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>>
|
||||
{
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
categories: 'Kategorien',
|
||||
categorySpecificValues: 'besondere Kategorien',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
categories: 'categories',
|
||||
categorySpecificValues: 'category with specific values',
|
||||
},
|
||||
@@ -142,27 +141,10 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
// tslint:disable:static-this
|
||||
/**
|
||||
* Function to retrieve typed singleton instance (including generics)
|
||||
*/
|
||||
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
|
||||
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
|
||||
SCThingWithCategoriesWithoutReferencesMeta._instance
|
||||
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
|
||||
}
|
||||
|
||||
return SCThingWithCategoriesWithoutReferencesMeta._instance
|
||||
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
|
||||
}
|
||||
|
||||
protected constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,6 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||
import {SCMap} from '../../general/map';
|
||||
import {SCISO8601Date} from '../../general/time';
|
||||
import {SCUuid} from '../../general/uuid';
|
||||
import {SCOrganizationWithoutReferences} from '../organization';
|
||||
@@ -22,12 +23,15 @@ import {SCPersonWithoutReferences} from '../person';
|
||||
* Types a thing can be
|
||||
*/
|
||||
export enum SCThingType {
|
||||
Assessment = 'assessment',
|
||||
AcademicEvent = 'academic event',
|
||||
Article = 'article',
|
||||
Book = 'book',
|
||||
Periodical = 'periodical',
|
||||
Building = 'building',
|
||||
Catalog = 'catalog',
|
||||
CourseOfStudies = 'course of studies',
|
||||
ContactPoint = 'contact point',
|
||||
CourseOfStudy = 'course of study',
|
||||
DateSeries = 'date series',
|
||||
Diff = 'diff',
|
||||
Dish = 'dish',
|
||||
@@ -37,6 +41,7 @@ export enum SCThingType {
|
||||
Organization = 'organization',
|
||||
Person = 'person',
|
||||
PointOfInterest = 'point of interest',
|
||||
PublicationEvent = 'publication event',
|
||||
Room = 'room',
|
||||
Semester = 'semester',
|
||||
Setting = 'setting',
|
||||
@@ -55,9 +60,11 @@ export interface SCThingWithoutReferences {
|
||||
/**
|
||||
* Alternate names of the thing
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
|
||||
/**
|
||||
* Description of the thing
|
||||
*
|
||||
@@ -65,41 +72,58 @@ export interface SCThingWithoutReferences {
|
||||
* @text
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* The identifier property represents any kind of additional identifier for any kind of SCThing
|
||||
*
|
||||
* E.g. GTIN codes, UUIDs, Database IDs etc.
|
||||
*/
|
||||
identifiers?: SCMap<string>;
|
||||
|
||||
/**
|
||||
* URL of an image of the thing
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
image?: string;
|
||||
|
||||
/**
|
||||
* Name of the thing
|
||||
*
|
||||
* @filterable
|
||||
* @minLength 1
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* URL of a reference Web page that unambiguously indicates the item's identity
|
||||
*
|
||||
* E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.
|
||||
*/
|
||||
sameAs?: string;
|
||||
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
*
|
||||
* Take precedence over "main" value for selected languages.
|
||||
*/
|
||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @aggregatable global
|
||||
*/
|
||||
type: SCThingType;
|
||||
|
||||
/**
|
||||
* Universally unique identifier of the thing
|
||||
*/
|
||||
uid: SCUuid;
|
||||
/**
|
||||
* URL of the thing
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,6 +243,7 @@ export interface SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the name of the thing
|
||||
*
|
||||
* @sortable ducet
|
||||
* @text
|
||||
*/
|
||||
name?: string;
|
||||
@@ -244,11 +269,6 @@ export interface SCThingTranslatablePropertyOrigin {
|
||||
* Meta information about things
|
||||
*/
|
||||
export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
/**
|
||||
* Set type definiton for singleton instance
|
||||
*/
|
||||
protected static _instance = new Map<string, unknown>();
|
||||
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
@@ -256,24 +276,26 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
de: {
|
||||
alternateNames: 'alternative Namen',
|
||||
description: 'Beschreibung',
|
||||
identifiers: 'Alternative Identifikation',
|
||||
image: 'Bild',
|
||||
name: 'Name',
|
||||
origin: 'Ursprung',
|
||||
sameAs: 'ursprünglicher Link',
|
||||
translations: 'Übersetzungen',
|
||||
type: 'Typ',
|
||||
uid: 'Identifikation',
|
||||
url: 'URL',
|
||||
},
|
||||
en: {
|
||||
alternateNames: 'alternate names',
|
||||
description: 'description',
|
||||
identifiers: 'alternative identification',
|
||||
image: 'image',
|
||||
name: 'name',
|
||||
origin: 'origin',
|
||||
sameAs: 'original link',
|
||||
translations: 'translations',
|
||||
type: 'type',
|
||||
uid: 'identification',
|
||||
url: 'URL',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -288,19 +310,4 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||
type: 'Thing',
|
||||
},
|
||||
};
|
||||
|
||||
// tslint:disable:static-this
|
||||
/**
|
||||
* Function to retrieve typed singleton instance
|
||||
*/
|
||||
public static getInstance<T extends SCThingMeta>(): T {
|
||||
if (!SCThingMeta._instance.has(this.name)) {
|
||||
SCThingMeta._instance.set(this.name, new this());
|
||||
}
|
||||
|
||||
return SCThingMeta._instance.get(this.name) as T;
|
||||
}
|
||||
|
||||
protected constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
18
src/things/abstract/user-groups.ts
Normal file
18
src/things/abstract/user-groups.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Types of data consumers
|
||||
*/
|
||||
export type SCUserGroup = 'students' | 'employees' | 'guests';
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -33,6 +33,7 @@ export interface SCAcademicEventWithoutReferences
|
||||
* Majors of the academic event that this event belongs to
|
||||
*
|
||||
* @aggregatable
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
majors?: string[];
|
||||
@@ -40,6 +41,7 @@ export interface SCAcademicEventWithoutReferences
|
||||
/**
|
||||
* Original unmapped category from the source of the academic event
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
originalCategory?: string;
|
||||
@@ -62,7 +64,8 @@ export interface SCAcademicEventWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCAcademicEvent
|
||||
extends SCEvent, SCAcademicEventWithoutReferences,
|
||||
extends SCEvent,
|
||||
SCAcademicEventWithoutReferences,
|
||||
SCThingWithCategories<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of an academic event
|
||||
@@ -79,7 +82,7 @@ export interface SCAcademicEvent
|
||||
* Categories of academic events
|
||||
*/
|
||||
export type SCAcademicEventCategories =
|
||||
'lecture'
|
||||
| 'lecture'
|
||||
| 'seminar'
|
||||
| 'integrated course'
|
||||
| 'written exam'
|
||||
@@ -92,13 +95,13 @@ export type SCAcademicEventCategories =
|
||||
| 'course'
|
||||
| 'practicum introduction'
|
||||
| 'excursion'
|
||||
| 'exercise'
|
||||
| 'special';
|
||||
|
||||
/**
|
||||
* Translatable properties of an academic event
|
||||
*/
|
||||
export interface SCAcademicEventTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties {
|
||||
export interface SCAcademicEventTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* Translations of the majors of the academic event that this event belongs to
|
||||
*
|
||||
@@ -117,24 +120,26 @@ export interface SCAcademicEventTranslatableProperties
|
||||
/**
|
||||
* Meta information about academic events
|
||||
*/
|
||||
export class SCAcademicEventMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCAcademicEvent> {
|
||||
export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
majors: 'Hauptfächer',
|
||||
originalCategory: 'ursprüngliche Kategorie',
|
||||
},
|
||||
en: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...new SCEventMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
majors: 'majors',
|
||||
originalCategory: 'original category',
|
||||
},
|
||||
@@ -145,14 +150,17 @@ export class SCAcademicEventMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'colloquium': 'Kolloquium',
|
||||
'course': 'Kurs',
|
||||
'excursion': 'Exkursion',
|
||||
'integrated course': '',
|
||||
'exercise': 'Übung',
|
||||
'integrated course': 'Integrierter Kurs',
|
||||
'introductory class': 'Einführungsveranstaltung',
|
||||
'lecture': 'Vorlesung',
|
||||
'oral exam': 'mündliche Prüfung',
|
||||
@@ -167,9 +175,11 @@ export class SCAcademicEventMeta
|
||||
type: 'akademische Veranstaltung',
|
||||
},
|
||||
en: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...new SCEventMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.AcademicEvent,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -21,25 +21,43 @@ import {
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCPeriodicalWithoutReferences} from './periodical';
|
||||
|
||||
/**
|
||||
* Categories of an article
|
||||
*/
|
||||
export type SCArticleCategories = 'unipedia' | 'article' | 'eArticle';
|
||||
|
||||
/**
|
||||
* An article without references
|
||||
*/
|
||||
export interface SCArticleWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Article itself as markdown
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
articleBody: string;
|
||||
articleBody?: string;
|
||||
|
||||
/**
|
||||
* Categories of an article
|
||||
*/
|
||||
categories: SCArticleCategories[];
|
||||
|
||||
/**
|
||||
* Translated fields of an article
|
||||
@@ -59,8 +77,18 @@ export interface SCArticleWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCArticle
|
||||
extends SCCreativeWork, SCArticleWithoutReferences,
|
||||
SCThingWithCategories<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCArticleWithoutReferences {
|
||||
/**
|
||||
* A periodical to which this article belongs
|
||||
*/
|
||||
isPartOf?: SCPeriodicalWithoutReferences;
|
||||
/**
|
||||
* Additional information about how to find the article inside of its "parent" (which is provided in 'isPartOf')
|
||||
* e.g. "40, 2011, S. 2-3"
|
||||
*/
|
||||
reference?: string;
|
||||
/**
|
||||
* Translated fields of an article
|
||||
*/
|
||||
@@ -73,15 +101,12 @@ export interface SCArticle
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of articles
|
||||
*/
|
||||
export type SCArticleCategories = 'unipedia';
|
||||
|
||||
/**
|
||||
* Translatable properties of creative works
|
||||
* Translatable properties of an article
|
||||
*/
|
||||
export interface SCArticleTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of the article itself as markdown
|
||||
*
|
||||
@@ -93,24 +118,31 @@ export interface SCArticleTranslatableProperties
|
||||
/**
|
||||
* Meta information about an article
|
||||
*/
|
||||
export class SCArticleMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCArticle> {
|
||||
export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCArticle> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
categories: 'Format',
|
||||
reference: 'Referenz',
|
||||
articleBody: 'Artikelinhalt',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
categories: 'format',
|
||||
reference: 'reference',
|
||||
articleBody: 'article body',
|
||||
},
|
||||
};
|
||||
@@ -120,21 +152,32 @@ export class SCArticleMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'unipedia': 'Unipedia',
|
||||
article: 'Artikel',
|
||||
eArticle: 'E-Aufsatz',
|
||||
unipedia: 'Unipedia',
|
||||
},
|
||||
type: 'Artikel',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCArticleCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Article,
|
||||
categories: {
|
||||
article: 'article',
|
||||
eArticle: 'E-Article',
|
||||
unipedia: 'unipedia',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
174
src/things/assessment.ts
Normal file
174
src/things/assessment.ts
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCCourseOfStudyWithoutReferences} from './course-of-study';
|
||||
|
||||
/**
|
||||
* Categories of assessments
|
||||
*/
|
||||
export type SCAssessmentCategories = 'university assessment';
|
||||
|
||||
/**
|
||||
* An assessment without references
|
||||
*
|
||||
*/
|
||||
export interface SCAssessmentWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
> {
|
||||
/**
|
||||
* Number of attempts
|
||||
*
|
||||
* @integer
|
||||
*/
|
||||
attempt?: number;
|
||||
|
||||
/**
|
||||
* Date assessment was taken or graded
|
||||
*/
|
||||
date?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* ECTS (credit-points)
|
||||
*
|
||||
* @float
|
||||
*/
|
||||
ects?: number;
|
||||
|
||||
/**
|
||||
* Grade
|
||||
*/
|
||||
grade: string;
|
||||
|
||||
/**
|
||||
* Current status
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an assessment
|
||||
*/
|
||||
translations?: SCTranslations<SCAssessmentTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an assessment
|
||||
*/
|
||||
type: SCThingType.Assessment;
|
||||
}
|
||||
|
||||
/**
|
||||
* An assessment
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCAssessment
|
||||
extends SCAssessmentWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCAssessmentCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Course of study the assessment was taken for
|
||||
*/
|
||||
courseOfStudy?: SCCourseOfStudyWithoutReferences;
|
||||
|
||||
/**
|
||||
* An array of assessments from the 'level 0' (root) assessment to the direct parent
|
||||
*/
|
||||
superAssessments?: SCAssessmentWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of an assessment
|
||||
*/
|
||||
translations?: SCTranslations<SCAssessmentTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an assessment
|
||||
*/
|
||||
type: SCThingType.Assessment;
|
||||
}
|
||||
|
||||
export interface SCAssessmentTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* @see SCAssessmentWithoutReferences.status
|
||||
*/
|
||||
status?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Study module meta data
|
||||
*/
|
||||
export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations<SCAssessment> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
attempt: 'Versuch',
|
||||
courseOfStudy: 'Studiengang',
|
||||
date: 'Datum',
|
||||
ects: 'ECTS-Punkte',
|
||||
grade: 'Note',
|
||||
status: 'Status',
|
||||
superAssessments: 'übergeordnete Prüfungen',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
attempt: 'attempt',
|
||||
courseOfStudy: 'course of study',
|
||||
date: 'date',
|
||||
ects: 'ECTS points',
|
||||
grade: 'grade',
|
||||
status: 'status',
|
||||
superAssessments: 'parent assessments',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
type: 'Prüfung',
|
||||
},
|
||||
en: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Assessment,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -20,27 +20,62 @@ import {
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCThingWithCategoriesTranslatableProperties} from './abstract/thing-with-categories';
|
||||
import {SCPersonWithoutReferences} from './person';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* Categories of a book
|
||||
*/
|
||||
export type SCBookCategories =
|
||||
| 'audio'
|
||||
| 'book'
|
||||
| 'cd'
|
||||
| 'dvd'
|
||||
| 'ePhoto'
|
||||
| 'ebook'
|
||||
| 'hierarchy'
|
||||
| 'kit'
|
||||
| 'manuscript'
|
||||
| 'map'
|
||||
| 'microfilm'
|
||||
| 'musicalscore'
|
||||
| 'photo'
|
||||
| 'physicalobject'
|
||||
| 'retro'
|
||||
| 'sensorimage'
|
||||
| 'unknown'
|
||||
| 'video';
|
||||
|
||||
/**
|
||||
* A book without references
|
||||
*/
|
||||
export interface SCBookWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Edition of a book
|
||||
*
|
||||
* @keyword
|
||||
* Categories of a book
|
||||
*/
|
||||
bookEdition?: string;
|
||||
categories: SCBookCategories[];
|
||||
|
||||
/**
|
||||
* ISBN of a book
|
||||
* ISBNs of a book
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
isbn: string;
|
||||
ISBNs?: string[];
|
||||
|
||||
/**
|
||||
* Number of pages of a book
|
||||
@@ -67,12 +102,9 @@ export interface SCBookWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCBook
|
||||
extends SCCreativeWork, SCBookWithoutReferences {
|
||||
/**
|
||||
* Authors of the creative work
|
||||
*/
|
||||
authors: SCPersonWithoutReferences[];
|
||||
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCBookWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a book
|
||||
*/
|
||||
@@ -88,14 +120,9 @@ export interface SCBook
|
||||
* Translatable properties of a book
|
||||
*/
|
||||
export interface SCBookTranslatableFields
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||
/**
|
||||
* Translation of an edition of a book
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
bookEdition?: string;
|
||||
}
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCCreativeWorkTranslatableProperties {}
|
||||
|
||||
/**
|
||||
* Meta information about a book
|
||||
@@ -106,17 +133,25 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
bookEdition: 'Buchausgabe',
|
||||
isbn: 'ISBN',
|
||||
numberOfPages: 'Seitenzahl',
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
categories: 'Format',
|
||||
ISBNs: 'ISBN',
|
||||
numberOfPages: 'Seitenanzahl',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
bookEdition: 'book edition',
|
||||
isbn: 'ISBN',
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
categories: 'format',
|
||||
ISBNs: 'ISBN',
|
||||
numberOfPages: 'number of pages',
|
||||
},
|
||||
};
|
||||
@@ -126,14 +161,62 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
audio: 'Tonträger',
|
||||
book: 'Buch',
|
||||
cd: 'CD',
|
||||
dvd: 'DVD',
|
||||
ePhoto: 'E-Photo',
|
||||
ebook: 'E-Book',
|
||||
hierarchy: 'mehrteiliges Werk',
|
||||
kit: 'Medienkombination',
|
||||
manuscript: 'Handschrift',
|
||||
map: 'Karte',
|
||||
microfilm: 'Mikrofilm, Mikrofiche',
|
||||
musicalscore: 'Noten',
|
||||
photo: 'Abbildung',
|
||||
physicalobject: 'Objekt',
|
||||
retro: 'Retro (Buch)',
|
||||
sensorimage: 'Blindenschrift',
|
||||
unknown: 'Unbekannt',
|
||||
video: 'Film',
|
||||
},
|
||||
type: 'Buch',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBookCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.Book,
|
||||
categories: {
|
||||
audio: 'audio material',
|
||||
book: 'book',
|
||||
cd: 'CD',
|
||||
dvd: 'DVD',
|
||||
ePhoto: 'E-Photo',
|
||||
ebook: 'E-Book',
|
||||
hierarchy: 'multipart item',
|
||||
kit: 'media combination',
|
||||
manuscript: 'manuscript',
|
||||
map: 'map',
|
||||
microfilm: 'microfilm, microfiche',
|
||||
musicalscore: 'sheet music',
|
||||
photo: 'illustration',
|
||||
physicalobject: 'object',
|
||||
retro: 'retro (book)',
|
||||
sensorimage: 'braille',
|
||||
unknown: 'unknown',
|
||||
video: 'film',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
export type SCBuildingCategories =
|
||||
'cafe'
|
||||
| 'cafe'
|
||||
| 'education'
|
||||
| 'library'
|
||||
| 'office'
|
||||
@@ -41,17 +41,10 @@ export type SCBuildingCategories =
|
||||
export interface SCBuildingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Categories of a building
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
*/
|
||||
categories: SCBuildingCategories[];
|
||||
|
||||
/**
|
||||
* List of floor names of the place
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
floors?: string[];
|
||||
@@ -74,7 +67,8 @@ export interface SCBuildingWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCBuilding
|
||||
extends SCBuildingWithoutReferences, SCPlace,
|
||||
extends SCBuildingWithoutReferences,
|
||||
SCPlace,
|
||||
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a building
|
||||
@@ -88,7 +82,8 @@ export interface SCBuilding
|
||||
}
|
||||
|
||||
export interface SCBuildingTranslatableProperties
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||
extends SCPlaceWithoutReferencesTranslatableProperties,
|
||||
SCThingWithCategoriesTranslatableProperties {
|
||||
/**
|
||||
* @see SCBuilding.floors
|
||||
*/
|
||||
@@ -98,23 +93,25 @@ export interface SCBuildingTranslatableProperties
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCBuildingMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCBuilding> {
|
||||
export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SCBuilding> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
floors: 'Etagen',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
|
||||
floors: 'floors',
|
||||
},
|
||||
};
|
||||
@@ -124,9 +121,11 @@ export class SCBuildingMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
@@ -140,9 +139,11 @@ export class SCBuildingMeta
|
||||
type: 'Gebäude',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Building,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -33,6 +33,7 @@ export interface SCCatalogWithoutReferences
|
||||
*
|
||||
* Needed for keeping order in catalog inheritance array.
|
||||
*
|
||||
* @filterable
|
||||
* @integer
|
||||
*/
|
||||
level: number;
|
||||
@@ -50,7 +51,8 @@ export interface SCCatalogWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCatalog
|
||||
extends SCCatalogWithoutReferences, SCThing,
|
||||
extends SCCatalogWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCCatalogCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Academic term that a catalog belongs to (e.g. semester)
|
||||
@@ -81,23 +83,26 @@ export interface SCCatalog
|
||||
/**
|
||||
* Catalog meta data
|
||||
*/
|
||||
export class SCCatalogMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
|
||||
export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
academicTerm: 'Semester',
|
||||
level: 'Ebene',
|
||||
superCatalog: 'übergeordnetes Verzeichniss',
|
||||
superCatalogs: 'übergeordnete Verzeichnisse',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
academicTerm: 'academic term',
|
||||
level: 'level',
|
||||
superCatalog: 'parent catalog',
|
||||
@@ -110,16 +115,20 @@ export class SCCatalogMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'university events': 'Universitätsveranstaltung',
|
||||
},
|
||||
type: 'Verzeichnis',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Catalog,
|
||||
},
|
||||
};
|
||||
|
||||
126
src/things/contact-point.ts
Normal file
126
src/things/contact-point.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* 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: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
areaServed: 'Arbeitsraum',
|
||||
email: 'E-Mail-Addresse',
|
||||
faxNumber: 'Faxnummer',
|
||||
officeHours: 'Sprechzeiten',
|
||||
telephone: 'Telefonnummer',
|
||||
url: 'Link',
|
||||
},
|
||||
en: {
|
||||
...new 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: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Kontaktinformation',
|
||||
},
|
||||
en: {
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.ContactPoint,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* 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 {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from './abstract/academic-degree';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCDateSeriesWithoutReferences} from './date-series';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
|
||||
/**
|
||||
* A course of studies without references
|
||||
*/
|
||||
export interface SCCourseOfStudiesWithoutReferences
|
||||
extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The main language in which the course of studies
|
||||
* is beeing offered
|
||||
*/
|
||||
mainLanguage: SCLanguage;
|
||||
|
||||
/**
|
||||
* Actual major of the course of studies (eg. physics)
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
major: string;
|
||||
|
||||
/**
|
||||
* The modes the course of studies is offered in
|
||||
*/
|
||||
mode: SCCourseOfStudiesMode;
|
||||
|
||||
/**
|
||||
* The time modes the course of studies is offered in
|
||||
*/
|
||||
timeMode: SCCourseOfStudiesTimeMode;
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of studies
|
||||
*/
|
||||
type: SCThingType.CourseOfStudies;
|
||||
}
|
||||
|
||||
/**
|
||||
* A course of studies
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCourseOfStudies
|
||||
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
|
||||
/**
|
||||
* The department that manages the course of studies
|
||||
*/
|
||||
department: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* The secretary that administers requests and
|
||||
* questions concerning the course of studies
|
||||
*/
|
||||
secretary: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Dates at which the course of studies is planned to start
|
||||
*/
|
||||
startDates?: SCDateSeriesWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a course of studies
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of studies
|
||||
*/
|
||||
type: SCThingType.CourseOfStudies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a course of studies
|
||||
*/
|
||||
export interface SCCourseOfStudiesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a course of studies
|
||||
*/
|
||||
export class SCCourseOfStudiesMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCCourseOfStudies> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
|
||||
.fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
department: 'Fachbereich',
|
||||
mainLanguage: 'Unterrichtssprache',
|
||||
major: 'Studienfach',
|
||||
mode: 'Studiengangsart',
|
||||
secretary: 'Sekretariat',
|
||||
startDates: 'Startdatum',
|
||||
timeMode: 'Zeitmodell',
|
||||
},
|
||||
en: {
|
||||
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
|
||||
.fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
department: 'department',
|
||||
mainLanguage: 'main language',
|
||||
major: 'major',
|
||||
mode: 'mode',
|
||||
secretary: 'secretary',
|
||||
startDates: 'start dates',
|
||||
timeMode: 'time mode',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
|
||||
modes: {
|
||||
combination: 'Kombinationsstudiengang',
|
||||
'double-degree': 'Doppelstudium',
|
||||
dual: 'duales Studium',
|
||||
standard: 'Studium',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'Vollzeitstudiengang',
|
||||
parttime: 'Teilzeitstudiengang',
|
||||
},
|
||||
type: 'Studiengang',
|
||||
},
|
||||
en: {
|
||||
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
|
||||
modes: {
|
||||
combination: 'combination course of studies',
|
||||
'double-degree': 'double degree course of studies',
|
||||
dual: 'dual course of studies',
|
||||
standard: 'course of studies',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'full-time',
|
||||
parttime: 'part-time',
|
||||
},
|
||||
type: SCThingType.CourseOfStudies,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Types of (german) course of studies modes
|
||||
*/
|
||||
export type SCCourseOfStudiesMode = 'combination'
|
||||
| 'dual'
|
||||
| 'double-degree'
|
||||
| 'standard' ;
|
||||
|
||||
/**
|
||||
* Types of (german) course of studies time modes
|
||||
*/
|
||||
export type SCCourseOfStudiesTimeMode = 'fulltime'
|
||||
| 'parttime' ;
|
||||
184
src/things/course-of-study.ts
Normal file
184
src/things/course-of-study.ts
Normal file
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCAcademicDegree,
|
||||
SCAcademicDegreeMeta,
|
||||
SCAcademicDegreeWithoutReferences,
|
||||
} from './abstract/academic-degree';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCDateSeriesWithoutReferences} from './date-series';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
|
||||
/**
|
||||
* A course of study without references
|
||||
*/
|
||||
export interface SCCourseOfStudyWithoutReferences
|
||||
extends SCAcademicDegreeWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The main language in which the course of study
|
||||
* is beeing offered
|
||||
*/
|
||||
mainLanguage?: SCLanguage;
|
||||
|
||||
/**
|
||||
* The modes the course of study is offered in
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
mode?: SCCourseOfStudyMode;
|
||||
|
||||
/**
|
||||
* The time modes the course of study is offered in
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
timeMode?: SCCourseOfStudyTimeMode;
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudyTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of study
|
||||
*/
|
||||
type: SCThingType.CourseOfStudy;
|
||||
}
|
||||
|
||||
/**
|
||||
* A course of study
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCCourseOfStudy
|
||||
extends SCCourseOfStudyWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCAcademicDegree {
|
||||
/**
|
||||
* The department that manages the course of study
|
||||
*/
|
||||
department?: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* The secretary that administers requests and
|
||||
* questions concerning the course of study
|
||||
*/
|
||||
secretary?: SCOrganizationWithoutReferences;
|
||||
|
||||
/**
|
||||
* Dates at which the course of study is planned to start
|
||||
*/
|
||||
startDates?: SCDateSeriesWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a course of study
|
||||
*/
|
||||
translations?: SCTranslations<SCCourseOfStudyTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of the course of study
|
||||
*/
|
||||
type: SCThingType.CourseOfStudy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a course of study
|
||||
*/
|
||||
export type SCCourseOfStudyTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
|
||||
|
||||
/**
|
||||
* Meta information about a course of study
|
||||
*/
|
||||
export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslations<SCCourseOfStudy> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCAcademicDegreeMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
department: 'Fachbereich',
|
||||
mainLanguage: 'Unterrichtssprache',
|
||||
mode: 'Studiengangsart',
|
||||
secretary: 'Sekretariat',
|
||||
startDates: 'Startdatum',
|
||||
timeMode: 'Zeitmodell',
|
||||
},
|
||||
en: {
|
||||
...new SCAcademicDegreeMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
department: 'department',
|
||||
mainLanguage: 'main language',
|
||||
mode: 'mode',
|
||||
secretary: 'secretary',
|
||||
startDates: 'start dates',
|
||||
timeMode: 'time mode',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCAcademicDegreeMeta().fieldValueTranslations.de,
|
||||
modes: {
|
||||
'combination': 'Kombinationsstudiengang',
|
||||
'double-degree': 'Doppelstudium',
|
||||
'dual': 'duales Studium',
|
||||
'standard': 'Studium',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'Vollzeitstudiengang',
|
||||
parttime: 'Teilzeitstudiengang',
|
||||
},
|
||||
type: 'Studiengang',
|
||||
},
|
||||
en: {
|
||||
...new SCAcademicDegreeMeta().fieldValueTranslations.en,
|
||||
modes: {
|
||||
'combination': 'combination course of study',
|
||||
'double-degree': 'double degree course of study',
|
||||
'dual': 'dual course of study',
|
||||
'standard': 'course of study',
|
||||
},
|
||||
timeMode: {
|
||||
fulltime: 'full-time',
|
||||
parttime: 'part-time',
|
||||
},
|
||||
type: SCThingType.CourseOfStudy,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Types of (german) course of study modes
|
||||
*/
|
||||
export type SCCourseOfStudyMode = 'combination' | 'dual' | 'double-degree' | 'standard';
|
||||
|
||||
/**
|
||||
* Types of (german) course of study time modes
|
||||
*/
|
||||
export type SCCourseOfStudyTimeMode = 'fulltime' | 'parttime';
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -30,8 +30,7 @@ import {SCSportCourseWithoutReferences} from './sport-course';
|
||||
/**
|
||||
* Price groups for sport courses
|
||||
*/
|
||||
export interface SCSportCoursePriceGroup
|
||||
extends SCAcademicPriceGroup {
|
||||
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* Price for alumnis
|
||||
*
|
||||
@@ -43,10 +42,11 @@ export interface SCSportCoursePriceGroup
|
||||
/**
|
||||
* A date without references
|
||||
*/
|
||||
export interface SCDateSeriesWithoutReferences
|
||||
extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* Dates of the date series that are initially planned to be held
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
dates: SCISO8601Date[];
|
||||
|
||||
@@ -63,9 +63,9 @@ export interface SCDateSeriesWithoutReferences
|
||||
/**
|
||||
* Frequency of the date series
|
||||
*
|
||||
* @keyword
|
||||
* @filterable
|
||||
*/
|
||||
frequency: string;
|
||||
repeatFrequency?: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Translated properties
|
||||
@@ -91,8 +91,7 @@ export interface SCDateSeries
|
||||
/**
|
||||
* Event to which the date series belongs
|
||||
*/
|
||||
event: SCAcademicEventWithoutReferences
|
||||
| SCSportCourseWithoutReferences;
|
||||
event: SCAcademicEventWithoutReferences | SCSportCourseWithoutReferences;
|
||||
|
||||
/**
|
||||
* Performers of the date series
|
||||
@@ -113,35 +112,29 @@ export interface SCDateSeries
|
||||
/**
|
||||
* Meta information about a date series
|
||||
*/
|
||||
export class SCDateSeriesMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDateSeries> {
|
||||
export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<SCDateSeries> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.de,
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
event: 'Event',
|
||||
exceptions: 'Ausnahmen',
|
||||
frequency: 'Frequenz',
|
||||
repeatFrequency: 'Frequenz',
|
||||
performers: 'Vortragende',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.en,
|
||||
dates: 'dates',
|
||||
duration: 'duration',
|
||||
event: 'event',
|
||||
exceptions: 'exceptions',
|
||||
frequency: 'frequency',
|
||||
repeatFrequency: 'frequency',
|
||||
performers: 'performers',
|
||||
},
|
||||
};
|
||||
@@ -151,17 +144,13 @@ export class SCDateSeriesMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.de,
|
||||
type: 'Terminserie',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.DateSeries,
|
||||
},
|
||||
};
|
||||
@@ -170,10 +159,4 @@ export class SCDateSeriesMeta
|
||||
/**
|
||||
* Translatable properties of date series'
|
||||
*/
|
||||
export interface SCDateSeriesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* @see SCDateSeriesWithoutReferences.frequency
|
||||
*/
|
||||
frequency?: string;
|
||||
}
|
||||
export type SCDateSeriesTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -15,14 +15,13 @@
|
||||
import * as jsonpatch from 'json-patch';
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThingsWithoutDiff} from '../meta';
|
||||
import {SCIndexableThings} from '../meta';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* A diff without references
|
||||
*/
|
||||
export interface SCDiffWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCDiffWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Action of the diff
|
||||
*/
|
||||
@@ -48,14 +47,12 @@ export interface SCDiffWithoutReferences
|
||||
* A diff
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDiff
|
||||
extends SCDiffWithoutReferences, SCThing {
|
||||
export interface SCDiff extends SCDiffWithoutReferences, SCThing {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
object: SCThingsWithoutDiff;
|
||||
object: SCIndexableThings;
|
||||
|
||||
/**
|
||||
* Type of a diff
|
||||
@@ -66,22 +63,20 @@ export interface SCDiff
|
||||
/**
|
||||
* Meta information about a diff
|
||||
*/
|
||||
export class SCDiffMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDiff> {
|
||||
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
action: 'Aktion',
|
||||
changes: 'Änderungen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
object: 'Objekt',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
action: 'action',
|
||||
changes: 'changes',
|
||||
dateCreated: 'date created',
|
||||
@@ -94,15 +89,15 @@ export class SCDiffMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
action: {
|
||||
'changed': 'geändert',
|
||||
'removed': 'gelöscht',
|
||||
changed: 'geändert',
|
||||
removed: 'gelöscht',
|
||||
},
|
||||
type: 'Unterschied',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Diff,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -38,18 +38,11 @@ export interface SCDishWithoutReferences
|
||||
/**
|
||||
* Additives of the dish
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
additives?: string[];
|
||||
|
||||
/**
|
||||
* Category of the dish
|
||||
*
|
||||
* @sortable ducet
|
||||
* @aggregatable
|
||||
*/
|
||||
categories: SCDishCategories[];
|
||||
|
||||
/**
|
||||
* Characteristics of the dish
|
||||
*/
|
||||
@@ -78,7 +71,8 @@ export interface SCDishWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDish
|
||||
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
extends SCDishWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCThingWithCategories<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
|
||||
@@ -97,7 +91,15 @@ export interface SCDish
|
||||
}
|
||||
|
||||
export interface SCDishTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
additives?: string[];
|
||||
/**
|
||||
* Characteristics of the dish
|
||||
*/
|
||||
@@ -118,6 +120,7 @@ export interface SCDishCharacteristic {
|
||||
/**
|
||||
* Name of the characteristic
|
||||
*
|
||||
* @filterable
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
@@ -126,13 +129,7 @@ export interface SCDishCharacteristic {
|
||||
/**
|
||||
* A list of categories for dishes
|
||||
*/
|
||||
export type SCDishCategories =
|
||||
| 'appetizer'
|
||||
| 'salad'
|
||||
| 'main dish'
|
||||
| 'dessert'
|
||||
| 'soup'
|
||||
| 'side dish';
|
||||
export type SCDishCategories = 'appetizer' | 'salad' | 'main dish' | 'dessert' | 'soup' | 'side dish';
|
||||
|
||||
/**
|
||||
* Type definition for SCNutritionInformation
|
||||
@@ -193,28 +190,28 @@ export interface SCNutritionInformation {
|
||||
/**
|
||||
* Meta information about a dish
|
||||
*/
|
||||
export class SCDishMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCDish> {
|
||||
export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
additives: 'Zusatzstoffe',
|
||||
characteristics: 'Merkmale',
|
||||
dishAddOns: 'Beilagen',
|
||||
nutrition: 'Nährwertangaben',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
additives: 'additives',
|
||||
characteristics: 'characteristics',
|
||||
dishAddOns: 'side dishes',
|
||||
@@ -227,25 +224,27 @@ export class SCDishMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
appetizer: 'Vorspeise',
|
||||
dessert: 'Nachtisch',
|
||||
'appetizer': 'Vorspeise',
|
||||
'dessert': 'Nachtisch',
|
||||
'main dish': 'Hauptgericht',
|
||||
salad: 'Salat',
|
||||
'salad': 'Salat',
|
||||
'side dish': 'Beilage',
|
||||
soup: 'Suppe',
|
||||
'soup': 'Suppe',
|
||||
},
|
||||
type: 'Essen',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.Dish,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,45 +14,23 @@
|
||||
*/
|
||||
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCAcademicEventWithoutReferences} from './academic-event';
|
||||
import {SCArticleWithoutReferences} from './article';
|
||||
import {SCBookWithoutReferences} from './book';
|
||||
import {SCBuildingWithoutReferences} from './building';
|
||||
import {SCPersonWithoutReferences} from './person';
|
||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
import {SCSportCourseWithoutReferences} from './sport-course';
|
||||
import {SCToDoWithoutReferences} from './todo';
|
||||
|
||||
/**
|
||||
* Types that can be made a favorite (added as a favorite)
|
||||
*/
|
||||
export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences
|
||||
| SCArticleWithoutReferences
|
||||
| SCBookWithoutReferences
|
||||
| SCBuildingWithoutReferences
|
||||
| SCPersonWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences
|
||||
| SCSportCourseWithoutReferences
|
||||
| SCToDoWithoutReferences;
|
||||
|
||||
/**
|
||||
* A favorite without references
|
||||
*/
|
||||
export interface SCFavoriteWithoutReferences
|
||||
extends SCSaveableThingWithoutReferences {
|
||||
// noop
|
||||
export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
type: SCThingType.Favorite;
|
||||
}
|
||||
|
||||
/**
|
||||
* A favorite
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCFavorite
|
||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
||||
export interface SCFavorite extends SCSaveableThing {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
@@ -62,6 +40,4 @@ export interface SCFavorite
|
||||
/**
|
||||
* Meta information about a favorite
|
||||
*/
|
||||
export class SCFavoriteMeta
|
||||
extends SCThingMeta {
|
||||
}
|
||||
export class SCFavoriteMeta extends SCThingMeta {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,10 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// tslint:disable-next-line:no-implicit-dependencies
|
||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {
|
||||
SCThingMeta,
|
||||
SCThingTranslatableProperties,
|
||||
SCThingType,
|
||||
SCThingWithoutReferences,
|
||||
} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
@@ -23,8 +27,7 @@ import {SCRoomWithoutReferences} from './room';
|
||||
/**
|
||||
* A floor without references
|
||||
*/
|
||||
export interface SCFloorWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCFloorWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
||||
*
|
||||
@@ -54,8 +57,7 @@ export interface SCFloorWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCFloor
|
||||
extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Translated fields of a floor
|
||||
*/
|
||||
@@ -70,8 +72,7 @@ export interface SCFloor
|
||||
/**
|
||||
* A feature collection
|
||||
*/
|
||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
|
||||
extends FeatureCollection<T> {
|
||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject> extends FeatureCollection<T> {
|
||||
/**
|
||||
* Features of the collection
|
||||
*/
|
||||
@@ -82,7 +83,7 @@ export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
|
||||
* A feature with a place
|
||||
*/
|
||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
|
||||
// tslint:disable-next-line:no-any TODO
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
extends Feature<T, any> {
|
||||
/**
|
||||
* The place of the feature
|
||||
@@ -93,8 +94,7 @@ export interface SCFloorFeatureWithPlace<T extends GeometryObject>
|
||||
/**
|
||||
* Translatable properties of a floor
|
||||
*/
|
||||
export interface SCFloorTranslatableProperties
|
||||
extends SCThingTranslatableProperties {
|
||||
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
|
||||
/**
|
||||
* Translation of the floor name
|
||||
*
|
||||
@@ -106,22 +106,18 @@ export interface SCFloorTranslatableProperties
|
||||
/**
|
||||
* Meta information about floors
|
||||
*/
|
||||
export class SCFloorMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCFloor> {
|
||||
export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFloor> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
plan: 'Grundriss',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
floorName: 'floor name',
|
||||
plan: 'plan',
|
||||
},
|
||||
@@ -132,13 +128,11 @@ export class SCFloorMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Etage',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Floor,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -22,19 +22,46 @@ import {
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCUserGroup} from './abstract/user-groups';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
|
||||
/**
|
||||
* Categories of a message
|
||||
*/
|
||||
export type SCMessageCategories = 'news';
|
||||
|
||||
/**
|
||||
* A message without references
|
||||
*/
|
||||
export interface SCMessageWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Audience of the message
|
||||
* Organizational unit for which the message is intended
|
||||
*/
|
||||
audiences: SCMessageAudience[];
|
||||
audienceOrganizations?: SCOrganizationWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Roles for which the message is intended
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
audiences: SCUserGroup[];
|
||||
|
||||
/**
|
||||
* Categories of a message
|
||||
*/
|
||||
categories: SCMessageCategories[];
|
||||
|
||||
/**
|
||||
* When the message was created
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
dateCreated?: SCISO8601Date;
|
||||
|
||||
@@ -45,6 +72,11 @@ export interface SCMessageWithoutReferences
|
||||
*/
|
||||
messageBody: string;
|
||||
|
||||
/**
|
||||
* An index for applying a custom sorting of multiple messages
|
||||
*/
|
||||
sequenceIndex?: number;
|
||||
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
@@ -62,8 +94,7 @@ export interface SCMessageWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCMessage
|
||||
extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
/**
|
||||
* Translated fields of a message
|
||||
*/
|
||||
@@ -75,19 +106,12 @@ export interface SCMessage
|
||||
type: SCThingType.Message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Audiences for messages
|
||||
*/
|
||||
export type SCMessageAudience =
|
||||
'students'
|
||||
| 'employees'
|
||||
| 'guests';
|
||||
|
||||
/**
|
||||
* Translatable properties of a message
|
||||
*/
|
||||
export interface SCMessageTranslatableProperties
|
||||
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
extends SCCreativeWorkTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Message itself
|
||||
*
|
||||
@@ -99,26 +123,34 @@ export interface SCMessageTranslatableProperties
|
||||
/**
|
||||
* Meta information about messages
|
||||
*/
|
||||
export class SCMessageMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCMessage> {
|
||||
export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
audienceOrganizations: 'Zielgruppenorganisationen',
|
||||
audiences: 'Zielgruppen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
messageBody: 'Nachrichteninhalt',
|
||||
sequenceIndex: 'Sequenzindex',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
audienceOrganizations: 'audience organizations',
|
||||
audiences: 'audiences',
|
||||
dateCreated: 'date created',
|
||||
messageBody: 'message body',
|
||||
sequenceIndex: 'sequence index',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -127,18 +159,27 @@ export class SCMessageMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
audiences: {
|
||||
'employees': 'Angestellte',
|
||||
'guests': 'Gäste',
|
||||
'students': 'Studenten',
|
||||
employees: 'Angestellte',
|
||||
guests: 'Gäste',
|
||||
students: 'Studenten',
|
||||
},
|
||||
categories: {
|
||||
news: 'Neuigkeiten',
|
||||
},
|
||||
type: 'Nachricht',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCMessageCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -15,12 +15,12 @@
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
import {SCContactPointWithoutReferences} from './contact-point';
|
||||
|
||||
/**
|
||||
* An organization without references
|
||||
*/
|
||||
export interface SCOrganizationWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCOrganizationWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
@@ -33,8 +33,12 @@ export interface SCOrganizationWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCOrganization
|
||||
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* A list of contact points concerning the organization
|
||||
*/
|
||||
contactPoints?: SCContactPointWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Type of an organization
|
||||
*/
|
||||
@@ -44,17 +48,18 @@ export interface SCOrganization
|
||||
/**
|
||||
* Meta information about an organization
|
||||
*/
|
||||
export class SCOrganizationMeta
|
||||
extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
|
||||
export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslations<SCOrganization> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
contactPoints: 'Kontaktinformationen',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
contactPoints: 'contact details',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -63,11 +68,11 @@ export class SCOrganizationMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Einrichtung',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldValueTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Organization,
|
||||
},
|
||||
};
|
||||
|
||||
162
src/things/periodical.ts
Normal file
162
src/things/periodical.ts
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
|
||||
/**
|
||||
* Categories of a periodical
|
||||
*/
|
||||
export type SCPeriodicalCategories = 'journal' | 'electronic';
|
||||
|
||||
/**
|
||||
* A periodical without references
|
||||
*/
|
||||
export interface SCPeriodicalWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Categories of a periodical
|
||||
*/
|
||||
categories: SCPeriodicalCategories[];
|
||||
/**
|
||||
* A list of ISSNs of a periodical
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
ISSNs?: string[];
|
||||
|
||||
/**
|
||||
* Translated properties of a periodical
|
||||
*/
|
||||
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a periodical
|
||||
*/
|
||||
type: SCThingType.Periodical;
|
||||
}
|
||||
|
||||
/**
|
||||
* A publication published at regular intervals (e.g. a magazine or newspaper)
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPeriodical
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCPeriodicalWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a periodical
|
||||
*/
|
||||
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a periodical
|
||||
*/
|
||||
type: SCThingType.Periodical;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a periodical
|
||||
*/
|
||||
export interface SCPeriodicalTranslatableFields
|
||||
extends SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCCreativeWorkTranslatableProperties {}
|
||||
|
||||
/**
|
||||
* Meta information about a periodical
|
||||
*/
|
||||
export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<SCPeriodical> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
categories: 'Format',
|
||||
ISSNs: 'ISSN',
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
categories: 'format',
|
||||
ISSNs: 'ISSN',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
type: 'Periodikum',
|
||||
categories: {
|
||||
electronic: 'E-Journal',
|
||||
journal: 'Zeitschrift',
|
||||
},
|
||||
},
|
||||
en: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPeriodicalCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: 'periodical',
|
||||
categories: {
|
||||
electronic: 'E-Journal',
|
||||
journal: 'journal',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -16,6 +16,7 @@ import {SCMetaTranslations, SCNationality} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCBuildingWithoutReferences} from './building';
|
||||
import {SCContactPointWithoutReferences} from './contact-point';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
@@ -23,17 +24,19 @@ import {SCRoomWithoutReferences} from './room';
|
||||
/**
|
||||
* A person without references
|
||||
*/
|
||||
export interface SCPersonWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Additional first names of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
additionalName?: string;
|
||||
|
||||
/**
|
||||
* The birth date of the person.
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
birthDate?: SCISO8601Date;
|
||||
|
||||
@@ -41,7 +44,7 @@ export interface SCPersonWithoutReferences
|
||||
* The private email address of the person.
|
||||
*
|
||||
* @TJS-format email
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
@@ -49,32 +52,38 @@ export interface SCPersonWithoutReferences
|
||||
/**
|
||||
* The family name of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
familyName: string;
|
||||
familyName?: string;
|
||||
|
||||
/**
|
||||
* The private fax number of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* The gender of the person.
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
gender?: SCPersonGender;
|
||||
|
||||
/**
|
||||
* The first name of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
givenName: string;
|
||||
givenName?: string;
|
||||
|
||||
/**
|
||||
* Honorific prefix of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
honorificPrefix?: string;
|
||||
@@ -82,6 +91,7 @@ export interface SCPersonWithoutReferences
|
||||
/**
|
||||
* Honorific suffix of the person.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
honorificSuffix?: string;
|
||||
@@ -89,6 +99,7 @@ export interface SCPersonWithoutReferences
|
||||
/**
|
||||
* Titles of jobs that the person has.
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
jobTitles?: string[];
|
||||
@@ -96,6 +107,7 @@ export interface SCPersonWithoutReferences
|
||||
/**
|
||||
* The complete name of the person combining all the parts of the name into one.
|
||||
*
|
||||
* @filterable
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
@@ -124,8 +136,7 @@ export interface SCPersonWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPerson
|
||||
extends SCPersonWithoutReferences, SCThing {
|
||||
export interface SCPerson extends SCPersonWithoutReferences, SCThing {
|
||||
/**
|
||||
* Organization the person works for
|
||||
*/
|
||||
@@ -134,9 +145,9 @@ export interface SCPerson
|
||||
/**
|
||||
* A list of homes of the person
|
||||
*/
|
||||
homeLocations?: Array<SCBuildingWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences>;
|
||||
homeLocations?: Array<
|
||||
SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences
|
||||
>;
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
@@ -146,21 +157,19 @@ export interface SCPerson
|
||||
/**
|
||||
* Locations where the person performs her/his work
|
||||
*/
|
||||
workLocations?: SCContactPoint[];
|
||||
workLocations?: SCContactPointWithoutReferences[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a person
|
||||
*/
|
||||
export class SCPersonMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPerson> {
|
||||
export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPerson> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
additionalName: 'Zusatzname',
|
||||
affiliations: 'Zugehörigkeiten',
|
||||
birthDate: 'Geburtsdatum',
|
||||
@@ -175,13 +184,14 @@ export class SCPersonMeta
|
||||
jobTitles: 'Berufsbezeichnungen',
|
||||
nationality: 'Staatsangehörigkeit',
|
||||
telephone: 'Telefonnummer',
|
||||
workLocations: 'Arbeitsorte',
|
||||
workLocations: 'Arbeitsstandorte',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
additionalName: 'additional name',
|
||||
affiliations: 'affiliations',
|
||||
birthDate: 'birth date',
|
||||
contactDetails: 'contact details',
|
||||
email: 'email',
|
||||
familyName: 'family name',
|
||||
faxNumber: 'fax',
|
||||
@@ -202,74 +212,23 @@ export class SCPersonMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
gender: {
|
||||
'female': 'weiblich',
|
||||
'inter': 'divers',
|
||||
'male': 'männlich',
|
||||
'undefined': 'undefiniert',
|
||||
female: 'weiblich',
|
||||
inter: 'divers',
|
||||
male: 'männlich',
|
||||
undefined: 'undefiniert',
|
||||
},
|
||||
type: 'Person',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Person,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* Fax number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* Times available for contacting at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
hoursAvailable?: string;
|
||||
|
||||
/**
|
||||
* Contact number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* URL at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gender of a person
|
||||
*/
|
||||
export type SCPersonGender =
|
||||
'male'
|
||||
| 'female'
|
||||
| 'inter'
|
||||
| 'undefined';
|
||||
export type SCPersonGender = 'male' | 'female' | 'inter' | 'undefined';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -28,7 +28,10 @@ import {
|
||||
* A point of interest without references
|
||||
*/
|
||||
export interface SCPointOfInterestWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>,
|
||||
extends SCThingWithCategoriesWithoutReferences<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>,
|
||||
SCPlaceWithoutReferences {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
@@ -48,7 +51,9 @@ export interface SCPointOfInterestWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPointOfInterest
|
||||
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
||||
extends SCPointOfInterestWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCPlace,
|
||||
SCThingWithCategories<SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated properties of a point of interest
|
||||
@@ -65,7 +70,7 @@ export interface SCPointOfInterest
|
||||
* Categories of a point of interest
|
||||
*/
|
||||
export type SCPointOfInterestCategories =
|
||||
'computer'
|
||||
| 'computer'
|
||||
| 'validator'
|
||||
| 'card charger'
|
||||
| 'printer'
|
||||
@@ -74,26 +79,26 @@ export type SCPointOfInterestCategories =
|
||||
/**
|
||||
* Meta information about points of interest
|
||||
*/
|
||||
export class SCPointOfInterestMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPointOfInterest> {
|
||||
export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations<SCPointOfInterest> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -102,9 +107,11 @@ export class SCPointOfInterestMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'card charger': 'Kartenaufwerter',
|
||||
'computer': 'Computer',
|
||||
@@ -115,9 +122,11 @@ export class SCPointOfInterestMeta
|
||||
type: 'Sonderziel',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.PointOfInterest,
|
||||
},
|
||||
};
|
||||
|
||||
100
src/things/publication-event.ts
Normal file
100
src/things/publication-event.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType} from './abstract/thing';
|
||||
|
||||
/**
|
||||
* An publication event without references
|
||||
*/
|
||||
export interface SCPublicationEventWithoutReferences extends SCEventWithoutReferences {
|
||||
/**
|
||||
* All the locations related to the event (e.g. where a creative work was published)
|
||||
*/
|
||||
locations?: string[];
|
||||
|
||||
/**
|
||||
* An organization (or a person) that is publishing at the event
|
||||
*/
|
||||
publisher?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of an publication event
|
||||
*/
|
||||
translations?: SCTranslations<SCPublicationEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an publication event
|
||||
*/
|
||||
type: SCThingType.PublicationEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* An publication event
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPublicationEvent extends SCEvent, SCPublicationEventWithoutReferences {
|
||||
/**
|
||||
* Translated fields of an publication event
|
||||
*/
|
||||
translations?: SCTranslations<SCPublicationEventTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of an publication event
|
||||
*/
|
||||
type: SCThingType.PublicationEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of an publication event
|
||||
*/
|
||||
export type SCPublicationEventTranslatableProperties = SCThingTranslatableProperties;
|
||||
|
||||
/**
|
||||
* Meta information about publication events
|
||||
*/
|
||||
export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTranslations<SCPublicationEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
locations: 'Erscheinungsorte',
|
||||
publisher: 'Verlag',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldTranslations.en,
|
||||
locations: 'places of publication',
|
||||
publisher: 'publisher',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
type: 'Veröffentlichung',
|
||||
},
|
||||
en: {
|
||||
...new SCEventMeta().fieldValueTranslations.en,
|
||||
type: 'publication event',
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
* Categories of a room
|
||||
*/
|
||||
export type SCRoomCategories =
|
||||
'cafe'
|
||||
| 'cafe'
|
||||
| 'canteen'
|
||||
| 'computer'
|
||||
| 'education'
|
||||
@@ -53,11 +53,13 @@ export type SCRoomCategories =
|
||||
* A room without references
|
||||
*/
|
||||
export interface SCRoomWithoutReferences
|
||||
extends SCPlaceWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferences,
|
||||
extends SCPlaceWithoutReferences,
|
||||
SCThingThatAcceptsPaymentsWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
||||
/**
|
||||
* The name of the floor in which the room is in.
|
||||
*
|
||||
* @filterable
|
||||
* @text
|
||||
*/
|
||||
floorName?: string;
|
||||
@@ -87,7 +89,10 @@ export interface SCRoomWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCRoom
|
||||
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
|
||||
extends SCRoomWithoutReferences,
|
||||
SCThingInPlace,
|
||||
SCThingThatAcceptsPayments,
|
||||
SCPlace,
|
||||
SCThingWithCategories<SCRoomCategories, SCRoomSpecificValues> {
|
||||
/**
|
||||
* Translations of specific values of the object
|
||||
@@ -105,8 +110,7 @@ export interface SCRoom
|
||||
/**
|
||||
* Category specific values of a room
|
||||
*/
|
||||
export interface SCRoomSpecificValues
|
||||
extends SCThingWithCategoriesSpecificValues {
|
||||
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
|
||||
/**
|
||||
* Category specific opening hours of the room
|
||||
*
|
||||
@@ -118,32 +122,26 @@ export interface SCRoomSpecificValues
|
||||
/**
|
||||
* Meta information about a place
|
||||
*/
|
||||
export class SCRoomMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCRoom> {
|
||||
export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
inventory: 'Bestand',
|
||||
},
|
||||
en: {
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
floorName: 'floor name',
|
||||
inventory: 'inventory',
|
||||
},
|
||||
@@ -154,13 +152,11 @@ export class SCRoomMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldValueTranslations.de,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
categories: {
|
||||
'cafe': 'Café',
|
||||
'canteen': 'Kantine',
|
||||
@@ -179,13 +175,11 @@ export class SCRoomMeta
|
||||
type: 'Raum',
|
||||
},
|
||||
en: {
|
||||
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
||||
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
|
||||
SCRoomSpecificValues>().fieldValueTranslations.en,
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<SCRoomCategories, SCRoomSpecificValues>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Room,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -23,12 +23,12 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
/**
|
||||
* A semester without references
|
||||
*/
|
||||
export interface SCSemesterWithoutReferences
|
||||
extends SCAcademicTermWithoutReferences {
|
||||
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
|
||||
/**
|
||||
* The short name of the semester, using the given pattern.
|
||||
*
|
||||
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
|
||||
* @filterable
|
||||
* @pattern ^(WS|SS|WiSe|SoSe) [0-9]{4}(/[0-9]{2})?$
|
||||
* @keyword
|
||||
*/
|
||||
acronym: string;
|
||||
@@ -45,8 +45,7 @@ export interface SCSemesterWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSemester
|
||||
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||
export interface SCSemester extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||
/**
|
||||
* Type of the semester
|
||||
*/
|
||||
@@ -56,15 +55,13 @@ export interface SCSemester
|
||||
/**
|
||||
* Meta information about a semester
|
||||
*/
|
||||
export class SCSemesterMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCSemester> {
|
||||
export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.de,
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.de,
|
||||
acronym: 'Abkürzung',
|
||||
endDate: 'Ende',
|
||||
eventsEndDate: 'Vorlesungsschluss',
|
||||
@@ -72,7 +69,7 @@ export class SCSemesterMeta
|
||||
startDate: 'Beginn',
|
||||
},
|
||||
en: {
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.en,
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.en,
|
||||
acronym: 'acronym',
|
||||
endDate: 'end date',
|
||||
eventsEndDate: 'semester ending',
|
||||
@@ -86,13 +83,11 @@ export class SCSemesterMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
type: 'Semester',
|
||||
},
|
||||
en: {
|
||||
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Semester,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCThingWithCategories,
|
||||
@@ -21,16 +21,13 @@ import {
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from './abstract/thing-with-categories';
|
||||
import {SCUserGroup} from './abstract/user-groups';
|
||||
|
||||
/**
|
||||
* A setting without references
|
||||
*/
|
||||
export interface SCSettingWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Categories of a setting
|
||||
*/
|
||||
categories: SCSettingCategories[];
|
||||
/**
|
||||
* The default value of a setting
|
||||
*/
|
||||
@@ -66,11 +63,7 @@ export interface SCSettingWithoutReferences
|
||||
/**
|
||||
* A list of categories for settings
|
||||
*/
|
||||
export type SCSettingCategories =
|
||||
'profile'
|
||||
| 'privacy'
|
||||
| 'credentials'
|
||||
| 'others';
|
||||
export type SCSettingCategories = 'profile' | 'privacy' | 'credentials' | 'others';
|
||||
|
||||
/**
|
||||
* The types of input/value a setting object can carry
|
||||
@@ -87,10 +80,10 @@ export enum SCSettingInputType {
|
||||
* A setting with references
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSetting
|
||||
extends SCSettingWithoutReferences, SCThing,
|
||||
extends SCSettingWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a setting
|
||||
@@ -133,8 +126,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.de,
|
||||
defaultValue: 'Standard Wert',
|
||||
inputType: 'Eingabetyp',
|
||||
order: 'Position',
|
||||
@@ -142,8 +137,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
values: 'Werte',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldTranslations.en,
|
||||
defaultValue: 'default value',
|
||||
inputType: 'input type',
|
||||
order: 'position',
|
||||
@@ -157,8 +154,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.de,
|
||||
categories: {
|
||||
credentials: 'Anmeldedaten',
|
||||
others: 'Andere',
|
||||
@@ -167,17 +166,71 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
},
|
||||
inputType: {
|
||||
'multiple choice': 'mehrfach Auswahl',
|
||||
number: 'Zahl',
|
||||
password: 'Passwort',
|
||||
'number': 'Zahl',
|
||||
'password': 'Passwort',
|
||||
'single choice': 'einfache Auswahl',
|
||||
text: 'Text',
|
||||
'text': 'Text',
|
||||
},
|
||||
type: 'Einstellung',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
SCThingWithCategoriesSpecificValues
|
||||
>().fieldValueTranslations.en,
|
||||
type: SCThingType.Setting,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A user group setting
|
||||
*/
|
||||
export interface SCUserGroupSetting extends SCSetting {
|
||||
/**
|
||||
* Exact categories of the setting
|
||||
*/
|
||||
categories: ['profile'];
|
||||
/**
|
||||
* The default value of the setting
|
||||
*/
|
||||
defaultValue: SCUserGroup;
|
||||
/**
|
||||
* Specific name of the setting
|
||||
*/
|
||||
name: 'group';
|
||||
/**
|
||||
* Chosen value of the setting
|
||||
*/
|
||||
value?: SCUserGroup;
|
||||
/**
|
||||
* The possible values of the setting
|
||||
*/
|
||||
values: SCUserGroup[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A language setting
|
||||
*/
|
||||
export interface SCLanguageSetting extends SCSetting {
|
||||
/**
|
||||
* Exact categories of the setting
|
||||
*/
|
||||
categories: ['profile'];
|
||||
/**
|
||||
* The default value of the setting
|
||||
*/
|
||||
defaultValue: SCLanguageCode;
|
||||
/**
|
||||
* Specific name of the setting
|
||||
*/
|
||||
name: 'language';
|
||||
/**
|
||||
* Chosen value of the setting
|
||||
*/
|
||||
value?: SCLanguageCode;
|
||||
/**
|
||||
* The possible values of the setting
|
||||
*/
|
||||
values: SCLanguageCode[];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,8 +19,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
/**
|
||||
* A sport course without references
|
||||
*/
|
||||
export interface SCSportCourseWithoutReferences
|
||||
extends SCEventWithoutReferences {
|
||||
export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
@@ -33,8 +32,7 @@ export interface SCSportCourseWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSportCourse
|
||||
extends SCEvent, SCSportCourseWithoutReferences {
|
||||
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
|
||||
/**
|
||||
* Type of a sport course
|
||||
*/
|
||||
@@ -44,18 +42,16 @@ export interface SCSportCourse
|
||||
/**
|
||||
* Meta information about a sport course
|
||||
*/
|
||||
export class SCSportCourseMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCSportCourse> {
|
||||
export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations<SCSportCourse> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
||||
...new SCEventMeta().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -64,11 +60,11 @@ export class SCSportCourseMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
type: 'Sportkurs',
|
||||
},
|
||||
en: {
|
||||
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
||||
...new SCEventMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.SportCourse,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -29,9 +29,7 @@ import {SCPersonWithoutReferences} from './person';
|
||||
/**
|
||||
* A study module without references
|
||||
*/
|
||||
export interface SCStudyModuleWithoutReferences
|
||||
extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
|
||||
export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* ECTS points (European Credit Transfer System)
|
||||
*
|
||||
@@ -47,6 +45,7 @@ export interface SCStudyModuleWithoutReferences
|
||||
/**
|
||||
* Majors that this study module is meant for
|
||||
*
|
||||
* @filterable
|
||||
* @keyword
|
||||
*/
|
||||
majors: string[];
|
||||
@@ -74,7 +73,8 @@ export interface SCStudyModuleWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCStudyModule
|
||||
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
extends SCStudyModuleWithoutReferences,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Academic events that make up a study module
|
||||
*/
|
||||
@@ -112,8 +112,7 @@ export interface SCStudyModule
|
||||
type: SCThingType.StudyModule;
|
||||
}
|
||||
|
||||
export interface SCStudyModuleTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
export interface SCStudyModuleTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
/**
|
||||
* Translations of the majors that this study module is meant for
|
||||
*
|
||||
@@ -141,17 +140,14 @@ export enum SCStudyModuleNecessity {
|
||||
/**
|
||||
* Study module meta data
|
||||
*/
|
||||
export class SCStudyModuleMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCStudyModule> {
|
||||
export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations<SCStudyModule> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
academicEvents: 'Veranstaltungen',
|
||||
ects: 'ECTS-Punkte',
|
||||
faculty: 'Fachbereich',
|
||||
@@ -163,9 +159,8 @@ export class SCStudyModuleMeta
|
||||
secretary: 'Sekretariat',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance().fieldTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
academicEvents: 'academic events',
|
||||
ects: 'ECTS points',
|
||||
faculty: 'faculty',
|
||||
@@ -183,20 +178,18 @@ export class SCStudyModuleMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
necessity: {
|
||||
'elective': 'Wahlfach',
|
||||
'optional': 'optional',
|
||||
'required': 'benötigt',
|
||||
elective: 'Wahlfach',
|
||||
optional: 'optional',
|
||||
required: 'benötigt',
|
||||
},
|
||||
type: 'Studiengangmodul',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.StudyModule,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -20,8 +20,7 @@ import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
||||
/**
|
||||
* A ticket without references
|
||||
*/
|
||||
export interface SCTicketWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCTicketWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Approximate wait time
|
||||
*/
|
||||
@@ -51,8 +50,7 @@ export interface SCTicketWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCTicket
|
||||
extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Type of a ticket
|
||||
*/
|
||||
@@ -62,23 +60,19 @@ export interface SCTicket
|
||||
/**
|
||||
* Meta information about a ticket
|
||||
*/
|
||||
export class SCTicketMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCTicket> {
|
||||
export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTicket> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.de,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
approxWaitingTime: 'ungefähre Wartezeit',
|
||||
currentTicketNumber: 'aktuelle Ticketnummer',
|
||||
serviceType: 'Service Kategorie',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
||||
.en,
|
||||
...new SCThingInPlaceMeta().fieldTranslations.en,
|
||||
approxWaitingTime: 'approximate waiting time',
|
||||
currentTicketNumber: 'current ticket number',
|
||||
serviceType: 'type of service',
|
||||
@@ -90,13 +84,11 @@ export class SCTicketMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Ticket',
|
||||
},
|
||||
en: {
|
||||
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Ticket,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -35,6 +35,8 @@ export interface SCToDoWithoutReferences
|
||||
|
||||
/**
|
||||
* A date when the "to do" is due
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
dueDate?: SCISO8601Date;
|
||||
|
||||
@@ -56,7 +58,9 @@ export interface SCToDoWithoutReferences
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCToDo
|
||||
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
||||
extends SCToDoWithoutReferences,
|
||||
SCThing,
|
||||
SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
||||
/**
|
||||
* Translated fields of a thing with categories
|
||||
*/
|
||||
@@ -86,15 +90,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldTranslations.de,
|
||||
done: 'Erledigt',
|
||||
dueDate: 'Fälligkeitsdatum',
|
||||
priority: 'Priorität',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldTranslations.en,
|
||||
done: 'done',
|
||||
dueDate: 'due date',
|
||||
priority: 'priority',
|
||||
@@ -106,13 +110,13 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldValueTranslations.de,
|
||||
type: 'ToDo',
|
||||
},
|
||||
en: {
|
||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldValueTranslations.en,
|
||||
type: SCThingType.ToDo,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs
|
||||
/**
|
||||
* A tour without references
|
||||
*/
|
||||
export interface SCTourWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
export interface SCTourWithoutReferences extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Init script for the tour
|
||||
*
|
||||
@@ -29,8 +28,6 @@ export interface SCTourWithoutReferences
|
||||
|
||||
/**
|
||||
* Steps of a tour
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
steps: SCTourStep[];
|
||||
|
||||
@@ -48,8 +45,7 @@ export interface SCTourWithoutReferences
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCTour
|
||||
extends SCTourWithoutReferences, SCThing {
|
||||
export interface SCTour extends SCTourWithoutReferences, SCThing {
|
||||
/**
|
||||
* Type of a tour
|
||||
*/
|
||||
@@ -59,20 +55,18 @@ export interface SCTour
|
||||
/**
|
||||
* Meta information about a tour
|
||||
*/
|
||||
export class SCTourMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCTour> {
|
||||
export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
init: 'Initiales Skript',
|
||||
steps: 'Schritte',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
...new SCThingMeta().fieldTranslations.en,
|
||||
init: 'initial script',
|
||||
steps: 'steps',
|
||||
},
|
||||
@@ -83,11 +77,11 @@ export class SCTourMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Tour',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
...new SCThingMeta().fieldValueTranslations.en,
|
||||
type: SCThingType.Tour,
|
||||
},
|
||||
};
|
||||
@@ -96,10 +90,7 @@ export class SCTourMeta
|
||||
/**
|
||||
* A step in a tour
|
||||
*/
|
||||
export type SCTourStep =
|
||||
SCTourStepMenu
|
||||
| SCTourStepLocation
|
||||
| SCTourStepTooltip;
|
||||
export type SCTourStep = SCTourStepMenu | SCTourStepLocation | SCTourStepTooltip;
|
||||
|
||||
/**
|
||||
* A location of a tour step
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,17 +12,30 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLanguage, SCMetaTranslations} from '../general/i18n';
|
||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||
import {SCISO8601Duration} from '../general/time';
|
||||
import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from './abstract/creative-work';
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from './abstract/creative-work';
|
||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedMeta,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
SCThingThatCanBeOfferedWithoutReferences,
|
||||
} from './abstract/thing-that-can-be-offered';
|
||||
import {SCPersonWithoutReferences} from './person';
|
||||
|
||||
/**
|
||||
* A video without references
|
||||
*/
|
||||
export interface SCVideoWithoutReferences
|
||||
extends SCCreativeWorkWithoutReferences {
|
||||
extends SCCreativeWorkWithoutReferences,
|
||||
SCThingThatCanBeOfferedWithoutReferences {
|
||||
/**
|
||||
* The Duration of the Video
|
||||
*/
|
||||
@@ -52,6 +65,11 @@ export interface SCVideoWithoutReferences
|
||||
*/
|
||||
transcript?: string;
|
||||
|
||||
/**
|
||||
* Translated fields of a video
|
||||
*/
|
||||
translations?: SCTranslations<SCVideoTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of an Video
|
||||
*/
|
||||
@@ -68,6 +86,8 @@ export interface SCVideoSource {
|
||||
|
||||
/**
|
||||
* MIME-Type of the source File
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
mimeType: SCVideoMimeType;
|
||||
|
||||
@@ -101,6 +121,8 @@ export interface SCVideoTrack {
|
||||
|
||||
/**
|
||||
* Content Type of the Track File
|
||||
*
|
||||
* @filterable
|
||||
*/
|
||||
type: SCVideoTrackTypes;
|
||||
|
||||
@@ -119,31 +141,43 @@ export interface SCVideoTrack {
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCVideo
|
||||
extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
extends SCCreativeWork,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||
SCVideoWithoutReferences {
|
||||
/**
|
||||
* Persons acting in the Video
|
||||
*/
|
||||
actors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a video
|
||||
*/
|
||||
translations?: SCTranslations<SCVideoTranslatableFields>;
|
||||
|
||||
/**
|
||||
* Type of a video
|
||||
*/
|
||||
type: SCThingType.Video;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of a video
|
||||
*/
|
||||
export interface SCVideoTranslatableFields
|
||||
extends SCCreativeWorkTranslatableProperties,
|
||||
SCThingThatCanBeOfferedTranslatableProperties {}
|
||||
|
||||
/**
|
||||
* Meta information about a video
|
||||
*/
|
||||
export class SCVideoMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCVideo> {
|
||||
export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVideo> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.de,
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
actors: 'Darsteller',
|
||||
duration: 'Dauer',
|
||||
sources: 'Quellen',
|
||||
@@ -152,8 +186,8 @@ export class SCVideoMeta
|
||||
transcript: 'Transkript',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||
.en,
|
||||
...new SCCreativeWorkMeta().fieldTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.en,
|
||||
actors: 'actors',
|
||||
duration: 'duration',
|
||||
sources: 'sources',
|
||||
@@ -168,13 +202,13 @@ export class SCVideoMeta
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.de,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
type: 'Video',
|
||||
},
|
||||
en: {
|
||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||
.fieldValueTranslations.en,
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.en,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.en,
|
||||
type: SCThingType.Video,
|
||||
},
|
||||
};
|
||||
@@ -184,7 +218,7 @@ export class SCVideoMeta
|
||||
* Video Encoding Formats
|
||||
*/
|
||||
export type SCVideoMimeType =
|
||||
'video/mp4'
|
||||
| 'video/mp4'
|
||||
| 'video/ogg'
|
||||
| 'video/webm'
|
||||
| 'application/vnd.apple.mpegurl'
|
||||
@@ -193,9 +227,4 @@ export type SCVideoMimeType =
|
||||
/**
|
||||
* Video Track Types
|
||||
*/
|
||||
export type SCVideoTrackTypes =
|
||||
'closed captions'
|
||||
| 'chapters'
|
||||
| 'description'
|
||||
| 'metadata'
|
||||
| 'subtitles';
|
||||
export type SCVideoTrackTypes = 'closed captions' | 'chapters' | 'description' | 'metadata' | 'subtitles';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2019-2022 Open StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,28 +13,47 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import clone = require('fast-clone');
|
||||
import {Defined, OCType} from 'ts-optchain';
|
||||
import {SCTranslations} from './general/i18n';
|
||||
import equal = require('fast-deep-equal/es6');
|
||||
import clone = require('rfdc');
|
||||
import {Defined, TSOCType} from 'ts-optchain';
|
||||
import {SCLanguageCode} from './general/i18n';
|
||||
import {isThing} from './guards';
|
||||
import {SCClasses} from './meta';
|
||||
import {SCThing, SCThingType} from './things/abstract/thing';
|
||||
|
||||
// tslint:disable:no-any
|
||||
// eslint disable @typescript-eslint/no-explicit-any
|
||||
const standardCacheSize = 200;
|
||||
|
||||
/**
|
||||
* SCThingTranslator class
|
||||
*/
|
||||
export class SCThingTranslator {
|
||||
/**
|
||||
* Getter for language property
|
||||
*/
|
||||
get language(): SCLanguageCode {
|
||||
return this._language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for language property. Also flushes translation cache
|
||||
*
|
||||
* @param language The language the translator instance will use from now on
|
||||
*/
|
||||
set language(language: SCLanguageCode) {
|
||||
if (language !== this._language) {
|
||||
this.cache.flush();
|
||||
}
|
||||
this._language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Property representing the translators target language
|
||||
*/
|
||||
private _language: keyof SCTranslations<SCThing>;
|
||||
private _language: SCLanguageCode;
|
||||
|
||||
/**
|
||||
* Property representing the translators base language
|
||||
* This means every translation is given for this language
|
||||
* LRU cache containing already translated SCThings
|
||||
*/
|
||||
private readonly cache: LRUCache<SCThing>;
|
||||
|
||||
@@ -42,51 +62,44 @@ export class SCThingTranslator {
|
||||
*/
|
||||
private readonly metaClasses: typeof SCClasses;
|
||||
|
||||
/**
|
||||
* LRU cache containing SCThings translations have been provided for
|
||||
*/
|
||||
private readonly sourceCache: LRUCache<SCThing>;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* // returns translator instance for german
|
||||
* new SCThingTranslator('de');
|
||||
*/
|
||||
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = standardCacheSize) {
|
||||
constructor(language: SCLanguageCode, cacheCapacity: number = standardCacheSize) {
|
||||
this.cache = new LRUCache(cacheCapacity);
|
||||
this.sourceCache = new LRUCache(cacheCapacity);
|
||||
this._language = language;
|
||||
this.metaClasses = SCClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for language property
|
||||
*/
|
||||
get language(): keyof SCTranslations<SCThing> {
|
||||
return this._language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for language property. Also flushes translation cache
|
||||
*
|
||||
* @param language The language the translator instance will use from now on
|
||||
*/
|
||||
set language(language: keyof SCTranslations<SCThing>) {
|
||||
if (language !== this._language) {
|
||||
this.cache.flush();
|
||||
// Initalize all meta classes once
|
||||
if (typeof (this.metaClasses as any)[Object.keys(this.metaClasses)[0]] === 'function') {
|
||||
for (const metaClass of Object.keys(this.metaClasses)) {
|
||||
(this.metaClasses as any)[metaClass] = new (SCClasses as any)[metaClass]();
|
||||
}
|
||||
}
|
||||
this._language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field value translation recursively
|
||||
*
|
||||
* @param data The intermediate object / primitive returned by the Proxys get() method
|
||||
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
|
||||
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
|
||||
*/
|
||||
// tslint:disable-next-line:prefer-function-over-method
|
||||
private deeptranslate<T>(data?: T): OCType<T> {
|
||||
private deeptranslate<T>(data?: T): TSOCType<T> {
|
||||
const proxy = new Proxy(
|
||||
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
|
||||
((defaultValue?: Defined<T>) => (data == undefined ? defaultValue : data)) as TSOCType<T>,
|
||||
{
|
||||
get: (target, key) => {
|
||||
const obj: any = target();
|
||||
const object: any = target();
|
||||
|
||||
return this.deeptranslate(obj[key]);
|
||||
return this.deeptranslate(object[key]);
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -101,8 +114,7 @@ export class SCThingTranslator {
|
||||
* @param language The language the thing property values are translated to
|
||||
* @returns The thing with all known meta values translated
|
||||
*/
|
||||
private getAllMetaFieldTranslations<T extends SCThing>(thingType: SCThingType,
|
||||
language: keyof SCTranslations<T>): object | undefined {
|
||||
private getAllMetaFieldTranslations(thingType: SCThingType, language: SCLanguageCode): object | undefined {
|
||||
const fieldTranslations = {};
|
||||
const metaClass = this.getMetaClassInstance(thingType);
|
||||
if (typeof metaClass === 'undefined') {
|
||||
@@ -111,18 +123,16 @@ export class SCThingTranslator {
|
||||
|
||||
// Assigns every property in fieldTranslations to the known base language translation
|
||||
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
|
||||
Object.keys(metaClass.fieldTranslations.en)
|
||||
.forEach((key) => {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
|
||||
});
|
||||
for (const key of Object.keys(metaClass.fieldTranslations.en)) {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
|
||||
}
|
||||
}
|
||||
|
||||
// Assigns every property in fieldTranslations to the known translation in given language
|
||||
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
|
||||
Object.keys(metaClass.fieldTranslations[language])
|
||||
.forEach((key) => {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
|
||||
});
|
||||
for (const key of Object.keys(metaClass.fieldTranslations[language])) {
|
||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
|
||||
}
|
||||
}
|
||||
|
||||
return fieldTranslations;
|
||||
@@ -136,7 +146,7 @@ export class SCThingTranslator {
|
||||
*/
|
||||
private getMetaClassInstance(thingType: SCThingType): any {
|
||||
if (thingType in this.metaClasses) {
|
||||
return new (this.metaClasses as any)[thingType]();
|
||||
return this.metaClasses[thingType];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -146,63 +156,127 @@ export class SCThingTranslator {
|
||||
* Applies known field value translations of the given SCThings meta class to an instance
|
||||
* Translated values overwrite current values inplace (destructive)
|
||||
*
|
||||
* @param language The language the thing is translated to
|
||||
* @param thing The thing that will be translated
|
||||
* @param instance The thing / object that will be translated
|
||||
* @param language The language the thing / object is translated to
|
||||
* @returns The thing with translated meta field values
|
||||
*/
|
||||
private replaceAvailableMetaFieldValueTranslations(instance: any,
|
||||
language: keyof SCTranslations<any>): any {
|
||||
private replaceAvailableMetaFieldValueTranslations(instance: any, language: SCLanguageCode): any {
|
||||
const metaClass = this.getMetaClassInstance(instance.type);
|
||||
if (typeof metaClass === 'undefined') {
|
||||
return instance;
|
||||
}
|
||||
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
|
||||
Object.keys(metaClass.fieldValueTranslations[language])
|
||||
.forEach((key) => {
|
||||
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
|
||||
// Assigns known translations of subproperties to property in given language (e.g. categories)
|
||||
Object.keys((instance as any)[key])
|
||||
.forEach((subKey) => {
|
||||
(instance as any)[key][subKey] =
|
||||
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
|
||||
});
|
||||
} else {
|
||||
// Assigns property to known translation of fieldValueTranslations in given language
|
||||
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
|
||||
for (const key of Object.keys(metaClass.fieldValueTranslations[language])) {
|
||||
if (
|
||||
metaClass.fieldValueTranslations[language][key] instanceof Object &&
|
||||
(instance as any)[key] instanceof Object
|
||||
) {
|
||||
// Assigns known translations of subproperties to property in given language (e.g. categories)
|
||||
for (const subKey of Object.keys((instance as any)[key])) {
|
||||
(instance as any)[key][subKey] =
|
||||
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
|
||||
}
|
||||
});
|
||||
} else if (
|
||||
metaClass.fieldValueTranslations[language][key] instanceof Object &&
|
||||
typeof (instance as any)[key] === 'string'
|
||||
) {
|
||||
// Assigns known translations of enum to property in given language (e.g. SCSettingInputType)
|
||||
(instance as any)[key] = metaClass.fieldValueTranslations[language][key][(instance as any)[key]];
|
||||
} else {
|
||||
// Assigns property to known translation of fieldValueTranslations in given language
|
||||
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively translates the given object in-place
|
||||
* Translated values overwrite current values (destructive)
|
||||
*
|
||||
* @param instance The thing / object that will be translated
|
||||
* @returns The thing translated
|
||||
*/
|
||||
private translateThingInPlaceDestructively<T>(instance: T): T {
|
||||
const targetLanguage = this.language;
|
||||
|
||||
let nextInstance = instance as any;
|
||||
// Recursively call this function on all nested SCThings, arrays and objects
|
||||
for (const key of Object.keys(nextInstance)) {
|
||||
if (
|
||||
isThing(nextInstance[key]) ||
|
||||
Array.isArray(nextInstance[key]) ||
|
||||
nextInstance[key] instanceof Object
|
||||
) {
|
||||
nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Spread variable translations given by the connector into thing
|
||||
if (typeof nextInstance.translations?.[targetLanguage] !== 'undefined') {
|
||||
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as T;
|
||||
}
|
||||
// Spread known translations from meta classes into (partly) translated thing
|
||||
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
|
||||
|
||||
return nextInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively translates the given object in-place
|
||||
* Translated values overwrite current values (destructive)
|
||||
*
|
||||
* @param thing The thing / object that will be translated
|
||||
* @returns The thing translated
|
||||
*/
|
||||
public translate<T extends SCThing>(thing: T): T {
|
||||
if (equal(this.sourceCache.get(thing), thing)) {
|
||||
const cachedInstance = this.cache.get(thing);
|
||||
if (typeof cachedInstance !== 'undefined') {
|
||||
return cachedInstance as T;
|
||||
}
|
||||
}
|
||||
const translatedInstance = this.translateThingInPlaceDestructively(clone()(thing));
|
||||
delete translatedInstance.translations;
|
||||
this.cache.putObject(translatedInstance);
|
||||
this.sourceCache.putObject(thing);
|
||||
|
||||
return translatedInstance as T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field value translation recursively
|
||||
*
|
||||
* @example
|
||||
* const dish: SCDish = {...};
|
||||
* translator.translate(dish).offers[0].inPlace.categories[1]());
|
||||
* // or
|
||||
* const dishTranslatedAccess = translator.translate(dish);
|
||||
* dishTranslatedAccess.offers[0].inPlace.categories[1]();
|
||||
* // undoing the OCType<T>
|
||||
* // undoing the TSOCType<T>
|
||||
* const dishAsBefore: SCDish = dishTranslatedAccess()!;
|
||||
* @param data Top level object that gets passed through the recursion
|
||||
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
|
||||
* @param thing Top level object that gets passed through the recursion
|
||||
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
|
||||
*/
|
||||
public translate<T extends SCThing>(data: T): OCType<T> {
|
||||
public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> {
|
||||
return new Proxy(
|
||||
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
|
||||
((defaultValue?: Defined<T>) => (thing == undefined ? defaultValue : thing)) as TSOCType<T>,
|
||||
{
|
||||
get: (target, key) => {
|
||||
const obj: any = target();
|
||||
const objTranslatedFromCache = this.cache.get(data);
|
||||
if (typeof objTranslatedFromCache !== 'undefined') {
|
||||
return this.deeptranslate((objTranslatedFromCache as any)[key]);
|
||||
const object: any = target();
|
||||
if (equal(this.sourceCache.get(thing), thing)) {
|
||||
const objectTranslatedFromCache = this.cache.get(thing);
|
||||
if (typeof objectTranslatedFromCache !== 'undefined') {
|
||||
return this.deeptranslate((objectTranslatedFromCache as any)[key]);
|
||||
}
|
||||
}
|
||||
const objTranslated = this.translateWholeThingDestructively(clone(obj));
|
||||
this.cache.putObject(objTranslated);
|
||||
const objectTranslated = this.translateThingInPlaceDestructively(clone()(object));
|
||||
this.cache.putObject(objectTranslated);
|
||||
this.sourceCache.putObject(thing);
|
||||
|
||||
return this.deeptranslate(objTranslated[key]);
|
||||
return this.deeptranslate(objectTranslated[key]);
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -211,54 +285,35 @@ export class SCThingTranslator {
|
||||
/**
|
||||
* Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing
|
||||
* All the values will be set to the known translations of the property/key name
|
||||
*
|
||||
* @example
|
||||
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
||||
* @param language The language the object is translated to
|
||||
* @param thingType Type of the thing
|
||||
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudy>(SCThingType.CourseOfStudy);
|
||||
* @param type The type whose property names will be translated
|
||||
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
||||
*/
|
||||
public translatedPropertyNames<T extends SCThing>(thing: T,
|
||||
language?: keyof SCTranslations<T>): T | undefined {
|
||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||
|
||||
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
|
||||
public translatedPropertyNames<T extends SCThing>(type: SCThingType): T | undefined {
|
||||
return this.getAllMetaFieldTranslations(type, this.language) as T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively translates the given object in-place
|
||||
* Translated values overwrite current values (destructive)
|
||||
* Given a SCThingType and a corresponding property name it returns the known property value translation
|
||||
* Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional
|
||||
*
|
||||
* @param language The language the thing is translated to
|
||||
* @param thing The thing that will be translated
|
||||
* @returns The thing translated
|
||||
* @example
|
||||
* const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish');
|
||||
* @param type The type for whose property values a translation is required
|
||||
* @param field The property for which a translation is required
|
||||
* @param key If specified tries to access the field with this key
|
||||
* @returns Known translation for the property
|
||||
*/
|
||||
public translateWholeThingDestructively(instance: any,
|
||||
language?: keyof SCTranslations<any>): any {
|
||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||
let nextInstance = instance;
|
||||
// Recursively call this function on all nested SCThings, arrays and objects
|
||||
Object.keys(nextInstance)
|
||||
.forEach((key) => {
|
||||
if (
|
||||
isThing((nextInstance as any)[key]) ||
|
||||
nextInstance[key] instanceof Array ||
|
||||
nextInstance[key] instanceof Object) {
|
||||
nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage);
|
||||
}
|
||||
});
|
||||
public translatedPropertyValue(type: SCThingType, field: string, key?: string): string | undefined {
|
||||
const fieldValueTranslations =
|
||||
this.getMetaClassInstance(type).fieldValueTranslations[this.language] ??
|
||||
this.getMetaClassInstance(type).fieldValueTranslations.en;
|
||||
const fieldTranslation = fieldValueTranslations?.[field];
|
||||
|
||||
// Spread variable translations given by the connector into thing
|
||||
if (typeof nextInstance.translations !== 'undefined') {
|
||||
if (typeof nextInstance.translations![targetLanguage] !== 'undefined') {
|
||||
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as typeof instance;
|
||||
}
|
||||
}
|
||||
// Spread known translations from meta classes into (partly) translated thing
|
||||
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
|
||||
|
||||
return nextInstance;
|
||||
return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,8 +392,7 @@ class LRUCache<T> {
|
||||
public put(key: string, content: T) {
|
||||
if (this.entries.size >= this.maxEntries) {
|
||||
// LRU behavior
|
||||
const keyToDelete = this.entries.keys()
|
||||
.next().value;
|
||||
const keyToDelete = this.entries.keys().next().value;
|
||||
this.entries.delete(keyToDelete);
|
||||
}
|
||||
this.entries.set(key, content);
|
||||
@@ -350,6 +404,6 @@ class LRUCache<T> {
|
||||
* @param something The object that should be cached under something.uid
|
||||
*/
|
||||
public putObject<U extends SCThing>(something: U) {
|
||||
this.put(something.uid, (something as any) as T);
|
||||
this.put(something.uid, something as any as T);
|
||||
}
|
||||
}
|
||||
|
||||
44
test/compat.spec.ts
Normal file
44
test/compat.spec.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 {lightweightProjectFromPath} from '@openstapps/core-tools/lib/easy-ast/easy-ast';
|
||||
import {LightweightProject} from '@openstapps/core-tools/lib/easy-ast/types/lightweight-project';
|
||||
import {expect} from 'chai';
|
||||
import {reduce} from 'lodash';
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
describe('Mapping Compatibility', () => {
|
||||
let project: LightweightProject;
|
||||
|
||||
before(function () {
|
||||
this.timeout(15000);
|
||||
this.slow(10000);
|
||||
|
||||
project = lightweightProjectFromPath('src');
|
||||
});
|
||||
|
||||
it('non-exported definitions should not have duplicate names across files', () => {
|
||||
reduce(project, (result, file) => reduce(file, (result2, _, key) => {
|
||||
expect(result2[key]).to.be.undefined;
|
||||
return {
|
||||
[key]: true,
|
||||
...result2,
|
||||
};
|
||||
}, result), {} as Record<string, boolean>);
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user