Compare commits

...

14 Commits

Author SHA1 Message Date
Rainer Killinger
b71a30db1f 0.3.1 2022-09-02 16:11:17 +02:00
Rainer Killinger
43c469d66a refactor: update @openstapps/core 2022-09-02 15:56:04 +02:00
Rainer Killinger
608f58ccbf docs: update changelog 2022-08-24 12:31:02 +02:00
Rainer Killinger
dde4a0d1cd 0.3.0 2022-08-24 12:30:57 +02:00
Rainer Killinger
ba07267372 ci: enforce npm audit for production dependencies 2022-08-23 10:56:36 +02:00
Rainer Killinger
001cd4b4de refactor: update some dependencies 2022-08-23 10:56:35 +02:00
Rainer Killinger
c2b0d22a25 refactor: move to express-prom-bundle for monitoring 2022-08-23 10:56:32 +02:00
Jovan Krunić
9e1017edfb refactor: use material symbols for menu 2022-08-22 15:25:00 +00:00
Rainer Killinger
557d050b36 docs: update changelog 2022-08-22 17:16:31 +02:00
Rainer Killinger
6c64086fef 0.2.0 2022-08-22 17:16:13 +02:00
Rainer Killinger
5e8745e742 ci: add cobertura coverage report 2022-08-17 17:06:21 +02:00
openstappsbot
6e07041215 refactor: update all 2022-08-17 17:06:19 +02:00
Rainer Killinger
a20200e52a fix: update PAIA API URL 2022-08-09 13:07:41 +02:00
Rainer Killinger
903bfe1967 docs: update changelog 2022-06-30 16:02:54 +02:00
10 changed files with 1571 additions and 1195 deletions

View File

@@ -23,6 +23,12 @@ unit:
- build - build
script: script:
- npm run test-unit - npm run test-unit
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
integration: integration:
image: registry.gitlab.com/openstapps/projectmanagement/builder image: registry.gitlab.com/openstapps/projectmanagement/builder
@@ -44,10 +50,7 @@ audit:
dependencies: dependencies:
- build - build
script: script:
- npm audit - npm audit --production
allow_failure: true
except:
- schedules
pages: pages:
stage: deploy stage: deploy
@@ -60,13 +63,6 @@ pages:
paths: paths:
- public - public
scheduled-audit:
stage: audit
script:
- npm audit --audit-level=high
only:
- schedules
ci: ci:
stage: test stage: test
dependencies: dependencies:

84
CHANGELOG.md Normal file
View File

