Compare commits

...

9 Commits

Author SHA1 Message Date
Karl-Philipp Wulfert
9fb0a7c885 0.16.0 2019-04-15 17:41:48 +02:00
Karl-Philipp Wulfert
b5e0b76c24 build: exclude docs from package
Fixes #56
2019-04-15 15:51:25 +02:00
Karl-Philipp Wulfert
a2f44762f9 docs: update changelog 2019-04-09 17:14:55 +02:00
Karl-Philipp Wulfert
d46abbe29b 0.15.0 2019-04-09 17:14:52 +02:00
Rainer Killinger
4986042428 fix: change SCThingMeta getInstance() return value 2019-04-09 14:08:07 +00:00
Michel Jonathan Schmitz
3242411768 feat: provide context based search 2019-04-09 13:47:53 +00:00
Karl-Philipp Wulfert
37e5f6c490 build: update dependencies
Fixes #53
2019-04-09 12:36:22 +02:00
Karl-Philipp Wulfert
623ed613a9 fix: resolve issues with things that can be offered
Fixes #41
2019-04-04 13:47:30 +02:00
Karl-Philipp Wulfert
fd994e2c08 docs: update changelog 2019-04-03 16:23:56 +02:00
16 changed files with 974 additions and 2038 deletions

View File

@@ -1,4 +1,3 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org # editorconfig.org
root = true root = true
@@ -7,11 +6,10 @@ root = true
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false

29
.gitignore vendored
View File

@@ -20,7 +20,7 @@ coverage
# nyc test coverage # nyc test coverage
.nyc_output .nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt .grunt
# Bower dependency directory (https://bower.io/) # Bower dependency directory (https://bower.io/)
@@ -29,14 +29,14 @@ bower_components
# node-waf configuration # node-waf configuration
.lock-wscript .lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html) # Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release build/Release
# Dependency directories # Dependency directories
node_modules/ node_modules/
jspm_packages/ jspm_packages/
# Typescript v1 declaration files # TypeScript v1 declaration files
typings/ typings/
# Optional npm cache directory # Optional npm cache directory
@@ -57,6 +57,29 @@ typings/
# dotenv environment variables file # dotenv environment variables file
.env .env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
#DynamoDB Local files
.dynamodb/
########## end of https://github.com/github/gitignore/blob/master/Node.gitignore
# ignore ide files # ignore ide files
.idea .idea
.vscode .vscode

View File

