diff --git a/src/core/Thing.ts b/src/core/Thing.ts index 82e4fd92..6ecf2bee 100644 --- a/src/core/Thing.ts +++ b/src/core/Thing.ts @@ -23,29 +23,31 @@ import {SCUuid} from './types/UUID'; /** * Types a thing can be */ -export type SCThingTypes = 'article' - | 'academic event' - | 'book' - | 'building' - | 'catalog' - | 'course of studies' - | 'date series' - | 'diff' - | 'dish' - | 'favorite' - | 'floor' - | 'message' - | 'offer' - | 'organization' - | 'person' - | 'point of interest' - | 'room' - | 'semester' - | 'setting' - | 'sport course' - | 'ticket' - | 'tour' - | 'video'; +export enum SCThingType { + AcademicEvent = 'academic event', + Article = 'article', + Book = 'book', + Building = 'building', + Catalog = 'catalog', + CourseOfStudies = 'course of studies', + DateSeries = 'date series', + Diff = 'diff', + Dish = 'dish', + Favorite = 'favorite', + Floor = 'floor', + Message = 'message', + Offer = 'offer', // Currently not in use + Organization = 'organization', + Person = 'person', + PointOfInterest = 'point of interest', + Room = 'room', + Semester = 'semester', + Setting = 'setting', + SportCourse = 'sport course', + Ticket = 'ticket', + Tour = 'tour', + Video = 'video', +} /** * A thing @@ -84,7 +86,7 @@ export interface SCThing { /** * Type of the thing */ - type: SCThingTypes; + type: string; /** * Universally unique identifier of the thing */ diff --git a/src/core/protocol/routes/bulk/BulkRequest.ts b/src/core/protocol/routes/bulk/BulkRequest.ts index c53a113f..6e7f1a94 100644 --- a/src/core/protocol/routes/bulk/BulkRequest.ts +++ b/src/core/protocol/routes/bulk/BulkRequest.ts @@ -13,7 +13,6 @@ * this program. If not, see . */ import {SCAbstractRoute} from '../../../Route'; -import {SCThingTypes} from '../../../Thing'; import {SCISO8601Date} from '../../../types/Time'; /** @@ -45,9 +44,11 @@ export interface SCBulkParameters { source: string; /** - * Type of things that are indexed in this bulk + * Type of things that are indexed in this bulk. + * + * String is an element of the SCThingType enumeration. */ - type: SCThingTypes; + type: string; } /** diff --git a/src/core/things/AcademicEvent.ts b/src/core/things/AcademicEvent.ts index 4c642e62..63ccdce1 100644 --- a/src/core/things/AcademicEvent.ts +++ b/src/core/things/AcademicEvent.ts @@ -18,14 +18,9 @@ import { SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; -/** - * Type of an academic event - */ -export type SCAcademicEventType = 'academic event'; - /** * An academic event without references */ @@ -51,7 +46,7 @@ export interface SCAcademicEventWithoutReferences /** * Type of an academic event */ - type: SCAcademicEventType; + type: SCThingType.AcademicEvent; } export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences { @@ -63,7 +58,7 @@ export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferenc /** * Type of an academic event */ - type: SCAcademicEventType; + type: SCThingType.AcademicEvent; } /** diff --git a/src/core/things/Article.ts b/src/core/things/Article.ts index ae7e8f8e..6bc3f044 100644 --- a/src/core/things/Article.ts +++ b/src/core/things/Article.ts @@ -22,14 +22,9 @@ import { SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; -/** - * Type of an article - */ -export type SCArticleType = 'article'; - /** * An article without references */ @@ -50,7 +45,7 @@ export interface SCArticleWithoutReferences /** * Type of an article */ - type: SCArticleType; + type: SCThingType.Article; } /** @@ -65,7 +60,7 @@ export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences { /** * Type of an article */ - type: SCArticleType; + type: SCThingType.Article; } /** diff --git a/src/core/things/Book.ts b/src/core/things/Book.ts index 47229740..27a6142f 100644 --- a/src/core/things/Book.ts +++ b/src/core/things/Book.ts @@ -18,15 +18,10 @@ import { SCCreativeWorkWithoutReferences, } from '../base/CreativeWork'; import {SCThingWithCategoriesTranslatableProperties} from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; import {SCPersonWithoutReferences} from './Person'; -/** - * Type of a book - */ -export type SCBookType = 'book'; - /** * A book without references */ @@ -54,7 +49,7 @@ export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences /** * Type of a book */ - type: SCBookType; + type: SCThingType.Book; } /** @@ -74,7 +69,7 @@ export interface SCBook extends SCCreativeWork, SCBookWithoutReferences { /** * Type of a book */ - type: SCBookType; + type: SCThingType.Book; } /** diff --git a/src/core/things/Building.ts b/src/core/things/Building.ts index c7c3b668..fa9acf5a 100644 --- a/src/core/things/Building.ts +++ b/src/core/things/Building.ts @@ -18,11 +18,9 @@ import { SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; -export type SCBuildingType = 'building'; - export type SCBuildingCategories = 'cafe' | 'education' @@ -55,10 +53,14 @@ export interface SCBuildingWithoutReferences /** * Type of the building */ - type: SCBuildingType; + type: SCThingType.Building; } export interface SCBuilding extends SCBuildingWithoutReferences { + /** + * Type of the building + */ + type: SCThingType.Building; } /** diff --git a/src/core/things/Catalog.ts b/src/core/things/Catalog.ts index 5f6c1434..2465ccec 100644 --- a/src/core/things/Catalog.ts +++ b/src/core/things/Catalog.ts @@ -14,12 +14,7 @@ */ import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm'; import {SCThingWithCategoriesSpecificValues, SCThingWithCategoriesWithoutReferences} from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; - -/** - * Type of a catalog - */ -export type SCCatalogType = 'catalog'; +import {SCThingMeta, SCThingType} from '../Thing'; /** * A catalog without references @@ -37,7 +32,7 @@ export interface SCCatalogWithoutReferences /** * Type of a catalog */ - type: SCCatalogType; + type: SCThingType.Catalog; } /** @@ -58,6 +53,11 @@ export interface SCCatalog extends SCCatalogWithoutReferences { * An array of catalogs from the 'level 0' (root) catalog to the direct parent */ superCatalogs?: SCCatalogWithoutReferences[]; + + /** + * Type of a catalog + */ + type: SCThingType.Catalog; } /** diff --git a/src/core/things/CourseOfStudies.ts b/src/core/things/CourseOfStudies.ts index 92422c71..3cbe8123 100644 --- a/src/core/things/CourseOfStudies.ts +++ b/src/core/things/CourseOfStudies.ts @@ -16,16 +16,11 @@ import {SCAcademicDegree} from '../base/AcademicDegree'; import {SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCLanguage, SCTranslations} from '../types/i18n'; import {SCDateSeriesWithoutReferences} from './DateSeries'; import {SCOrganization} from './Organization'; -/** - * Type of a course of studies - */ -export type SCCourseOfStudiesType = 'course of studies'; - /** * A course of studies without references */ @@ -61,7 +56,7 @@ export interface SCCourseOfStudiesWithoutReferences extends /** * Type of the course of studies */ - type: SCCourseOfStudiesType; + type: SCThingType.CourseOfStudies; } /** @@ -83,6 +78,11 @@ export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences { * Dates at which the course of studies is planned to start */ startDates?: SCDateSeriesWithoutReferences[]; + + /** + * Type of the course of studies + */ + type: SCThingType.CourseOfStudies; } export interface SCCourseOfStudiesTranslatableProperties diff --git a/src/core/things/DateSeries.ts b/src/core/things/DateSeries.ts index 1051e41e..87046c4b 100644 --- a/src/core/things/DateSeries.ts +++ b/src/core/things/DateSeries.ts @@ -18,18 +18,13 @@ import { SCThingThatCanBeOffered, SCThingThatCanBeOfferedTranslatableProperties, } from '../base/ThingThatCanBeOffered'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; import {SCISO8601Date, SCISO8601Duration} from '../types/Time'; import {SCAcademicEventWithoutReferences} from './AcademicEvent'; import {SCPersonWithoutReferences} from './Person'; import {SCSportCourseWithoutReferences} from './SportCourse'; -/** - * Type of a date series - */ -export type SCDateSeriesType = 'date series'; - /** * Price groups for sport courses */ @@ -73,7 +68,7 @@ export interface SCDateSeriesWithoutReferences /** * Type of a date series */ - type: SCDateSeriesType; + type: SCThingType.DateSeries; } /** @@ -99,7 +94,7 @@ export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPl /** * Type of a date series */ - type: SCDateSeriesType; + type: SCThingType.DateSeries; } /** diff --git a/src/core/things/Diff.ts b/src/core/things/Diff.ts index e5cb9534..28036a17 100644 --- a/src/core/things/Diff.ts +++ b/src/core/things/Diff.ts @@ -13,14 +13,9 @@ * this program. If not, see . */ import {SCThingsWithoutDiff} from '../Classes'; -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; import {SCISO8601Date} from '../types/Time'; -/** - * Type of a diff - */ -export type SCDiffType = 'diff'; - /** * A diff without references */ @@ -43,7 +38,7 @@ export interface SCDiffWithoutReferences extends SCThing { /** * Type of a diff */ - type: SCDiffType; + type: SCThingType.Diff; } /** @@ -54,6 +49,11 @@ export interface SCDiff extends SCDiffWithoutReferences { * Original object the diff was generated on */ object: SCThingsWithoutDiff; + + /** + * Type of a diff + */ + type: SCThingType.Diff; } /** diff --git a/src/core/things/Dish.ts b/src/core/things/Dish.ts index d05218d3..983565e7 100644 --- a/src/core/things/Dish.ts +++ b/src/core/things/Dish.ts @@ -23,14 +23,9 @@ import { SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; -/** - * Type of a dish - */ -export type SCDishType = 'dish'; - /** * A dish without references */ @@ -66,7 +61,7 @@ export interface SCDishWithoutReferences /** * Type of a dish */ - type: SCDishType; + type: SCThingType.Dish; } /** @@ -86,7 +81,7 @@ export interface SCDish extends SCDishWithoutReferences, SCThingInPlace { /** * Type of a dish */ - type: SCDishType; + type: SCThingType.Dish; } export interface SCDishTranslatableProperties diff --git a/src/core/things/Favorite.ts b/src/core/things/Favorite.ts index 63a2acab..e2715660 100644 --- a/src/core/things/Favorite.ts +++ b/src/core/things/Favorite.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; import {SCISO8601Date} from '../types/Time'; import {SCAcademicEventWithoutReferences} from './AcademicEvent'; import {SCArticleWithoutReferences} from './Article'; @@ -23,11 +23,6 @@ import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCRoomWithoutReferences} from './Room'; import {SCSportCourseWithoutReferences} from './SportCourse'; -/** - * Type of a favorite - */ -export type SCFavoriteType = 'favorite'; - /** * A favorite without references */ @@ -50,7 +45,7 @@ export interface SCFavoriteWithoutReferences extends SCThing { /** * Type of a favorite */ - type: SCFavoriteType; + type: SCThingType.Favorite; } /** @@ -69,6 +64,11 @@ export interface SCFavorite extends SCFavoriteWithoutReferences { | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences | SCSportCourseWithoutReferences; + + /** + * Type of a favorite + */ + type: SCThingType.Favorite; } /** diff --git a/src/core/things/Floor.ts b/src/core/things/Floor.ts index a9f16c1c..45f00bd7 100644 --- a/src/core/things/Floor.ts +++ b/src/core/things/Floor.ts @@ -14,16 +14,11 @@ */ import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson'; import {SCThingInPlace} from '../base/ThingInPlace'; -import {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing'; +import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCRoomWithoutReferences} from './Room'; -/** - * Type of a floor - */ -export type SCFloorType = 'floor'; - /** * A floor without references */ @@ -46,7 +41,7 @@ export interface SCFloorWithoutReferences extends SCThing { /** * Type of a floor */ - type: SCFloorType; + type: SCThingType.Floor; } /** @@ -61,7 +56,7 @@ export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace { /** * Type of a floor */ - type: SCFloorType; + type: SCThingType.Floor; } /** diff --git a/src/core/things/Message.ts b/src/core/things/Message.ts index 0f646c37..5ac97d03 100644 --- a/src/core/things/Message.ts +++ b/src/core/things/Message.ts @@ -18,15 +18,10 @@ import { SCCreativeWorkWithoutReferences, } from '../base/CreativeWork'; import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; import {SCISO8601Date} from '../types/Time'; -/** - * Type of a message - */ -export type SCMessageType = 'message'; - /** * A message without references */ @@ -54,7 +49,7 @@ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferen /** * Type of a message */ - type: SCMessageType; + type: SCThingType.Message; } /** @@ -69,7 +64,7 @@ export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences { /** * Type of a message */ - type: SCMessageType; + type: SCThingType.Message; } /** diff --git a/src/core/things/Organization.ts b/src/core/things/Organization.ts index fd05de3d..5b6506b8 100644 --- a/src/core/things/Organization.ts +++ b/src/core/things/Organization.ts @@ -13,12 +13,7 @@ * this program. If not, see . */ import {SCThingInPlace} from '../base/ThingInPlace'; -import {SCThing, SCThingMeta} from '../Thing'; - -/** - * Type of an organization - */ -export type SCOrganizationType = 'organization'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; /** * An organization without references @@ -27,7 +22,7 @@ export interface SCOrganizationWithoutReferences extends SCThing { /** * Type of an organization */ - type: SCOrganizationType; + type: SCThingType.Organization; } /** @@ -37,7 +32,7 @@ export interface SCOrganization extends SCOrganizationWithoutReferences, SCThing /** * Type of an organization */ - type: SCOrganizationType; + type: SCThingType.Organization; } /** diff --git a/src/core/things/Person.ts b/src/core/things/Person.ts index 9a98a59b..7fc214d3 100644 --- a/src/core/things/Person.ts +++ b/src/core/things/Person.ts @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; import {SCNationality} from '../types/i18n'; import {SCISO8601Date} from '../types/Time'; import {SCBuildingWithoutReferences} from './Building'; @@ -20,11 +20,6 @@ import {SCOrganizationWithoutReferences} from './Organization'; import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCRoomWithoutReferences} from './Room'; -/** - * Type of a person - */ -export type SCPersonType = 'person'; - /** * A person without references */ @@ -99,7 +94,7 @@ export interface SCPersonWithoutReferences extends SCThing { /** * Type of a person */ - type: SCPersonType; + type: SCThingType.Person; } /** @@ -118,6 +113,11 @@ export interface SCPerson extends SCPersonWithoutReferences { | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences>; + /** + * Type of a person + */ + type: SCThingType.Person; + /** * Locations where the person performs her/his work */ diff --git a/src/core/things/PointOfInterest.ts b/src/core/things/PointOfInterest.ts index 24c00d69..c26026c1 100644 --- a/src/core/things/PointOfInterest.ts +++ b/src/core/things/PointOfInterest.ts @@ -19,14 +19,9 @@ import { SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; -/** - * Type of a point of interest - */ -export type SCPointOfInterestType = 'point of interest'; - /** * A point of interest without references */ @@ -42,7 +37,7 @@ export interface SCPointOfInterestWithoutReferences /** * Type of a point of interest */ - type: SCPointOfInterestType; + type: SCThingType.PointOfInterest; } /** @@ -57,7 +52,7 @@ export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, S /** * Type of a point of interest */ - type: SCPointOfInterestType; + type: SCThingType.PointOfInterest; } /** diff --git a/src/core/things/Room.ts b/src/core/things/Room.ts index 6a1f6d3e..d17811d6 100644 --- a/src/core/things/Room.ts +++ b/src/core/things/Room.ts @@ -20,14 +20,9 @@ import { SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCTranslations} from '../types/i18n'; -/** - * Type of a room - */ -export type SCRoomType = 'room'; - /** * Categories of a room */ @@ -70,7 +65,7 @@ export interface SCRoomWithoutReferences /** * Type of the room */ - type: SCRoomType; + type: SCThingType.Room; } /** @@ -87,7 +82,7 @@ export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace { /** * Type of the room */ - type: SCRoomType; + type: SCThingType.Room; } /** diff --git a/src/core/things/Semester.ts b/src/core/things/Semester.ts index 0e2857c3..24cbb02b 100644 --- a/src/core/things/Semester.ts +++ b/src/core/things/Semester.ts @@ -13,12 +13,7 @@ * this program. If not, see . */ import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm'; -import {SCThingMeta} from '../Thing'; - -/** - * Type of a semester - */ -export type SCSemesterType = 'semester'; +import {SCThingMeta, SCThingType} from '../Thing'; /** * A semester without references @@ -34,13 +29,17 @@ export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutRefere /** * Type of the semester */ - type: SCSemesterType; + type: SCThingType.Semester; } /** * A semester */ export interface SCSemester extends SCSemesterWithoutReferences { + /** + * Type of the semester + */ + type: SCThingType.Semester; } /** diff --git a/src/core/things/Setting.ts b/src/core/things/Setting.ts index 1364b21a..95d2e78f 100644 --- a/src/core/things/Setting.ts +++ b/src/core/things/Setting.ts @@ -16,10 +16,9 @@ import { SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, } from '../base/ThingWithCategories'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import { SCTranslations } from '../types/i18n'; -export type SCSettingType = 'setting'; export type SCSettingCategories = string; /** @@ -43,7 +42,7 @@ export interface SCSettingWithoutReferences /** * The type of this model */ - type: SCSettingType; + type: SCThingType.Setting; } /** @@ -59,6 +58,10 @@ export type SCSettingInputType = SCSettingSingleChoice * A setting with references */ export interface SCSetting extends SCSettingWithoutReferences { + /** + * The type of this model + */ + type: SCThingType.Setting; } /** diff --git a/src/core/things/SportCourse.ts b/src/core/things/SportCourse.ts index b32f0ca3..1be50c30 100644 --- a/src/core/things/SportCourse.ts +++ b/src/core/things/SportCourse.ts @@ -13,12 +13,7 @@ * this program. If not, see . */ import {SCEvent, SCEventWithoutReferences} from '../base/Event'; -import {SCThingMeta} from '../Thing'; - -/** - * Type of a sport course - */ -export type SCSportCourseType = 'sport course'; +import {SCThingMeta, SCThingType} from '../Thing'; /** * A sport course without references @@ -27,7 +22,7 @@ export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences /** * Type of a sport course */ - type: SCSportCourseType; + type: SCThingType.SportCourse; } /** @@ -37,7 +32,7 @@ export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences { /** * Type of a sport course */ - type: SCSportCourseType; + type: SCThingType.SportCourse; } /** diff --git a/src/core/things/Ticket.ts b/src/core/things/Ticket.ts index 27570175..519b018d 100644 --- a/src/core/things/Ticket.ts +++ b/src/core/things/Ticket.ts @@ -13,14 +13,9 @@ * this program. If not, see . */ import {SCThingInPlace} from '../base/ThingInPlace'; -import {SCThing, SCThingMeta} from '../Thing'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; import {SCISO8601Duration} from '../types/Time'; -/** - * Type of a ticket - */ -export type SCTicketType = 'ticket'; - /** * A ticket without references */ @@ -43,7 +38,7 @@ export interface SCTicketWithoutReferences extends SCThing { /** * Type of a ticket */ - type: SCTicketType; + type: SCThingType.Ticket; } /** @@ -53,7 +48,7 @@ export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace { /** * Type of a ticket */ - type: SCTicketType; + type: SCThingType.Ticket; } /** diff --git a/src/core/things/Tour.ts b/src/core/things/Tour.ts index c222cb68..3d5ee2e3 100644 --- a/src/core/things/Tour.ts +++ b/src/core/things/Tour.ts @@ -12,12 +12,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThing, SCThingMeta} from '../Thing'; - -/** - * Type of a tour - */ -export type SCTourType = 'tour'; +import {SCThing, SCThingMeta, SCThingType} from '../Thing'; /** * A tour without references @@ -36,13 +31,17 @@ export interface SCTourWithoutReferences extends SCThing { /** * Type of a tour */ - type: SCTourType; + type: SCThingType.Tour; } /** * A tour */ export interface SCTour extends SCTourWithoutReferences { + /** + * Type of a tour + */ + type: SCThingType.Tour; } /** diff --git a/src/core/things/Video.ts b/src/core/things/Video.ts index f570f9c3..c7cf72a1 100644 --- a/src/core/things/Video.ts +++ b/src/core/things/Video.ts @@ -13,16 +13,11 @@ * this program. If not, see . */ import {SCCreativeWork, SCCreativeWorkWithoutReferences} from '../base/CreativeWork'; -import {SCThingMeta} from '../Thing'; +import {SCThingMeta, SCThingType} from '../Thing'; import {SCLanguage} from '../types/i18n'; import {SCISO8601Duration} from '../types/Time'; import {SCPersonWithoutReferences} from './Person'; -/** - * Type of a video - */ -export type SCVideoType = 'video'; - /** * A video without references */ @@ -55,7 +50,7 @@ export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReference /** * Type of an Video */ - type: SCVideoType; + type: SCThingType.Video; } export interface SCVideoSource { @@ -114,7 +109,7 @@ export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences { /** * Type of a video */ - type: SCVideoType; + type: SCThingType.Video; } export class SCVideoMeta extends SCThingMeta { diff --git a/src/core/types/config/Backend.ts b/src/core/types/config/Backend.ts index c30f2cf8..67d47f8c 100644 --- a/src/core/types/config/Backend.ts +++ b/src/core/types/config/Backend.ts @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {SCThingTypes} from '../../Thing'; import {SCSearchSortType} from '../sorts/Abstract'; import {SCUuid} from '../UUID'; import {SCMonitoringConfiguration} from './Monitoring'; @@ -25,8 +24,10 @@ export interface SCBackendConfiguration { * A list of hidden SC types * * If a type is hidden it won't show in any result unless the type is filtered for + * + * Strings must be elements of the SCThingType enumeration. */ - hiddenTypes: SCThingTypes[]; + hiddenTypes: string[]; /** * Name of university @@ -63,7 +64,7 @@ export interface SCBackendConfigurationSortableField { * * If no type is given it is assumed it exists on every type */ - onlyOnTypes?: SCThingTypes[]; + onlyOnTypes?: string[]; /** * A list of supported sorts on this field @@ -110,7 +111,7 @@ export interface SCBackendConfigurationSearchBoosting { /** * Type of things the factor should be applied to */ - type: SCThingTypes; + type: string; } /** @@ -127,7 +128,7 @@ export interface SCBackendAggregationConfiguration { * * If the type is not given is is assumed the field exists on every type */ - onlyOnTypes?: SCThingTypes[]; + onlyOnTypes?: string[]; } /**