@@ -0,0 +1,84 @@
# [0.3.0](https://gitlab.com/openstapps/backend/compare/v0.2.0...v0.3.0) (2022-08-24)
# [0.2.0](https://gitlab.com/openstapps/backend/compare/v0.1.0...v0.2.0) (2022-08-22)
### Bug Fixes
* update PAIA API URL ([a20200e](https://gitlab.com/openstapps/backend/commit/a20200e52a725ede42cb5e026a5a693b1ba3d149))
# [0.1.0](https://gitlab.com/openstapps/backend/compare/16bbb7e9e36b7adf27452e1b09f7970e98aa27df...v0.1.0) (2022-06-30)
### Bug Fixes
* Add default configuration file for prometheus monitoring ([7ed2921](https://gitlab.com/openstapps/backend/commit/7ed2921efbce7fa5134206763eea986c6ef9a919))
* add prefix to schema names ([90822f5](https://gitlab.com/openstapps/backend/commit/90822f5888ed34d594b02df3f5cd9ec8ce74251e))
* apply correct types and tslint rules ([0cbf9b2](https://gitlab.com/openstapps/backend/commit/0cbf9b26a972563ad9483d78cea9ba809381f7dd))
* automatically remove invalid characters for aliases generated from index names ([6f7e23d](https://gitlab.com/openstapps/backend/commit/6f7e23df20af54abf2459da8aaebe236b82a5f1c))
* Don't force Mapping generation with 'npm start' ([4cfb560](https://gitlab.com/openstapps/backend/commit/4cfb560954ca97e22091e13d515475218885b1de))
* enhance default search query generation ([24a9122](https://gitlab.com/openstapps/backend/commit/24a91229f28fb17cb4941aab688a08266437c1eb))
* error thrown on consecutive connector executions ([2259da3](https://gitlab.com/openstapps/backend/commit/2259da317a848660fc2b0a14e50e2ae5ae329889)), closes [#73](https://gitlab.com/openstapps/backend/issues/73)
* esacpe mappin template filename ([496e6c5](https://gitlab.com/openstapps/backend/commit/496e6c5bd0563bd2dc0c6eff45c9bd685d95b453))
* fix markdown formatting in config ([9c5581a](https://gitlab.com/openstapps/backend/commit/9c5581af2cc131b81c288eadc39827124963ce55))
* fix reading url path as parameters ([9b889c8](https://gitlab.com/openstapps/backend/commit/9b889c873624d43baed4769a788db39528b143d8))
* imports from src in config files lead to crash ([f6003d7](https://gitlab.com/openstapps/backend/commit/f6003d7f8709d4424acd261cc7804e4d2684a9f4))
* invalid monthly cron execution time ([7a9f3ea](https://gitlab.com/openstapps/backend/commit/7a9f3eaca4667870ed19b17fd26c3c6d8e1fadd5))
* make config compatible with core, update database version ([f11376e](https://gitlab.com/openstapps/backend/commit/f11376ecf8c4997f6d0a85b3f3fde9e8b02bd61b))
* make facets work again ([d917627](https://gitlab.com/openstapps/backend/commit/d917627d588783d8734bd1d0c30d3d2782d02761))
* make index route work correctly ([fa2c9d7](https://gitlab.com/openstapps/backend/commit/fa2c9d7a881d9e94da8512349056b69206e4e3d0))
* properly check if an object exists before update ([e165837](https://gitlab.com/openstapps/backend/commit/e165837a154243305dc300acaa29605732290f6a)), closes [#70](https://gitlab.com/openstapps/backend/issues/70)
* remove onlyOnTypes from mustMatch ([1d5f99b](https://gitlab.com/openstapps/backend/commit/1d5f99b1fa74c486dc4df29daf9c0aa453935821)), closes [#83](https://gitlab.com/openstapps/backend/issues/83)
* replace isProductiveEnvironment with isTestEnvironment ([8c48552](https://gitlab.com/openstapps/backend/commit/8c48552abf7b7983e966ebc22299b334cae46167))
* return syntax error when receiving bad json ([12b71ba](https://gitlab.com/openstapps/backend/commit/12b71ba1f1f3e45a84b001b395dcfa1578355276)), closes [#3](https://gitlab.com/openstapps/backend/issues/3)
* return validation error instead of internal server error ([24e27c1](https://gitlab.com/openstapps/backend/commit/24e27c1d9e002db3b8f4afb4a31ad994c0eaad42))
* route for news ([7e35fae](https://gitlab.com/openstapps/backend/commit/7e35fae34e02bf2e12cf0d0b960d48de97fd4200))
* set config file before accessing it ([e17db52](https://gitlab.com/openstapps/backend/commit/e17db521e2a3f4f15dc5e5b758bd1ada10c78161)), closes [#27](https://gitlab.com/openstapps/backend/issues/27)
* stapps core version in config ([32c8a21](https://gitlab.com/openstapps/backend/commit/32c8a2149ad18179610af02483b794b426b7b9dc)), closes [#74](https://gitlab.com/openstapps/backend/issues/74)
* take coordinates in right order ([bb3be5a](https://gitlab.com/openstapps/backend/commit/bb3be5a816f7e4eb85b69ec558572bed9c3b6b39)), closes [#116](https://gitlab.com/openstapps/backend/issues/116)
* use SCRequestBodyTooLargeError ([e70e50a](https://gitlab.com/openstapps/backend/commit/e70e50a1eab00cd180479c5e0299f974da92fe94)), closes [#20](https://gitlab.com/openstapps/backend/issues/20)
* use specific time from filter if defined ([80e6249](https://gitlab.com/openstapps/backend/commit/80e62496f0731af721193875d5a6cdbf10b34607))
* wait for config file validation ([30082f8](https://gitlab.com/openstapps/backend/commit/30082f87262fa7428172fcbb6710b66d4bfe6261))
* wrong way alias names are generated ([9488451](https://gitlab.com/openstapps/backend/commit/94884510802906cdbfdd3490fac5fc9401937da7)), closes [#79](https://gitlab.com/openstapps/backend/issues/79)
### Features
* add backend ([16bbb7e](https://gitlab.com/openstapps/backend/commit/16bbb7e9e36b7adf27452e1b09f7970e98aa27df))
* add boosting to context based search ([dd4be92](https://gitlab.com/openstapps/backend/commit/dd4be92f90c6e7047eea0d00a2442b75673329f6))
* add catalog menu entry and rearrange ([4e42772](https://gitlab.com/openstapps/backend/commit/4e42772ca3788d3ee7af78266ee223e05fe6a8f3))
* add default app settings and menus ([54301ae](https://gitlab.com/openstapps/backend/commit/54301ae8fb656db17e231197c3a64fc27f541024))
* add dummy about config ([d6f126f](https://gitlab.com/openstapps/backend/commit/d6f126f19776ee7902e65d9248501b4986657ed9))
* add favorites to personal menu ([de0617b](https://gitlab.com/openstapps/backend/commit/de0617b8dd51182326094543110b8ed294a6e940))
* add feedback to config as menu item ([7ba6472](https://gitlab.com/openstapps/backend/commit/7ba647271efd87c422ce302bd5baf5760671e1a1))
* add functionality to register plugins via http ([3d51ccf](https://gitlab.com/openstapps/backend/commit/3d51ccfac26b2c3ad1271c29c1e736aaf7fcd88f)), closes [#2](https://gitlab.com/openstapps/backend/issues/2) [#37](https://gitlab.com/openstapps/backend/issues/37)
* add hebis proxy url ([ca1d244](https://gitlab.com/openstapps/backend/commit/ca1d2444e03aacad37219d93d657968b7a933f78)), closes [#120](https://gitlab.com/openstapps/backend/issues/120)
* add openapi docs generation to api ([614a1b1](https://gitlab.com/openstapps/backend/commit/614a1b1e9b3c525d5524065851689f793a4b3b4b))
* Add prometheus middleware to express ([b42e911](https://gitlab.com/openstapps/backend/commit/b42e911a117c59b2d70c1587f9e9b20a846e92d0))
* add routes doc generation to npm documentation script ([4a64f26](https://gitlab.com/openstapps/backend/commit/4a64f26e43979cdd4390bad796e1b7dc3f8c7027))
* add schedule route ([785813c](https://gitlab.com/openstapps/backend/commit/785813c3fb92bbebd7b07246bbcec77a9a4520e3))
* Add start-debug npm run script ([23eb1e2](https://gitlab.com/openstapps/backend/commit/23eb1e2263d2dd9d55f9a6ac5fca2a8fad7f1e84))
* add support for generated elasticsearch mappings ([8eab6b8](https://gitlab.com/openstapps/backend/commit/8eab6b8531d91d4569fe13743624f5ce91a7dc1e)), closes [#38](https://gitlab.com/openstapps/backend/issues/38)
* add support for multiple values in value filter ([de60311](https://gitlab.com/openstapps/backend/commit/de60311bd072db01eaf50965f3fdc307bfedc4c2))
* add support for new availability filter ([47f3232](https://gitlab.com/openstapps/backend/commit/47f3232f155a13ea39abb2aaaecafd54fa7d98ce))
* add support for range filters ([dc16974](https://gitlab.com/openstapps/backend/commit/dc169746e7fa0f50a1f969653043e5a4d5fa0f01))
* add support for range filters ([dcf7906](https://gitlab.com/openstapps/backend/commit/dcf7906f79f07d9cfee704454eedddb452a1f255))
* adjust to changes of SCFacet in core v0.12.0 ([2f13010](https://gitlab.com/openstapps/backend/commit/2f13010480b87a4a06634084033b3b0822eb78ee)), closes [#30](https://gitlab.com/openstapps/backend/issues/30)
* allow for searching illegal elasticsearch characters ([b629d05](https://gitlab.com/openstapps/backend/commit/b629d058eb64c7a785648fab0a7073eeaa37e895))
* boost academic terms dynamically ([13938ec](https://gitlab.com/openstapps/backend/commit/13938ecf211060a3f50747ac7fed343b71a6aa4b))
* log registration and removal of plugins ([006bbeb](https://gitlab.com/openstapps/backend/commit/006bbebe60b7f5015d80ac825622cefbc25cd959)), closes [#71](https://gitlab.com/openstapps/backend/issues/71)
* make backend work with automatically generated aggregations ([ba2c6f6](https://gitlab.com/openstapps/backend/commit/ba2c6f655c263f0b1d1e55b739adde0004bbf408))
* move EXTERNAL_REQUEST_TIMEOUT to config file ([5d6d4b5](https://gitlab.com/openstapps/backend/commit/5d6d4b53f01550365a330daecbcb4e0f6bdb8aef))
* move up and enable cors ([6483221](https://gitlab.com/openstapps/backend/commit/6483221b62d84c5871ee4ec82158f8b9ef1ed54e))
* support geo shape filter ([dd8a6b3](https://gitlab.com/openstapps/backend/commit/dd8a6b3abcc90c50a16167054e2f3cdcee40c863))
* use config file for maxRequestBodySize ([d110d60](https://gitlab.com/openstapps/backend/commit/d110d60123a28563fe0c58ab903f61255a9644a2))
* use config for MultiSearchRoute ([8278279](https://gitlab.com/openstapps/backend/commit/827827905b71c71dfa9299a9deb92a8c9cfc0e20))
* use new Elasticsearch package ([1bad092](https://gitlab.com/openstapps/backend/commit/1bad092185d989078badc66f9c138d2e1baa27e4))
* utilize api-cli for e2e integration test ([ce06e73](https://gitlab.com/openstapps/backend/commit/ce06e735bea379c9ad955a627e3e1cead37c85fe))

View File

@@ -3,19 +3,20 @@
import {SCAboutPageContentType, SCConfigFile, SCLanguageCode} from '@openstapps/core'; import {SCAboutPageContentType, SCConfigFile, SCLanguageCode} from '@openstapps/core';
import {RecursivePartial} from '@openstapps/logger/lib/common'; import {RecursivePartial} from '@openstapps/logger/lib/common';
const markdownSources: {[key in SCLanguageCode]?: { const markdownSources: {
/** [key in SCLanguageCode]?: {
* Privacy policy markdown /**
*/ * Privacy policy markdown
privacyPolicy?: string; */
/** privacyPolicy?: string;
* Terms and conditions markdown /**
*/ * Terms and conditions markdown
termsAndConditions?: string; */
}} = {en: {}, de: {}}; termsAndConditions?: string;
};
} = {en: {}, de: {}};
markdownSources.de!.privacyPolicy = markdownSources.de!.privacyPolicy = `
`
Diese Datenschutzerklärung dient zur Erfüllung der nach Artikel 13 EU DSGVO geforderten Informationspflicht bei Erhebung von Daten zum Zeitpunkt der Erhebung bei betroffenen Personen. Diese Datenschutzerklärung dient zur Erfüllung der nach Artikel 13 EU DSGVO geforderten Informationspflicht bei Erhebung von Daten zum Zeitpunkt der Erhebung bei betroffenen Personen.
# **Name und Anschrift des Verantwortlichen** # **Name und Anschrift des Verantwortlichen**
@@ -176,8 +177,7 @@ Pseudonymisierung gehören kann.</li>
</ol> </ol>
`; `;
markdownSources.de!.termsAndConditions = markdownSources.de!.termsAndConditions = `
`
<p>Stand: 04. November 2015</p> <p>Stand: 04. November 2015</p>
<p>Es gilt der jeweilige Datenschutz der Hochschule im jeweiligen Bundesland. Darüber hinaus gelten die folgenden Vereinbarungen. Mit der Installation erklären Sie sich bereit die folgenden Bedingungen zu akzeptieren. <br> <p>Es gilt der jeweilige Datenschutz der Hochschule im jeweiligen Bundesland. Darüber hinaus gelten die folgenden Vereinbarungen. Mit der Installation erklären Sie sich bereit die folgenden Bedingungen zu akzeptieren. <br>
</p> </p>
@@ -282,8 +282,7 @@ markdownSources.de!.termsAndConditions =
<p>Fragen oder Anmerkungen zu dieser AGB richten Sie bitte an: <a href="mailto:app@rz.uni-frankfurt.de">app@rz.uni-frankfurt.de</a></p> <p>Fragen oder Anmerkungen zu dieser AGB richten Sie bitte an: <a href="mailto:app@rz.uni-frankfurt.de">app@rz.uni-frankfurt.de</a></p>
`; `;
markdownSources.en!.privacyPolicy = markdownSources.en!.privacyPolicy = `
`
This data protection declaration serves to fulfill the information obligation required under Article 13 EU DSGVO when data is collected at the time of collection from data subjects. This data protection declaration serves to fulfill the information obligation required under Article 13 EU DSGVO when data is collected at the time of collection from data subjects.
# **Name and address of the responsible person** # **Name and address of the responsible person**
@@ -445,8 +444,7 @@ Pseudonymization may include.</li>
</ol> </ol>
`; `;
markdownSources.en!.termsAndConditions = markdownSources.en!.termsAndConditions = `
`
<p>As of November 04, 2015</p> <p>As of November 04, 2015</p>
<p>The respective data protection of the university in the respective federal state applies. In addition, the following agreements apply. By installing you agree to accept the following terms and conditions. <br> <p>The respective data protection of the university in the respective federal state applies. In addition, the following agreements apply. By installing you agree to accept the following terms and conditions. <br>
</p> </p>
@@ -551,7 +549,6 @@ markdownSources.en!.termsAndConditions =
<p>If you have any questions or comments about these terms and conditions, please contact: <a href="mailto:app@rz.uni-frankfurt.de">app@rz.uni-frankfurt.de</a></p> <p>If you have any questions or comments about these terms and conditions, please contact: <a href="mailto:app@rz.uni-frankfurt.de">app@rz.uni-frankfurt.de</a></p>
`; `;
/** /**
* This is the default configuration for the Goethe university of Frankfurt * This is the default configuration for the Goethe university of Frankfurt
*/ */
@@ -598,8 +595,7 @@ const config: RecursivePartial<SCConfigFile> = {
title: 'Über das StApps Projekt', title: 'Über das StApps Projekt',
content: [ content: [
{ {
title: title: 'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
content: { content: {
type: SCAboutPageContentType.MARKDOWN, type: SCAboutPageContentType.MARKDOWN,
value: ` value: `
@@ -622,8 +618,7 @@ const config: RecursivePartial<SCConfigFile> = {
}, },
translations: { translations: {
en: { en: {
title: title: 'Collaborative project of multiple universities for a single generic study app',
'Collaborative project of multiple universities for a single generic study app',
}, },
}, },
type: SCAboutPageContentType.SECTION, type: SCAboutPageContentType.SECTION,
@@ -649,8 +644,7 @@ const config: RecursivePartial<SCConfigFile> = {
Norbert-Wollheim-Platz 1<br> Norbert-Wollheim-Platz 1<br>
60629 Frankfurt 60629 Frankfurt
`, `,
translations: { translations: {},
},
type: SCAboutPageContentType.MARKDOWN, type: SCAboutPageContentType.MARKDOWN,
}, },
], ],
@@ -669,8 +663,7 @@ const config: RecursivePartial<SCConfigFile> = {
'[app@rz.uni-frankfurt.de](mailto:app@rz.uni-frankfurt.de)<br>' + '[app@rz.uni-frankfurt.de](mailto:app@rz.uni-frankfurt.de)<br>' +
'[+49 69 798 32936](tel:+496979832936)<br>' + '[+49 69 798 32936](tel:+496979832936)<br>' +
'[https://app.rz.uni-frankfurt.de](https://app.rz.uni-frankfurt.de)', '[https://app.rz.uni-frankfurt.de](https://app.rz.uni-frankfurt.de)',
translations: { translations: {},
},
type: SCAboutPageContentType.MARKDOWN, type: SCAboutPageContentType.MARKDOWN,
}, },
], ],
@@ -696,7 +689,7 @@ const config: RecursivePartial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'document', icon: 'description',
title: 'Impressum', title: 'Impressum',
link: 'imprint', link: 'imprint',
translations: { translations: {
@@ -707,7 +700,7 @@ const config: RecursivePartial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'shield-half', icon: 'policy',
title: 'Datenschutz', title: 'Datenschutz',
link: 'privacy', link: 'privacy',
translations: { translations: {
@@ -718,7 +711,7 @@ const config: RecursivePartial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'reader', icon: 'text_snippet',
title: 'Allgemeine Geschäftsbedingungen', title: 'Allgemeine Geschäftsbedingungen',
link: 'terms', link: 'terms',
translations: { translations: {
@@ -729,7 +722,7 @@ const config: RecursivePartial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'library', icon: 'copyright',
title: 'Bibliotheken und Lizenzen', title: 'Bibliotheken und Lizenzen',
link: 'licenses', link: 'licenses',
translations: { translations: {

View File

@@ -10,39 +10,37 @@ import {
SCUserGroupSetting, SCUserGroupSetting,
} from '@openstapps/core'; } from '@openstapps/core';
import {readFileSync} from 'fs'; import {readFileSync} from 'fs';
import {resolve} from 'path'; import path from 'path';
/** /**
* Evaluates if a number is within the given range * Evaluates if a number is within the given range
* *
* @param num The number that should be checked * @param number_ The number that should be checked
* @param range Array of two numbers representing a range (inclusive interval) * @param range Array of two numbers representing a range (inclusive interval)
*/ */
export function inRangeInclusive(num: number, range: number[]): boolean { export function inRangeInclusive(number_: number, range: number[]): boolean {
return num >= range[0] && num <= range[1]; return number_ >= range[0] && number_ <= range[1];
} }
const sommerRange = [4, 9]; const sommerRange = [4, 9];
const winterRange = [10, 3]; const winterRange = [10, 3];
const month = new Date().getMonth(); const month = new Date().getMonth();
const year = new Date().getFullYear(); const year = new Date().getFullYear();
const winterYearOffset = (month < winterRange[0] ? -1 : 0); const winterYearOffset = month < winterRange[0] ? -1 : 0;
const sommerYear = year + (month <= winterRange[1] ? -1 : 0); const sommerYear = year + (month <= winterRange[1] ? -1 : 0);
const winterYear = `${year + winterYearOffset}/${(year + 1 + winterYearOffset) const winterYear = `${year + winterYearOffset}/${(year + 1 + winterYearOffset).toString().slice(-2)}`;
.toString()
.slice(-2)}`;
const wsAcronymShort = `WS ${winterYear}`; const wsAcronymShort = `WS ${winterYear}`;
const ssAcronymShort = `SS ${sommerYear}`; const ssAcronymShort = `SS ${sommerYear}`;
const wsAcronymLong = `WiSe ${winterYear}`; const wsAcronymLong = `WiSe ${winterYear}`;
const ssAcronymLong = `SoSe ${sommerYear}`; const ssAcronymLong = `SoSe ${sommerYear}`;
const userGroupSetting: SCUserGroupSetting = { const userGroupSetting: SCUserGroupSetting = {
categories: ['profile'], categories: ['profile'],
defaultValue: 'students', defaultValue: 'students',
description: 'The user group the app is going to be used.' description:
+ 'This settings for example is getting used for the predefined price category of mensa meals.', 'The user group the app is going to be used.' +
'This settings for example is getting used for the predefined price category of mensa meals.',
inputType: SCSettingInputType.SingleChoice, inputType: SCSettingInputType.SingleChoice,
name: 'group', name: 'group',
order: 1, order: 1,
@@ -53,24 +51,17 @@ const userGroupSetting: SCUserGroupSetting = {
}, },
translations: { translations: {
de: { de: {
description: 'Mit welcher Benutzergruppe soll die App verwendet werden?' description:
+ ' Die Einstellung wird beispielsweise für die Vorauswahl der Preiskategorie der Mensa verwendet.', 'Mit welcher Benutzergruppe soll die App verwendet werden?' +
' Die Einstellung wird beispielsweise für die Vorauswahl der Preiskategorie der Mensa verwendet.',
name: 'Gruppe', name: 'Gruppe',
values: [ values: ['Student', 'Angestellter', 'Gast'],
'Student',
'Angestellter',
'Gast',
],
}, },
en: { en: {
description: `The user group the app is going to be used.' description: `The user group the app is going to be used.'
+ ' This settings for example is getting used for the predefined price category of mensa meals.`, + ' This settings for example is getting used for the predefined price category of mensa meals.`,
name: 'Group', name: 'Group',
values: [ values: ['student', 'employee', 'guest'],
'student',
'employee',
'guest',
],
}, },
}, },
type: SCThingType.Setting, type: SCThingType.Setting,
@@ -94,18 +85,12 @@ const languageSetting: SCLanguageSetting = {
de: { de: {
description: 'Die Sprache in der die App angezeigt wird.', description: 'Die Sprache in der die App angezeigt wird.',
name: 'Sprache', name: 'Sprache',
values: [ values: ['Deutsch', 'English'],
'Deutsch',
'English',
],
}, },
en: { en: {
description: 'The language this app is going to use.', description: 'The language this app is going to use.',
name: 'Language', name: 'Language',
values: [ values: ['Deutsch', 'English'],
'Deutsch',
'English',
],
}, },
}, },
type: SCThingType.Setting, type: SCThingType.Setting,
@@ -132,8 +117,7 @@ const config: Partial<SCConfigFile> = {
title: 'Über das StApps Projekt', title: 'Über das StApps Projekt',
content: [ content: [
{ {
title: title: 'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
content: { content: {
type: SCAboutPageContentType.MARKDOWN, type: SCAboutPageContentType.MARKDOWN,
value: ` value: `
@@ -154,8 +138,7 @@ const config: Partial<SCConfigFile> = {
}, },
translations: { translations: {
en: { en: {
title: title: 'Collaborative project of multiple universities for a single generic study app',
'Collaborative project of multiple universities for a single generic study app',
}, },
}, },
type: SCAboutPageContentType.SECTION, type: SCAboutPageContentType.SECTION,
@@ -200,10 +183,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.MARKDOWN, type: SCAboutPageContentType.MARKDOWN,
}, },
{ {
value: value: '[mail]()<br>' + '[+49 12 345 67890]()<br>' + '[https://localhost/]()',
'[mail]()<br>' +
'[+49 12 345 67890]()<br>' +
'[https://localhost/]()',
translations: { translations: {
en: { en: {
value: 'This would be the english contact information', value: 'This would be the english contact information',
@@ -223,7 +203,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.SECTION, type: SCAboutPageContentType.SECTION,
}, },
{ {
icon: 'newspaper', icon: 'campaign',
title: 'Neue Funktionen / Gelöste Probleme', title: 'Neue Funktionen / Gelöste Probleme',
link: 'changelog', link: 'changelog',
translations: { translations: {
@@ -234,7 +214,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'document', icon: 'description',
title: 'Impressum', title: 'Impressum',
link: 'imprint', link: 'imprint',
translations: { translations: {
@@ -245,7 +225,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'shield-half', icon: 'policy',
title: 'Datenschutz', title: 'Datenschutz',
link: 'privacy', link: 'privacy',
translations: { translations: {
@@ -256,7 +236,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'reader', icon: 'text_snippet',
title: 'Allgemeine Geschäftsbedingungen', title: 'Allgemeine Geschäftsbedingungen',
link: 'terms', link: 'terms',
translations: { translations: {
@@ -267,7 +247,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK, type: SCAboutPageContentType.ROUTER_LINK,
}, },
{ {
icon: 'library', icon: 'copyright',
title: 'Bibliotheken und Lizenzen', title: 'Bibliotheken und Lizenzen',
link: 'licenses', link: 'licenses',
translations: { translations: {
@@ -363,26 +343,11 @@ const config: Partial<SCConfigFile> = {
campusPolygon: { campusPolygon: {
coordinates: [ coordinates: [
[ [
[ [8.660_432_999_690_723, 50.123_027_017_044_436],
8.660432999690723, [8.675_496_285_518_358, 50.123_027_017_044_436],
50.123027017044436, [8.675_496_285_518_358, 50.130_661_764_486_42],
], [8.660_432_999_690_723, 50.130_661_764_486_42],
[ [8.660_432_999_690_723, 50.123_027_017_044_436],
8.675496285518358,
50.123027017044436,
],
[
8.675496285518358,
50.13066176448642,
],
[
8.660432999690723,
50.13066176448642,
],
[
8.660432999690723,
50.123027017044436,
],
], ],
], ],
type: 'Polygon', type: 'Polygon',
@@ -397,6 +362,7 @@ const config: Partial<SCConfigFile> = {
}, },
menus: [ menus: [
{ {
// unused
icon: 'menu', icon: 'menu',
id: 'main', id: 'main',
items: [ items: [
@@ -427,7 +393,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'calendar', icon: 'calendar_month',
route: '/schedule', route: '/schedule',
title: 'schedule', title: 'schedule',
translations: { translations: {
@@ -440,7 +406,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'cafe', icon: 'local_cafe',
route: '/canteen', route: '/canteen',
title: 'canteen', title: 'canteen',
translations: { translations: {
@@ -453,7 +419,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'search', icon: 'local_library',
route: '/hebis-search', route: '/hebis-search',
title: 'library catalog', title: 'library catalog',
translations: { translations: {
@@ -466,7 +432,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'folder', icon: 'inventory_2',
route: '/catalog', route: '/catalog',
title: 'course catalog', title: 'course catalog',
translations: { translations: {
@@ -503,11 +469,13 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'person', // unused
icon: 'account_circle',
id: 'personal', id: 'personal',
items: [ items: [
{ {
icon: 'library', authProvider: 'paia',
icon: 'account_circle',
route: '/library-account', route: '/library-account',
title: 'library account', title: 'library account',
translations: { translations: {
@@ -519,6 +487,20 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
}, },
{
authProvider: 'default',
icon: 'task',
route: '/assessments',
title: 'summary of grades',
translations: {
de: {
title: 'Notenspiegel',
},
en: {
title: 'summary of grades',
},
},
},
{ {
icon: 'star', icon: 'star',
route: '/favorites', route: '/favorites',
@@ -533,7 +515,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'person', icon: 'account_circle',
route: '/profile', route: '/profile',
title: 'profile', title: 'profile',
translations: { translations: {
@@ -559,7 +541,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'information', icon: 'info',
route: '/about', route: '/about',
title: 'about', title: 'about',
translations: { translations: {
@@ -572,7 +554,7 @@ const config: Partial<SCConfigFile> = {
}, },
}, },
{ {
icon: 'chatbubbles', icon: 'rate_review',
route: '/feedback', route: '/feedback',
title: 'feedback', title: 'feedback',
translations: { translations: {
@@ -598,10 +580,7 @@ const config: Partial<SCConfigFile> = {
], ],
name: 'Goethe-Uni', name: 'Goethe-Uni',
privacyPolicyUrl: 'https://mobile.server.uni-frankfurt.de/_static/privacy.md', privacyPolicyUrl: 'https://mobile.server.uni-frankfurt.de/_static/privacy.md',
settings: [ settings: [userGroupSetting, languageSetting],
userGroupSetting,
languageSetting,
],
}, },
auth: { auth: {
paia: { paia: {
@@ -611,26 +590,23 @@ const config: Partial<SCConfigFile> = {
url: 'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php', url: 'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
}, },
endpoints: { endpoints: {
authorization: 'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php', authorization:
'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
mapping: { mapping: {
id: '$.email', id: '$.email',
name: '$.name', name: '$.name',
role: '$.type', role: '$.type',
}, },
token: 'https://hds.hebis.de:8443/auth/login', token: 'https://hds.hebis.de/paia/auth/login',
userinfo: 'https://hds.hebis.de:8443/core', userinfo: 'https://hds.hebis.de/paia/core',
}, },
}, },
}, },
backend: { backend: {
SCVersion: JSON.parse((readFileSync(resolve('.', '.', 'package.json'), 'utf-8')).toString()) SCVersion: JSON.parse(readFileSync(path.resolve('.', '.', 'package.json'), 'utf8').toString())
.dependencies['@openstapps/core'], .dependencies['@openstapps/core'],
externalRequestTimeout: 5000, externalRequestTimeout: 5000,
hiddenTypes: [ hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
SCThingType.DateSeries,
SCThingType.Diff,
SCThingType.Floor,
],
mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'], mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'],
maxMultiSearchRouteQueries: 5, maxMultiSearchRouteQueries: 5,
maxRequestBodySize: 512 * 1024, maxRequestBodySize: 512 * 1024,
@@ -659,20 +635,12 @@ const config: Partial<SCConfigFile> = {
}, },
{ {
fieldName: 'geo', fieldName: 'geo',
onlyOnTypes: [ onlyOnTypes: [SCThingType.Building, SCThingType.PointOfInterest, SCThingType.Room],
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'], sortTypes: ['distance'],
}, },
{ {
fieldName: 'geo', fieldName: 'geo',
onlyOnTypes: [ onlyOnTypes: [SCThingType.Building, SCThingType.PointOfInterest, SCThingType.Room],
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'], sortTypes: ['distance'],
}, },
{ {
@@ -690,9 +658,7 @@ const config: Partial<SCConfigFile> = {
}, },
{ {
fieldName: 'offers', fieldName: 'offers',
onlyOnTypes: [ onlyOnTypes: [SCThingType.Dish],
SCThingType.Dish,
],
sortTypes: ['price'], sortTypes: ['price'],
}, },
], ],
@@ -725,31 +691,19 @@ const config: Partial<SCConfigFile> = {
}, },
{ {
fieldName: 'academicTerms.acronym', fieldName: 'academicTerms.acronym',
onlyOnTypes: [ onlyOnTypes: [SCThingType.AcademicEvent, SCThingType.SportCourse],
SCThingType.AcademicEvent,
SCThingType.SportCourse,
],
}, },
{ {
fieldName: 'academicTerm.acronym', fieldName: 'academicTerm.acronym',
onlyOnTypes: [ onlyOnTypes: [SCThingType.Catalog],
SCThingType.Catalog,
],
}, },
{ {
fieldName: 'majors', fieldName: 'majors',
onlyOnTypes: [ onlyOnTypes: [SCThingType.AcademicEvent],
SCThingType.AcademicEvent,
],
}, },
{ {
fieldName: 'keywords', fieldName: 'keywords',
onlyOnTypes: [ onlyOnTypes: [SCThingType.Article, SCThingType.Book, SCThingType.Message, SCThingType.Video],
SCThingType.Article,
SCThingType.Book,
SCThingType.Message,
SCThingType.Video,
],
}, },
{ {
fieldName: 'type', fieldName: 'type',
@@ -772,7 +726,7 @@ const config: Partial<SCConfigFile> = {
{ {
factor: 1, factor: 1,
fields: { fields: {
'categories': { categories: {
'course': 1.08, 'course': 1.08,
'integrated course': 1.08, 'integrated course': 1.08,
'introductory class': 1.05, 'introductory class': 1.05,
@@ -790,11 +744,11 @@ const config: Partial<SCConfigFile> = {
{ {
factor: 1, factor: 1,
fields: { fields: {
'categories': { categories: {
'cafe': 1.1, cafe: 1.1,
'learn': 1.1, learn: 1.1,
'library': 1.2, library: 1.2,
'restaurant': 1.1, restaurant: 1.1,
}, },
}, },
type: SCThingType.PointOfInterest, type: SCThingType.PointOfInterest,
@@ -802,7 +756,7 @@ const config: Partial<SCConfigFile> = {
{ {
factor: 1, factor: 1,
fields: { fields: {
'categories': { categories: {
'main dish': 2, 'main dish': 2,
}, },
}, },
@@ -813,7 +767,7 @@ const config: Partial<SCConfigFile> = {
{ {
factor: 1, factor: 1,
fields: { fields: {
'categories': { categories: {
'cafe': 2, 'cafe': 2,
'canteen': 2, 'canteen': 2,
'restaurant': 2, 'restaurant': 2,

View File

@@ -1,7 +1,10 @@
{ {
"metricsPath": "/metrics", "metricsPath": "/metrics",
"collectDefaultMetrics": true, "includeMethod": true,
"requestDurationBuckets": [0.1, 0.5, 1, 2, 5, 10, 20], "includePath": true,
"requestLengthBuckets": [512, 1024, 5120, 10240, 51200, 102400], "promClient": {
"responseLengthBuckets": [512, 1024, 5120, 10240, 51200, 102400] "collectDefaultMetrics": {
}
},
"for-more-options-see": "https://github.com/jochen-schweizer/express-prom-bundle#options"
} }

2326
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/backend", "name": "@openstapps/backend",
"version": "0.1.0", "version": "0.3.1",
"description": "A reference implementation for a StApps backend", "description": "A reference implementation for a StApps backend",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"author": "André Bierlein <andre.mt.bierlein@gmail.com>", "author": "André Bierlein <andre.mt.bierlein@gmail.com>",
@@ -34,70 +34,69 @@
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "5.6.22", "@elastic/elasticsearch": "5.6.22",
"@openstapps/core": "0.68.0", "@openstapps/core": "0.70.0",
"@openstapps/core-tools": "0.31.0", "@openstapps/core-tools": "0.32.0",
"@openstapps/logger": "0.8.1", "@openstapps/logger": "1.0.0",
"@types/express-prometheus-middleware": "1.2.1", "@types/node": "14.18.24",
"@types/node": "14.18.21",
"config": "3.3.7", "config": "3.3.7",
"cors": "2.8.5", "cors": "2.8.5",
"express": "4.18.1", "express": "4.18.1",
"express-prometheus-middleware": "1.2.0", "express-prom-bundle": "6.5.0",
"express-promise-router": "4.1.1", "express-promise-router": "4.1.1",
"got": "11.8.5", "got": "11.8.5",
"moment": "2.29.3", "moment": "2.29.4",
"morgan": "1.10.0", "morgan": "1.10.0",
"nock": "13.2.7", "nock": "13.2.9",
"node-cache": "5.1.2", "node-cache": "5.1.2",
"node-cron": "3.0.1", "node-cron": "3.0.2",
"nodemailer": "6.7.5", "nodemailer": "6.7.8",
"prom-client": "14.0.1", "prom-client": "14.0.1",
"promise-queue": "2.2.5", "promise-queue": "2.2.5",
"ts-node": "10.8.1", "ts-node": "10.9.1",
"uuid": "8.3.2" "uuid": "8.3.2"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/configuration": "0.32.0", "@openstapps/configuration": "0.33.0",
"@openstapps/es-mapping-generator": "0.2.0", "@openstapps/es-mapping-generator": "0.3.0",
"@openstapps/eslint-config": "1.1.0", "@openstapps/eslint-config": "1.1.0",
"@testdeck/mocha": "0.2.0", "@testdeck/mocha": "0.2.0",
"@types/chai": "4.3.1", "@types/chai": "4.3.3",
"@types/chai-as-promised": "7.1.5", "@types/chai-as-promised": "7.1.5",
"@types/config": "0.0.41", "@types/config": "3.3.0",
"@types/cors": "2.8.12", "@types/cors": "2.8.12",
"@types/elasticsearch": "5.0.40", "@types/elasticsearch": "5.0.40",
"@types/express": "4.17.13", "@types/express": "4.17.13",
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
"@types/mocha": "9.1.1", "@types/mocha": "9.1.1",
"@types/morgan": "1.9.3", "@types/morgan": "1.9.3",
"@types/node-cron": "3.0.1", "@types/node-cron": "3.0.2",
"@types/nodemailer": "6.4.4", "@types/nodemailer": "6.4.5",
"@types/promise-queue": "2.2.0", "@types/promise-queue": "2.2.0",
"@types/sinon-express-mock": "1.3.9", "@types/sinon-express-mock": "1.3.9",
"@types/supertest": "2.0.12", "@types/supertest": "2.0.12",
"@types/uuid": "8.3.4", "@types/uuid": "8.3.4",
"@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/eslint-plugin": "5.34.0",
"@typescript-eslint/parser": "5.29.0", "@typescript-eslint/parser": "5.34.0",
"chai": "4.3.6", "chai": "4.3.6",
"chai-as-promised": "7.1.1", "chai-as-promised": "7.1.1",
"conventional-changelog-cli": "2.2.2", "conventional-changelog-cli": "2.2.2",
"eslint": "8.18.0", "eslint": "8.22.0",
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.5.0",
"eslint-plugin-jsdoc": "39.3.3", "eslint-plugin-jsdoc": "39.3.6",
"eslint-plugin-prettier": "4.1.0", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "42.0.0", "eslint-plugin-unicorn": "43.0.2",
"get-port": "5.1.1", "get-port": "5.1.1",
"mocha": "10.0.0", "mocha": "10.0.0",
"mocked-env": "1.3.5", "mocked-env": "1.3.5",
"nyc": "15.1.0", "nyc": "15.1.0",
"prepend-file-cli": "1.0.6", "prepend-file-cli": "1.0.6",
"prettier": "2.7.1", "prettier": "2.7.1",
"redoc-cli": "0.13.16", "redoc-cli": "0.13.19",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"sinon": "14.0.0", "sinon": "14.0.0",
"sinon-express-mock": "2.2.1", "sinon-express-mock": "2.2.1",
"supertest": "6.2.3", "supertest": "6.2.4",
"typedoc": "0.22.17", "typedoc": "0.22.18",
"typescript": "4.4.4" "typescript": "4.4.4"
}, },
"nyc": { "nyc": {
@@ -116,6 +115,7 @@
], ],
"lines": 95, "lines": 95,
"reporter": [ "reporter": [
"cobertura",
"html", "html",
"text-summary" "text-summary"
], ],

View File

@@ -101,6 +101,7 @@ configureApp(app, {elasticsearch: Elasticsearch})
// After app setup listen on provided port, on all network interfaces // After app setup listen on provided port, on all network interfaces
server.listen(port); server.listen(port);
}) })
// eslint-disable-next-line unicorn/prefer-top-level-await
.catch(error => { .catch(error => {
throw error; throw error;
}); });

View File

@@ -13,13 +13,10 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Logger} from '@openstapps/logger'; import {Logger} from '@openstapps/logger';
import express from 'express'; import express_prom_bundle from 'express-prom-bundle';
import expressPrometheusMiddleware from 'express-prometheus-middleware';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
type UserOptions = Parameters<typeof expressPrometheusMiddleware>[0];
/** /**
* Create and configure a new Express Prometheus Middleware instance * Create and configure a new Express Prometheus Middleware instance
* *
@@ -29,15 +26,15 @@ type UserOptions = Parameters<typeof expressPrometheusMiddleware>[0];
* *
* @returns express.Express * @returns express.Express
*/ */
export function getPrometheusMiddleware(): express.Express { export function getPrometheusMiddleware(): express_prom_bundle.Middleware {
const configFileName = path.join('./config', 'prometheus.json'); const configFileName = path.join('./config', 'prometheus.json');
let options: UserOptions = {}; let options: express_prom_bundle.Opts = {};
try { try {
options = JSON.parse(fs.readFileSync(configFileName, 'utf8')); options = JSON.parse(fs.readFileSync(configFileName, 'utf8'));
} catch (error) { } catch (error) {
Logger.warn('Could not get options for Prometheus Middleware.', error); Logger.warn("Couldn't get options from config file for Prometheus Middleware.", error);
} }
return expressPrometheusMiddleware(options); return express_prom_bundle(options);
} }

View File

@@ -148,4 +148,4 @@ export const getTransport = (verified: boolean) => {
}; };
export const getIndex = (uid?: string) => export const getIndex = (uid?: string) =>
`stapps_footype_foosource_${uid ? uid : Elasticsearch.getIndexUID(v4())}`; `stapps_footype_foosource_${uid ?? Elasticsearch.getIndexUID(v4())}`;