@@ -1,14 +1,12 @@
# Ignore all files/folders by default # Ignore all files/folders by default
# See https://stackoverflow.com/a/29932318 # See https://stackoverflow.com/a/29932318
/* /*
# Except these files/folders
# Execept this files/folders
!docs
!lib !lib
lib/tsconfig.tsbuildinfo
!LICENSE !LICENSE
!package.json !package.json
!package-lock.json !package-lock.json
!README.md !README.md
!src !src
test/*
!test/resources/ !test/resources/

View File

@@ -1,3 +1,27 @@
# [0.15.0](https://gitlab.com/openstapps/core/compare/v0.14.0...v0.15.0) (2019-04-09)
### 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)
### Features
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/3242411))
# [0.14.0](https://gitlab.com/openstapps/core/compare/v0.13.0...v0.14.0) (2019-04-03)
### Features
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/8188731))
# [0.13.0](https://gitlab.com/openstapps/core/compare/v0.12.0...v0.13.0) (2019-04-02) # [0.13.0](https://gitlab.com/openstapps/core/compare/v0.12.0...v0.13.0) (2019-04-02)

2740
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/core", "name": "@openstapps/core",
"version": "0.14.0", "version": "0.16.0",
"description": "StAppsCore - Generalized model of data", "description": "StAppsCore - Generalized model of data",
"keywords": [ "keywords": [
"Model", "Model",
@@ -17,7 +17,7 @@
"build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run documentation", "build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run documentation",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'", "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", "check-configuration": "openstapps-configuration",
"compile": "tsc", "compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib", "documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
"pack": "openstapps-core-tools pack", "pack": "openstapps-core-tools pack",
"prepublishOnly": "npm ci && npm run build", "prepublishOnly": "npm ci && npm run build",
@@ -42,24 +42,24 @@
"ts-optchain": "0.1.3" "ts-optchain": "0.1.3"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/configuration": "0.8.0", "@openstapps/configuration": "0.11.0",
"@openstapps/core-tools": "0.3.0", "@openstapps/core-tools": "0.5.1",
"@openstapps/logger": "0.0.5", "@openstapps/logger": "0.0.5",
"@types/chai": "4.1.7", "@types/chai": "4.1.7",
"@types/node": "10.14.4", "@types/node": "10.14.4",
"@types/rimraf": "2.0.2", "@types/rimraf": "2.0.2",
"async-pool-native": "0.1.0", "async-pool-native": "0.1.0",
"chai": "4.2.0", "chai": "4.2.0",
"commander": "2.19.0", "commander": "2.20.0",
"conventional-changelog-cli": "2.0.12", "conventional-changelog-cli": "2.0.12",
"mocha": "6.0.2", "mocha": "6.1.3",
"mocha-typescript": "1.1.17", "mocha-typescript": "1.1.17",
"nyc": "13.3.0", "nyc": "13.3.0",
"rimraf": "2.6.3", "rimraf": "2.6.3",
"ts-node": "8.0.3", "ts-node": "8.1.0",
"tslint": "5.15.0", "tslint": "5.15.0",
"typedoc": "0.14.2", "typedoc": "0.14.2",
"typescript": "3.4.1" "typescript": "3.4.3"
}, },
"nyc": { "nyc": {
"check-coverage": true, "check-coverage": true,

View File

@@ -222,7 +222,7 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
/** /**
* Set type definiton for singleton instance * Set type definiton for singleton instance
*/ */
protected static _instance: SCThingMeta; protected static _instance = new Map<string, unknown>();
/** /**
* Translations of fields * Translations of fields
@@ -268,8 +268,10 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
* Function to retrieve typed singleton instance * Function to retrieve typed singleton instance
*/ */
public static getInstance<T extends SCThingMeta>(): T { public static getInstance<T extends SCThingMeta>(): T {
const typedThis = this as any as typeof SCThingMeta; if (!this._instance.has(this.name)) {
return (typedThis._instance || (typedThis._instance = new this())) as T; this._instance.set(this.name, new this());
}
return this._instance.get(this.name) as T;
} }
protected constructor() {} protected constructor() {}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2019 StApps * Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,8 +16,8 @@ import {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization'; import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person'; import {SCPersonWithoutReferences} from '../things/Person';
import {SCTranslations} from '../types/i18n'; import {SCTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
import {SCISO8601Date} from '../types/Time'; import {SCISO8601Date} from '../types/Time';
import {SCInPlace} from './../types/Places';
/** /**
* Default price without distinction * Default price without distinction
@@ -50,7 +50,17 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
} }
/** /**
* A thing without references that has a price tag * A thing without references that can be offered
*/
export interface SCThingThatCanBeOfferedWithoutReferences extends SCThing {
/**
* Translations of a thing that can be offered
*/
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
}
/**
* A thing that can be offered
*/ */
export interface SCThingThatCanBeOffered<T extends SCPriceGroup> export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
extends SCThing { extends SCThing {
@@ -58,11 +68,6 @@ export interface SCThingThatCanBeOffered<T extends SCPriceGroup>
* List of offers for that thing * List of offers for that thing
*/ */
offers?: Array<SCThingThatCanBeOfferedOffer<T>>; offers?: Array<SCThingThatCanBeOfferedOffer<T>>;
/**
* Translations of a thing that can be offered
*/
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
} }
/** /**

View File

@@ -13,6 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCSearchContext} from '../../../types/config/Backend';
import {SCSearchFilter} from '../../../types/filters/Abstract'; import {SCSearchFilter} from '../../../types/filters/Abstract';
import {SCSearchSort} from '../../../types/sorts/Abstract'; import {SCSearchSort} from '../../../types/sorts/Abstract';
import { import {
@@ -37,7 +38,12 @@ export interface SCSearchRequest extends SCSearchQuery {
*/ */
export interface SCSearchQuery { export interface SCSearchQuery {
/** /**
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT') * The context name from where the search query was initiated
*/
context?: SCSearchContext;
/**
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
*/ */
filter?: SCSearchFilter; filter?: SCSearchFilter;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018 StApps * Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,9 +13,12 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree'; import {SCAcademicDegree, SCAcademicDegreeMeta} from '../base/AcademicDegree';
import {SCAcademicPriceGroup, import {
SCThingThatCanBeOffered, SCAcademicPriceGroup,
SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered'; SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCDateSeriesWithoutReferences} from './DateSeries'; import {SCDateSeriesWithoutReferences} from './DateSeries';
@@ -24,9 +27,8 @@ import {SCOrganization} from './Organization';
/** /**
* A course of studies without references * A course of studies without references
*/ */
export interface SCCourseOfStudiesWithoutReferences extends export interface SCCourseOfStudiesWithoutReferences extends SCAcademicDegree,
SCAcademicDegree, SCThingThatCanBeOfferedWithoutReferences {
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* The main language in which the course of studies * The main language in which the course of studies
* is beeing offered * is beeing offered
@@ -64,14 +66,15 @@ export interface SCCourseOfStudiesWithoutReferences extends
* *
* @validatable * @validatable
*/ */
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences { export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* The department that manages the course of studies * The department that manages the course of studies
*/ */
department: SCOrganization; department: SCOrganization;
/** /**
* The secretary that administers requests and * The secretary that administers requests and
* questions concerning the course of studies * questions concerning the course of studies
*/ */
secretary: SCOrganization; secretary: SCOrganization;
@@ -81,6 +84,11 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
*/ */
startDates?: SCDateSeriesWithoutReferences[]; startDates?: SCDateSeriesWithoutReferences[];
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
/** /**
* Type of the course of studies * Type of the course of studies
*/ */
@@ -88,7 +96,7 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
} }
export interface SCCourseOfStudiesTranslatableProperties export interface SCCourseOfStudiesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties { extends SCThingThatCanBeOfferedTranslatableProperties {
} }
/** /**
@@ -100,19 +108,19 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCAcademicDegreeMeta.getInstance().fieldTranslations.de, ...SCAcademicDegreeMeta.getInstance().fieldTranslations.de,
}, },
en: { en: {
... SCAcademicDegreeMeta.getInstance().fieldTranslations.en, ...SCAcademicDegreeMeta.getInstance().fieldTranslations.en,
}, },
}; };
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de, ...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
modes: { modes: {
combination: 'Kombinationsstudiengang', combination: 'Kombinationsstudiengang',
dual: 'Dualer Studiengang', dual: 'Dualer Studiengang',
@@ -122,7 +130,7 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
type: 'Studiengang', type: 'Studiengang',
}, },
en: { en: {
... SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en, ...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
academicDegree: 'Hochschulabschluss', academicDegree: 'Hochschulabschluss',
department: 'Fachbereich', department: 'Fachbereich',
major: 'Studienfach', major: 'Studienfach',
@@ -136,13 +144,13 @@ export class SCCourseOfStudiesMeta extends SCThingMeta implements SCMetaTranslat
/** /**
* Types of (german) course of studies modes * Types of (german) course of studies modes
*/ */
export type SCCourseOfStudiesMode = 'combination' | export type SCCourseOfStudiesMode = 'combination'
'dual' | | 'dual'
'double-degree' | | 'double-degree'
'standard' ; | 'standard' ;
/** /**
* Types of (german) course of studies time modes * Types of (german) course of studies time modes
*/ */
export type SCCourseOfStudiesTimeMode = 'fulltime' | export type SCCourseOfStudiesTimeMode = 'fulltime'
'parttime' ; | 'parttime' ;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018 StApps * Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -17,6 +17,7 @@ import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCMetaTranslations, SCTranslations} from '../types/i18n';
@@ -38,8 +39,7 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/** /**
* A date without references * A date without references
*/ */
export interface SCDateSeriesWithoutReferences export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
/** /**
* Dates of the date series that are initially planned to be held * Dates of the date series that are initially planned to be held
*/ */
@@ -76,7 +76,9 @@ export interface SCDateSeriesWithoutReferences
* *
* @validatable * @validatable
*/ */
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace { export interface SCDateSeries extends SCDateSeriesWithoutReferences,
SCThingInPlace,
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
/** /**
* Event to which the date series belongs * Event to which the date series belongs
*/ */
@@ -108,26 +110,26 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.de, ...SCThingInPlaceMeta.getInstance().fieldTranslations.de,
}, },
en: { en: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.en, ...SCThingInPlaceMeta.getInstance().fieldTranslations.en,
}, },
}; };
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de, ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
dates: 'Einzeltermine', dates: 'Einzeltermine',
duration: 'Dauer', duration: 'Dauer',
frequency: 'Wiederholung', frequency: 'Wiederholung',
type: 'Wiederholungreihe', type: 'Wiederholungreihe',
}, },
en: { en: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en, ...SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
type: SCThingType.DateSeries, type: SCThingType.DateSeries,
}, },
}; };

