refactor: use specific setting types

Closes #97
This commit is contained in:
Jovan Krunić
2021-09-07 15:40:32 +02:00
parent 452273248d
commit 4ab7b40b73

View File

@@ -1,9 +1,91 @@
// tslint:disable:no-default-export
// tslint:disable:no-magic-numbers
import {SCConfigFile, SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
import {
SCConfigFile,
SCLanguageSetting,
SCSettingInputType,
SCThingOriginType,
SCThingType,
SCUserGroupSetting,
} from '@openstapps/core';
import {readFileSync} from 'fs';
import {resolve} from 'path';
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
*
@@ -15,6 +97,7 @@ import {resolve} from 'path';
* 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: {
campusPolygon: {
@@ -199,79 +282,8 @@ const config: Partial<SCConfigFile> = {
name: 'Goethe-Uni',
privacyPolicyUrl: 'https://mobile.server.uni-frankfurt.de/_static/privacy.md',
settings: [
{
categories: ['profile'],
defaultValue: 'student',
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: ['student', 'employee', 'guest'],
},
{
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'],
},
userGroupSetting,
languageSetting,
],
},
backend: {