Files
openstapps/config/default.ts
2022-09-02 15:56:04 +02:00

806 lines
22 KiB
TypeScript

// tslint:disable:no-default-export
// tslint:disable:no-magic-numbers
import {
SCAboutPageContentType,
SCConfigFile,
SCLanguageSetting,
SCSettingInputType,
SCThingOriginType,
SCThingType,
SCUserGroupSetting,
} from '@openstapps/core';
import {readFileSync} from 'fs';
import path from 'path';
/**
* Evaluates if a number is within the given range
*
* @param number_ The number that should be checked
* @param range Array of two numbers representing a range (inclusive interval)
*/
export function inRangeInclusive(number_: number, range: number[]): boolean {
return number_ >= range[0] && number_ <= range[1];
}
const sommerRange = [4, 9];
const winterRange = [10, 3];
const month = new Date().getMonth();
const year = new Date().getFullYear();
const winterYearOffset = month < winterRange[0] ? -1 : 0;
const sommerYear = year + (month <= winterRange[1] ? -1 : 0);
const winterYear = `${year + winterYearOffset}/${(year + 1 + winterYearOffset).toString().slice(-2)}`;
const wsAcronymShort = `WS ${winterYear}`;
const ssAcronymShort = `SS ${sommerYear}`;
const wsAcronymLong = `WiSe ${winterYear}`;
const ssAcronymLong = `SoSe ${sommerYear}`;
const userGroupSetting: SCUserGroupSetting = {
categories: ['profile'],
defaultValue: 'students',
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.',
inputType: SCSettingInputType.SingleChoice,
name: 'group',
order: 1,
origin: {
indexed: '2018-09-11T12:30:00Z',
name: 'SCConfigFile Default Values',
type: SCThingOriginType.Remote,
},
translations: {
de: {
description:
'Mit welcher Benutzergruppe soll die App verwendet werden?' +
' Die Einstellung wird beispielsweise für die Vorauswahl der Preiskategorie der Mensa verwendet.',
name: 'Gruppe',
values: ['Student', 'Angestellter', 'Gast'],
},
en: {
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.`,
name: 'Group',
values: ['student', 'employee', 'guest'],
},
},
type: SCThingType.Setting,
uid: '2c97aa36-4aa2-43de-bc5d-a2b2cb3a530e',
values: ['students', 'employees', 'guests'],
};
const languageSetting: SCLanguageSetting = {
categories: ['profile'],
defaultValue: 'en',
description: 'The language this app is going to use.',
inputType: SCSettingInputType.SingleChoice,
name: 'language',
order: 0,
origin: {
indexed: '2018-09-11T12:30:00Z',
name: 'SCConfigFile Default Values',
type: SCThingOriginType.Remote,
},
translations: {
de: {
description: 'Die Sprache in der die App angezeigt wird.',
name: 'Sprache',
values: ['Deutsch', 'English'],
},
en: {
description: 'The language this app is going to use.',
name: 'Language',
values: ['Deutsch', 'English'],
},
},
type: SCThingType.Setting,
uid: 'dc9d6dec-6576-45ef-9e35-3598c0d6a662',
values: ['de', 'en'],
};
/**
* This is the default configuration for app and backend
*
* University specific files can be created with following naming scheme: default-<university license plate>.ts
*
* To select your university specific configuration which is merged from this default file and your university specific
* file, you have to supply the `NODE_APP_INSTANCE` environment variable with your license plate
*
* To get more information about the meaning of specific fields please have a look at `@openstapps/core` or use your
* IDE to read the TSDoc documentation.
*/
const config: Partial<SCConfigFile> = {
app: {
aboutPages: {
'about': {
title: 'Über das StApps Projekt',
content: [
{
title: 'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
content: {
type: SCAboutPageContentType.MARKDOWN,
value: `
StApps bietet Studierenden aller beteiligten Hochschulen eine qualitativ
hochwertige App für den Studienalltag. StApps-Verbundpartner integrieren
generalisierbare Studierendenprozesse so in App-Module, dass diese auch
von anderen Hochschulen verwendet werden können. Die zur StApps-App ankommenden
Daten einer Datenquelle einer Art sind in einem generalisierten Datenmodell
so aufbereitet, dass ein Austausch der Datenquelle problemlos möglich ist und
die StApps-App problemlos weiterhin funktionsfähig bleibt.
`,
translations: {
en: {
value: `
This would be the english content`,
},
},
},
translations: {
en: {
title: 'Collaborative project of multiple universities for a single generic study app',
},
},
type: SCAboutPageContentType.SECTION,
},
{
title: 'Universitätskontakt',
content: {
rows: [
[
{
value: 'Adresse',
translations: {
en: {
value: 'address',
},
},
type: SCAboutPageContentType.MARKDOWN,
},
{
value: `
Nirmasi Universität<br>
Abteilung für digitale Angelegenheiten (AbtDigi)<br>
Null Island 1<br>
999999 Atlantic Ocean
`,
translations: {
en: {
value: 'This would be the english address',
},
},
type: SCAboutPageContentType.MARKDOWN,
},
],
[
{
value: 'Kontaktinformationen',
translations: {
en: {
value: 'Contact information',
},
},
type: SCAboutPageContentType.MARKDOWN,
},
{
value: '[mail]()<br>' + '[+49 12 345 67890]()<br>' + '[https://localhost/]()',
translations: {
en: {
value: 'This would be the english contact information',
},
},
type: SCAboutPageContentType.MARKDOWN,
},
],
],
type: SCAboutPageContentType.TABLE,
},
translations: {
en: {
title: 'Nimrasi-Uni Kontakt',
},
},
type: SCAboutPageContentType.SECTION,
},
{
icon: 'campaign',
title: 'Neue Funktionen / Gelöste Probleme',
link: 'changelog',
translations: {
en: {
title: 'Changelog / Resolved issues',
},
},
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'description',
title: 'Impressum',
link: 'imprint',
translations: {
en: {
title: 'Imprint',
},
},
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'policy',
title: 'Datenschutz',
link: 'privacy',
translations: {
en: {
title: 'Privacy policy',
},
},
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'text_snippet',
title: 'Allgemeine Geschäftsbedingungen',
link: 'terms',
translations: {
en: {
title: 'Terms and conditions',
},
},
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'copyright',
title: 'Bibliotheken und Lizenzen',
link: 'licenses',
translations: {
en: {
title: 'Libraries and licenses',
},
},
type: SCAboutPageContentType.ROUTER_LINK,
},
],
translations: {
en: {
title: 'About',
},
},
},
'about/imprint': {
title: 'Impressum',
content: [
{
title: 'Beteiligte Universitäten',
card: true,
content: {
value: `
[Nimrasi Universität Null Island]()
[Königliche Hochschule Lummerland]()
`,
translations: {
en: {
value: `
[Nimrasi University of Null Island]()
[Royal Institute of Make-Believe]()
`,
},
},
type: SCAboutPageContentType.MARKDOWN,
},
translations: {
en: {
title: 'Collaborating Universities',
},
},
type: SCAboutPageContentType.SECTION,
},
],
translations: {
en: {
title: 'Imprint',
},
},
},
'about/privacy': {
title: 'Datenschutz',
content: [
{
value: 'Hier wäre der Datenschutz',
translations: {
en: {
value: 'This would be the privacy policy',
},
},
type: SCAboutPageContentType.MARKDOWN,
},
],
translations: {
en: {
title: 'Privacy Policy',
},
},
},
'about/terms': {
title: 'Allgemeine Geschäftsbedingungen',
content: [
{
value: 'Hier wären die AGB',
translations: {
en: {
value: 'This would be the terms & conditions',
},
},
type: SCAboutPageContentType.MARKDOWN,
},
],
translations: {
en: {
title: 'Terms and conditions',
},
},
},
},
campusPolygon: {
coordinates: [
[
[8.660_432_999_690_723, 50.123_027_017_044_436],
[8.675_496_285_518_358, 50.123_027_017_044_436],
[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],
],
],
type: 'Polygon',
},
features: {
extern: {
paia: {
authProvider: 'paia',
url: 'https://hds.hebis.de/paia/core',
},
},
},
menus: [
{
// unused
icon: 'menu',
id: 'main',
items: [
{
icon: 'newspaper',
route: '/news',
title: 'news',
translations: {
de: {
title: 'Aktuelles',
},
en: {
title: 'news',
},
},
},
{
icon: 'search',
route: '/search',
title: 'search',
translations: {
de: {
title: 'Suche',
},
en: {
title: 'search',
},
},
},
{
icon: 'calendar_month',
route: '/schedule',
title: 'schedule',
translations: {
de: {
title: 'Stundenplan',
},
en: {
title: 'schedule',
},
},
},
{
icon: 'local_cafe',
route: '/canteen',
title: 'canteen',
translations: {
de: {
title: 'Mensa',
},
en: {
title: 'canteen',
},
},
},
{
icon: 'local_library',
route: '/hebis-search',
title: 'library catalog',
translations: {
de: {
title: 'Bibliothekskatalog',
},
en: {
title: 'library catalog',
},
},
},
{
icon: 'inventory_2',
route: '/catalog',
title: 'course catalog',
translations: {
de: {
title: 'Vorlesungsverzeichnis',
},
en: {
title: 'course catalog',
},
},
},
{
icon: 'map',
route: '/map',
title: 'campus map',
translations: {
de: {
title: 'Campus Karte',
},
en: {
title: 'campus map',
},
},
},
],
name: 'main menu',
translations: {
de: {
name: 'Hauptmenü',
},
en: {
name: 'main menu',
},
},
},
{
// unused
icon: 'account_circle',
id: 'personal',
items: [
{
authProvider: 'paia',
icon: 'account_circle',
route: '/library-account',
title: 'library account',
translations: {
de: {
title: 'Bibliothekskonto',
},
en: {
title: 'library account',
},
},
},
{
authProvider: 'default',
icon: 'task',
route: '/assessments',
title: 'summary of grades',
translations: {
de: {
title: 'Notenspiegel',
},
en: {
title: 'summary of grades',
},
},
},
{
icon: 'star',
route: '/favorites',
title: 'favorites',
translations: {
de: {
title: 'Favoriten',
},
en: {
title: 'favorites',
},
},
},
{
icon: 'account_circle',
route: '/profile',
title: 'profile',
translations: {
de: {
title: 'Profil',
},
en: {
title: 'profile',
},
},
},
{
icon: 'settings',
route: '/settings',
title: 'settings',
translations: {
de: {
title: 'Einstellungen',
},
en: {
title: 'settings',
},
},
},
{
icon: 'info',
route: '/about',
title: 'about',
translations: {
de: {
title: 'Über StApps',
},
en: {
title: 'About StApps',
},
},
},
{
icon: 'rate_review',
route: '/feedback',
title: 'feedback',
translations: {
de: {
title: 'Feedback',
},
en: {
title: 'feedback',
},
},
},
],
name: 'Your Study-App',
translations: {
de: {
name: 'Deine Studi-App',
},
en: {
name: 'Your Study-App',
},
},
},
],
name: 'Goethe-Uni',
privacyPolicyUrl: 'https://mobile.server.uni-frankfurt.de/_static/privacy.md',
settings: [userGroupSetting, languageSetting],
},
auth: {
paia: {
client: {
clientId: '',
scopes: '',
url: 'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
},
endpoints: {
authorization:
'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
mapping: {
id: '$.email',
name: '$.name',
role: '$.type',
},
token: 'https://hds.hebis.de/paia/auth/login',
userinfo: 'https://hds.hebis.de/paia/core',
},
},
},
backend: {
SCVersion: JSON.parse(readFileSync(path.resolve('.', '.', 'package.json'), 'utf8').toString())
.dependencies['@openstapps/core'],
externalRequestTimeout: 5000,
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'],
maxMultiSearchRouteQueries: 5,
maxRequestBodySize: 512 * 1024,
name: 'Goethe-Universität Frankfurt am Main',
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
sortableFields: [
{
fieldName: 'name',
sortTypes: ['ducet'],
},
{
fieldName: 'type',
sortTypes: ['ducet'],
},
{
fieldName: 'categories',
onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.Building,
SCThingType.Catalog,
SCThingType.Dish,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['ducet'],
},
{
fieldName: 'geo',
onlyOnTypes: [SCThingType.Building, SCThingType.PointOfInterest, SCThingType.Room],
sortTypes: ['distance'],
},
{
fieldName: 'geo',
onlyOnTypes: [SCThingType.Building, SCThingType.PointOfInterest, SCThingType.Room],
sortTypes: ['distance'],
},
{
fieldName: 'inPlace.geo',
onlyOnTypes: [
SCThingType.DateSeries,
SCThingType.Dish,
SCThingType.Floor,
SCThingType.Organization,
SCThingType.PointOfInterest,
SCThingType.Room,
SCThingType.Ticket,
],
sortTypes: ['distance'],
},
{
fieldName: 'offers',
onlyOnTypes: [SCThingType.Dish],
sortTypes: ['price'],
},
],
},
internal: {
aggregations: [
{
fieldName: 'categories',
onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.Article,
SCThingType.Building,
SCThingType.Catalog,
SCThingType.Dish,
SCThingType.PointOfInterest,
SCThingType.Room,
],
},
{
fieldName: 'inPlace.name',
onlyOnTypes: [
SCThingType.DateSeries,
SCThingType.Dish,
SCThingType.Floor,
SCThingType.Organization,
SCThingType.PointOfInterest,
SCThingType.Room,
SCThingType.Ticket,
],
},
{
fieldName: 'academicTerms.acronym',
onlyOnTypes: [SCThingType.AcademicEvent, SCThingType.SportCourse],
},
{
fieldName: 'academicTerm.acronym',
onlyOnTypes: [SCThingType.Catalog],
},
{
fieldName: 'majors',
onlyOnTypes: [SCThingType.AcademicEvent],
},
{
fieldName: 'keywords',
onlyOnTypes: [SCThingType.Article, SCThingType.Book, SCThingType.Message, SCThingType.Video],
},
{
fieldName: 'type',
},
],
boostings: {
default: [
{
factor: 1,
fields: {
'academicTerms.acronym': {
[ssAcronymShort]: inRangeInclusive(month, sommerRange) ? 1.1 : 1.05,
[wsAcronymShort]: inRangeInclusive(month, winterRange) ? 1.1 : 1.05,
[ssAcronymLong]: inRangeInclusive(month, sommerRange) ? 1.1 : 1.05,
[wsAcronymLong]: inRangeInclusive(month, winterRange) ? 1.1 : 1.05,
},
},
type: SCThingType.AcademicEvent,
},
{
factor: 1,
fields: {
categories: {
'course': 1.08,
'integrated course': 1.08,
'introductory class': 1.05,
'lecture': 1.1,
'seminar': 1.01,
'tutorial': 1.05,
},
},
type: SCThingType.AcademicEvent,
},
{
factor: 1.6,
type: SCThingType.Building,
},
{
factor: 1,
fields: {
categories: {
cafe: 1.1,
learn: 1.1,
library: 1.2,
restaurant: 1.1,
},
},
type: SCThingType.PointOfInterest,
},
{
factor: 1,
fields: {
categories: {
'main dish': 2,
},
},
type: SCThingType.Dish,
},
],
dining: [
{
factor: 1,
fields: {
categories: {
'cafe': 2,
'canteen': 2,
'restaurant': 2,
'restroom': 1.2,
'student canteen': 2,
},
},
type: SCThingType.Building,
},
{
factor: 2,
type: SCThingType.Dish,
},
],
place: [
{
factor: 2,
type: SCThingType.Building,
},
{
factor: 2,
type: SCThingType.PointOfInterest,
},
{
factor: 2,
type: SCThingType.Room,
},
],
},
},
uid: 'f-u',
};
// tslint:disable-next-line:no-default-export
export default config;