View File

@@ -64,11 +64,6 @@ export interface SCDiff extends SCDiffWithoutReferences {
* Meta information about a diff * Meta information about a diff
*/ */
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> { export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
/**
* Set type definiton for singleton instance
*/
protected static _instance: SCThingMeta;
/** /**
* Translations of fields * Translations of fields
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2019 StApps * Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -16,6 +16,7 @@ import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from '../base/ThingThatCanBeOffered';
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
@@ -29,12 +30,8 @@ import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* A dish without references * A dish without references
*/ */
export interface SCDishWithoutReferences export interface SCDishWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences,
extends SCThingWithCategoriesWithoutReferences< SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
SCDishCategories,
SCThingWithCategoriesSpecificValues
>,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* Additives of the dish * Additives of the dish
*/ */
@@ -71,7 +68,8 @@ export interface SCDishWithoutReferences
* *
* @validatable * @validatable
*/ */
export interface SCDish extends SCDishWithoutReferences { export interface SCDish extends SCDishWithoutReferences,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/** /**
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish) * Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
*/ */
@@ -173,22 +171,22 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
}, },
en: { en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
}, },
}; };
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: { categories: {
appetizer: 'Vorspeise', appetizer: 'Vorspeise',
dessert: 'Nachtisch', dessert: 'Nachtisch',
@@ -200,8 +198,8 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
type: 'Essen', type: 'Essen',
}, },
en: { en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories, ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Dish, type: SCThingType.Dish,
}, },
}; };

