mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4036bfd193 | ||
|
|
f4f372b9ad | ||
|
|
872c1f5fc3 | ||
|
|
4f2ca30dab | ||
|
|
882483ee24 | ||
|
|
c998166938 | ||
|
|
d61e33de39 | ||
|
|
07d6c4770a | ||
|
|
aab3e9fa6c | ||
|
|
4a4cd4e6d4 | ||
|
|
942cd11469 | ||
|
|
fe090c7387 | ||
|
|
f0782d8820 | ||
|
|
a2461d5904 | ||
|
|
d2e0069dc2 | ||
|
|
9c6972af78 | ||
|
|
56b03aa0b9 | ||
|
|
b517837671 | ||
|
|
6f03ede8bf | ||
|
|
952207ace1 | ||
|
|
3d9d28c60c | ||
|
|
913c5691da | ||
|
|
03cdbc6f9b |
@@ -47,6 +47,16 @@ test:
|
|||||||
- report
|
- report
|
||||||
- coverage
|
- coverage
|
||||||
|
|
||||||
|
mapping:
|
||||||
|
dependencies:
|
||||||
|
- build
|
||||||
|
stage: test
|
||||||
|
services:
|
||||||
|
- name: registry.gitlab.com/openstapps/database:master
|
||||||
|
alias: elasticsearch
|
||||||
|
script:
|
||||||
|
- node ./node_modules/@openstapps/core-tools/lib/cli.js put-es-templates ./src http://elasticsearch:9200/ "pattern,see,minlength,tjs-format"
|
||||||
|
|
||||||
package:
|
package:
|
||||||
dependencies:
|
dependencies:
|
||||||
- build
|
- build
|
||||||
|
|||||||
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,3 +1,43 @@
|
|||||||
|
# [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.42.0](https://gitlab.com/openstapps/core/compare/v0.41.0...v0.42.0) (2021-02-16)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ External dependencies can not be covered by the annotations. Documentation about
|
|||||||
| `@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` |
|
| `@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 | |
|
| `@text` | string field is interpreted as text | |
|
||||||
| `@date` | string field is interpreted as a date field | |
|
| `@date` | string field is interpreted as a date field | |
|
||||||
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |
|
| `@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 | |
|
| `@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]` |
|
| `@inheritTags` | inherit all tags from another field | `[SCThingType]::[field]` |
|
||||||
|
|
||||||
|
|||||||
853
package-lock.json
generated
853
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.43.0",
|
"version": "0.48.0",
|
||||||
"description": "StAppsCore - Generalized model of data",
|
"description": "StAppsCore - Generalized model of data",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Model",
|
"Model",
|
||||||
@@ -43,11 +43,11 @@
|
|||||||
"Wieland Schöbl"
|
"Wieland Schöbl"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openstapps/core-tools": "0.19.0",
|
"@openstapps/core-tools": "0.21.0",
|
||||||
"@types/geojson": "1.0.6",
|
"@types/geojson": "1.0.6",
|
||||||
"@types/json-patch": "0.0.30",
|
"@types/json-patch": "0.0.30",
|
||||||
"@types/json-schema": "7.0.7",
|
"@types/json-schema": "7.0.7",
|
||||||
"@types/node": "14.14.37",
|
"@types/node": "14.17.4",
|
||||||
"fast-clone": "1.5.13",
|
"fast-clone": "1.5.13",
|
||||||
"fast-deep-equal": "3.1.3",
|
"fast-deep-equal": "3.1.3",
|
||||||
"http-status-codes": "2.1.4",
|
"http-status-codes": "2.1.4",
|
||||||
@@ -57,14 +57,14 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@openstapps/configuration": "0.27.0",
|
"@openstapps/configuration": "0.27.0",
|
||||||
"@openstapps/logger": "0.6.0",
|
"@openstapps/logger": "0.7.0",
|
||||||
"@testdeck/mocha": "0.1.2",
|
"@testdeck/mocha": "0.1.2",
|
||||||
"@types/chai": "4.2.16",
|
"@types/chai": "4.2.19",
|
||||||
"@types/rimraf": "3.0.0",
|
"@types/rimraf": "3.0.0",
|
||||||
"chai": "4.3.4",
|
"chai": "4.3.4",
|
||||||
"conditional-type-checks": "1.0.5",
|
"conditional-type-checks": "1.0.5",
|
||||||
"conventional-changelog-cli": "2.1.1",
|
"conventional-changelog-cli": "2.1.1",
|
||||||
"mocha": "8.3.2",
|
"mocha": "8.4.0",
|
||||||
"nyc": "15.1.0",
|
"nyc": "15.1.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"source-map-support": "0.5.19",
|
"source-map-support": "0.5.19",
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when an internal server error occurred
|
* An error that is returned, when an internal server error occurred
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCInternalServerErrorResponse extends SCError {
|
export class SCInternalServerErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCMethodNotAllowedErrorResponse extends SCError {
|
export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned when the requested route or resource was not found
|
* An error that is returned when the requested route or resource was not found
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCNotFoundErrorResponse extends SCError {
|
export class SCNotFoundErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ 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
|
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
|
||||||
* acceptable.
|
* acceptable.
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCParametersNotAcceptable extends SCError {
|
export class SCParametersNotAcceptable extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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
|
* 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.
|
* running at the same time.
|
||||||
* This usually indicates that there is more than one instance a plugin running.
|
* This usually indicates that there is more than one instance a plugin running.
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned whenever there is an unexpected error while creating a plugin
|
* An error that is returned whenever there is an unexpected error while creating a plugin
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when the request body is too large.
|
* An error that is returned, when the request body is too large.
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned whenever there is a syntax error
|
* An error that is returned whenever there is a syntax error
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCSyntaxErrorResponse extends SCError {
|
export class SCSyntaxErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when to many request are submitted at once
|
* An error that is returned, when to many request are submitted at once
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned when the content type of the request is not supported
|
* An error that is returned when the content type of the request is not supported
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned when the validation of a request fails
|
* An error that is returned when the validation of a request fails
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCValidationErrorResponse extends SCError {
|
export class SCValidationErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
|||||||
];
|
];
|
||||||
this.method = SCRouteHttpVerbs.PUT;
|
this.method = SCRouteHttpVerbs.PUT;
|
||||||
this.obligatoryParameters = {
|
this.obligatoryParameters = {
|
||||||
TYPE: 'SCThingTypes',
|
TYPE: 'SCThingType',
|
||||||
UID: 'SCUuid',
|
UID: 'SCUuid',
|
||||||
};
|
};
|
||||||
this.requestBodyName = 'SCThingUpdateRequest';
|
this.requestBodyName = 'SCThingUpdateRequest';
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {SCMap} from '../../general/map';
|
|||||||
import {SCSearchAvailabilityFilter} from './filters/availability';
|
import {SCSearchAvailabilityFilter} from './filters/availability';
|
||||||
import {SCSearchBooleanFilter} from './filters/boolean';
|
import {SCSearchBooleanFilter} from './filters/boolean';
|
||||||
import {SCSearchDistanceFilter} from './filters/distance';
|
import {SCSearchDistanceFilter} from './filters/distance';
|
||||||
|
import {SCGeoFilter} from './filters/geo';
|
||||||
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
|
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
|
||||||
import {SCSearchValueFilter} from './filters/value';
|
import {SCSearchValueFilter} from './filters/value';
|
||||||
|
|
||||||
@@ -31,7 +32,8 @@ export type SCSearchFilterType =
|
|||||||
| 'distance'
|
| 'distance'
|
||||||
| 'value'
|
| 'value'
|
||||||
| 'date range'
|
| 'date range'
|
||||||
| 'numeric range';
|
| 'numeric range'
|
||||||
|
| 'geo';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure of a filter instruction
|
* Structure of a filter instruction
|
||||||
@@ -62,4 +64,5 @@ export type SCSearchFilter =
|
|||||||
| SCSearchDistanceFilter
|
| SCSearchDistanceFilter
|
||||||
| SCSearchValueFilter
|
| SCSearchValueFilter
|
||||||
| SCSearchNumericRangeFilter
|
| SCSearchNumericRangeFilter
|
||||||
| SCSearchDateRangeFilter;
|
| 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
|
* 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.
|
||||||
@@ -33,17 +33,17 @@ export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAva
|
|||||||
*/
|
*/
|
||||||
export interface SCAvailabilityFilterArguments extends SCSearchAbstractFilterArguments {
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
55
src/protocol/search/filters/geo.ts
Normal file
55
src/protocol/search/filters/geo.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
|
import {Polygon} 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';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 StApps
|
* Copyright (C) 2020-2021 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.
|
||||||
@@ -85,6 +85,15 @@ export interface SCRangeFilterArguments<T> extends SCSearchAbstractFilterArgumen
|
|||||||
* Field where the filter will be applied
|
* Field where the filter will be applied
|
||||||
*/
|
*/
|
||||||
field: SCThingsField;
|
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> {
|
export interface Bounds<T> {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments
|
|||||||
field: SCThingsField;
|
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[];
|
||||||
}
|
}
|
||||||
|
|||||||
64
src/things/abstract/range.ts
Normal file
64
src/things/abstract/range.ts
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* 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 {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;
|
||||||
|
} | {
|
||||||
|
// tslint:disable:completed-docs
|
||||||
|
gt?: T;
|
||||||
|
gte?: never;
|
||||||
|
lt?: T;
|
||||||
|
lte?: never;
|
||||||
|
} | {
|
||||||
|
gt?: T;
|
||||||
|
gte?: never;
|
||||||
|
lt?: never;
|
||||||
|
lte?: T;
|
||||||
|
} | {
|
||||||
|
gt?: never;
|
||||||
|
gte?: T;
|
||||||
|
lt?: T;
|
||||||
|
lte?: never;
|
||||||
|
// tslint:enable:completed-docs
|
||||||
|
};
|
||||||
@@ -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
|
* 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,10 +13,10 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCISO8601Date} from '../../general/time';
|
|
||||||
import {SCOrganizationWithoutReferences} from '../organization';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
import {SCPersonWithoutReferences} from '../person';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
import {SCInPlace} from './place';
|
import {SCInPlace} from './place';
|
||||||
|
import {SCISO8601DateRange} from './range';
|
||||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,14 +100,9 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
|
|||||||
availability: SCThingThatCanBeOfferedAvailability;
|
availability: SCThingThatCanBeOfferedAvailability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time when the thing becomes unavailable as an SCISO8601Date formatted string.
|
* The time when the thing is available.
|
||||||
*/
|
*/
|
||||||
availabilityEnds?: SCISO8601Date;
|
availabilityRange?: SCISO8601DateRange;
|
||||||
|
|
||||||
/**
|
|
||||||
* The time when the thing becomes available as an SCISO8601Date formatted string.
|
|
||||||
*/
|
|
||||||
availabilityStarts?: SCISO8601Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of prices that are distinct for specific groups
|
* List of prices that are distinct for specific groups
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export interface SCCatalogWithoutReferences
|
|||||||
*
|
*
|
||||||
* Needed for keeping order in catalog inheritance array.
|
* Needed for keeping order in catalog inheritance array.
|
||||||
*
|
*
|
||||||
|
* @filterable
|
||||||
* @integer
|
* @integer
|
||||||
*/
|
*/
|
||||||
level: number;
|
level: number;
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
/**
|
/**
|
||||||
* Frequency of the date series
|
* Frequency of the date series
|
||||||
*
|
*
|
||||||
* @keyword
|
* @filterable
|
||||||
*/
|
*/
|
||||||
frequency: string;
|
repeatFrequency?: SCISO8601Duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated properties
|
* Translated properties
|
||||||
@@ -131,7 +131,7 @@ export class SCDateSeriesMeta
|
|||||||
duration: 'Dauer',
|
duration: 'Dauer',
|
||||||
event: 'Event',
|
event: 'Event',
|
||||||
exceptions: 'Ausnahmen',
|
exceptions: 'Ausnahmen',
|
||||||
frequency: 'Frequenz',
|
repeatFrequency: 'Frequenz',
|
||||||
performers: 'Vortragende',
|
performers: 'Vortragende',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
@@ -143,7 +143,7 @@ export class SCDateSeriesMeta
|
|||||||
duration: 'duration',
|
duration: 'duration',
|
||||||
event: 'event',
|
event: 'event',
|
||||||
exceptions: 'exceptions',
|
exceptions: 'exceptions',
|
||||||
frequency: 'frequency',
|
repeatFrequency: 'frequency',
|
||||||
performers: 'performers',
|
performers: 'performers',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -174,8 +174,4 @@ export class SCDateSeriesMeta
|
|||||||
*/
|
*/
|
||||||
export interface SCDateSeriesTranslatableProperties
|
export interface SCDateSeriesTranslatableProperties
|
||||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
|
||||||
* @see SCDateSeriesWithoutReferences.frequency
|
|
||||||
*/
|
|
||||||
frequency?: string;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"frequency": "once",
|
"repeatFrequency": "P1W",
|
||||||
"dates": [
|
"dates": [
|
||||||
"2016-04-15T17:00:00+00:00"
|
"2016-04-15T17:00:00+00:00"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
"name": "EMH 225",
|
"name": "EMH 225",
|
||||||
"floorName": "2"
|
"floorName": "2"
|
||||||
},
|
},
|
||||||
"frequency": "once",
|
|
||||||
"dates": [
|
"dates": [
|
||||||
"2016-04-12T11:00:00+00:00"
|
"2016-04-12T11:00:00+00:00"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
"name": "EMH 225",
|
"name": "EMH 225",
|
||||||
"floorName": "2"
|
"floorName": "2"
|
||||||
},
|
},
|
||||||
"frequency": "once",
|
|
||||||
"dates": [
|
"dates": [
|
||||||
"2016-04-12T11:00:00+00:00"
|
"2016-04-12T11:00:00+00:00"
|
||||||
],
|
],
|
||||||
@@ -43,8 +42,10 @@
|
|||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
"availabilityStarts": "2017-01-30T00:00:00.000Z",
|
"availabilityRange": {
|
||||||
"availabilityEnds": "2017-01-30T23:59:59.999Z",
|
"gte": "2017-01-30T00:00:00.000Z",
|
||||||
|
"lte": "2017-01-30T23:59:59.999Z"
|
||||||
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
"default": 6.5,
|
"default": 6.5,
|
||||||
"student": 5,
|
"student": 5,
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
"availabilityStarts": "2017-01-30T00:00:00.000Z",
|
"availabilityRange": {
|
||||||
"availabilityEnds": "2017-01-30T23:59:59.999Z",
|
"gte": "2017-01-30T00:00:00.000Z",
|
||||||
|
"lte": "2017-01-30T23:59:59.999Z"
|
||||||
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
"default": 4.85,
|
"default": 4.85,
|
||||||
"student": 2.85,
|
"student": 2.85,
|
||||||
|
|||||||
@@ -20,8 +20,10 @@
|
|||||||
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
||||||
},
|
},
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
"availabilityStarts": "2017-01-30T00:00:00.000Z",
|
"availabilityRange": {
|
||||||
"availabilityEnds": "2017-01-30T23:59:59.999Z",
|
"gte": "2017-01-30T00:00:00.000Z",
|
||||||
|
"lte": "2017-01-30T23:59:59.999Z"
|
||||||
|
},
|
||||||
"inPlace": {
|
"inPlace": {
|
||||||
"geo": {
|
"geo": {
|
||||||
"point": {
|
"point": {
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
],
|
],
|
||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"availabilityEnds": "2017-03-27T23:59:59.000Z",
|
|
||||||
"availabilityStarts": "2017-03-27T00:00:00.000Z",
|
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
|
"availabilityRange": {
|
||||||
|
"gte": "2017-03-27T00:00:00.000Z",
|
||||||
|
"lte": "2017-03-27T23:59:59.000Z"
|
||||||
|
},
|
||||||
"inPlace": {
|
"inPlace": {
|
||||||
"type": "room",
|
"type": "room",
|
||||||
"name": "Cafeteria LEVEL",
|
"name": "Cafeteria LEVEL",
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"fromField": "availabilityStarts",
|
"scope": "d",
|
||||||
"toField": "availabilityEnds",
|
"field": "availabilityRange",
|
||||||
"time": "2018-01-15T04:13:00+00:00"
|
"time": "2018-01-15T04:13:00+00:00"
|
||||||
},
|
},
|
||||||
"type": "availability"
|
"type": "availability"
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ function getExtendedTypes(thingReflection: DeclarationReflection,
|
|||||||
return extendedTypes;
|
return extendedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@suite(timeout(10000), slow(5000))
|
@suite(timeout(15000), slow(10000))
|
||||||
export class SchemaSpec {
|
export class SchemaSpec {
|
||||||
static objects: { [name: string]: DeclarationReflection } = {};
|
static objects: { [name: string]: DeclarationReflection } = {};
|
||||||
static reflection: ProjectReflection;
|
static reflection: ProjectReflection;
|
||||||
|
|||||||
Reference in New Issue
Block a user