View File

@@ -15,10 +15,10 @@
/** /**
* Capsulation for a map with a string as key with values of type `T` * Capsulation for a map with a string as key with values of type `T`
* *
* !!! BEWARE !!! * !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map) * Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
* *
* @typeparam T Can be any type. * @typeparam T Can be any type.
*/ */
export interface SCMap<T> { export interface SCMap<T> {
@@ -27,3 +27,20 @@ export interface SCMap<T> {
*/ */
[key: string]: T; [key: string]: T;
} }
/**
* Restricted map with keys, limited to values of `U`, and corresponding values of type `T`
*
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
* Also note, that this is a type not an interface
*
* @typeparam U Must be a type the `in` operator can be applied to and contains only strings or numbers
* @typeparam T Can be any type
*/
export type SCRestrictedMap<U extends string | number, T> = {
/**
* One value for each key
*/
[key in U]: T
};

View File

@@ -15,7 +15,7 @@
import {SCThingType} from '../../Thing'; import {SCThingType} from '../../Thing';
import {SCSearchSortType} from '../sorts/Abstract'; import {SCSearchSortType} from '../sorts/Abstract';
import {SCUuid} from '../UUID'; import {SCUuid} from '../UUID';
import {SCMap} from './../Map'; import {SCMap, SCRestrictedMap} from './../Map';
import {SCMonitoringConfiguration} from './Monitoring'; import {SCMonitoringConfiguration} from './Monitoring';
/** /**
@@ -72,7 +72,7 @@ export interface SCBackendConfigurationSortableField {
/** /**
* A list of SC types on which this field exists * A list of SC types on which this field exists
* *
* If no type is given it is assumed it exists on every type * If no type is given it is assumed it exists on every type
*/ */
onlyOnTypes?: SCThingType[]; onlyOnTypes?: SCThingType[];
@@ -84,10 +84,27 @@ export interface SCBackendConfigurationSortableField {
} }
/**
* Possible context names to be used by the search request
*/
export type SCSearchContext =
| 'default'
| 'dining'
| 'place';
/**
* A boosting configuration for one context
*/
export type SCBackendConfigurationSearchBoostingContext =
SCRestrictedMap<
SCSearchContext,
SCBackendConfigurationSearchBoostingType[]
>;
/** /**
* A boosting configuration for one SCType * A boosting configuration for one SCType
*/ */
export interface SCBackendConfigurationSearchBoosting { export interface SCBackendConfigurationSearchBoostingType {
/** /**
* The factor of which the scores matching this type should be multiplied by * The factor of which the scores matching this type should be multiplied by
@@ -98,7 +115,7 @@ export interface SCBackendConfigurationSearchBoosting {
* Outer-Map: * Outer-Map:
* Fields of this type that should be boosted if they match a given value * Fields of this type that should be boosted if they match a given value
* For nest fields you can use the `.` as a separator. For example `academicTerms.acronym` * For nest fields you can use the `.` as a separator. For example `academicTerms.acronym`
* *
* Inner-map: * Inner-map:
* Value of the field that should be boosted by the given number * Value of the field that should be boosted by the given number
* For example `"SS 2019": 2` * For example `"SS 2019": 2`
@@ -143,7 +160,7 @@ export interface SCBackendInternalConfiguration {
* The resulting scores of matching objects can be boosted (multiplied by a number) to change the order in the * The resulting scores of matching objects can be boosted (multiplied by a number) to change the order in the
* set of results * set of results
*/ */
boostings: SCBackendConfigurationSearchBoosting[]; boostings: SCBackendConfigurationSearchBoostingContext;
/** /**
* Configuration of the database * Configuration of the database

View File

@@ -2,6 +2,7 @@
"errorNames": [], "errorNames": [],
"instance": { "instance": {
"query": "*", "query": "*",
"context": "default",
"filter": { "filter": {
"arguments": { "arguments": {
"filters": [ "filters": [