mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: every indexable thing can be a favorite
This commit is contained in:
committed by
Rainer Killinger
parent
2cf1027796
commit
4ab8770fbc
@@ -72,7 +72,7 @@ export const SCClasses: { [K in SCThingType]: object } = {
|
|||||||
'video': SCVideoMeta,
|
'video': SCVideoMeta,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SCThingsWithoutDiff =
|
export type SCIndexableThings =
|
||||||
SCAcademicEvent
|
SCAcademicEvent
|
||||||
| SCArticle
|
| SCArticle
|
||||||
| SCBook
|
| SCBook
|
||||||
@@ -82,7 +82,6 @@ export type SCThingsWithoutDiff =
|
|||||||
| SCCourseOfStudies
|
| SCCourseOfStudies
|
||||||
| SCDateSeries
|
| SCDateSeries
|
||||||
| SCDish
|
| SCDish
|
||||||
| SCFavorite
|
|
||||||
| SCFloor
|
| SCFloor
|
||||||
| SCMessage
|
| SCMessage
|
||||||
| SCOrganization
|
| SCOrganization
|
||||||
@@ -90,7 +89,6 @@ export type SCThingsWithoutDiff =
|
|||||||
| SCPointOfInterest
|
| SCPointOfInterest
|
||||||
| SCRoom
|
| SCRoom
|
||||||
| SCSemester
|
| SCSemester
|
||||||
| SCSetting
|
|
||||||
| SCSportCourse
|
| SCSportCourse
|
||||||
| SCStudyModule
|
| SCStudyModule
|
||||||
| SCTicket
|
| SCTicket
|
||||||
@@ -102,8 +100,8 @@ export type SCThingsWithoutDiff =
|
|||||||
* An object that exists in the StAppsCore
|
* An object that exists in the StAppsCore
|
||||||
*/
|
*/
|
||||||
export type SCThings =
|
export type SCThings =
|
||||||
SCThingsWithoutDiff
|
SCIndexableThings
|
||||||
| SCDiff;
|
| SCDiff | SCFavorite | SCSetting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A field of a thing
|
* A field of a thing
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCIndexableThings} from '../../meta';
|
||||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,18 +20,17 @@ import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
|||||||
*/
|
*/
|
||||||
export interface SCSaveableThingWithoutReferences
|
export interface SCSaveableThingWithoutReferences
|
||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
// noop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||||
*/
|
*/
|
||||||
export interface SCSaveableThing<T extends SCThingWithoutReferences>
|
export interface SCSaveableThing
|
||||||
extends SCSaveableThingWithoutReferences, SCThing {
|
extends SCSaveableThingWithoutReferences, SCThing {
|
||||||
/**
|
/**
|
||||||
* The contained data
|
* The contained data
|
||||||
*/
|
*/
|
||||||
data: T;
|
data: SCIndexableThings;
|
||||||
/**
|
/**
|
||||||
* Type of the origin
|
* Type of the origin
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
import * as jsonpatch from 'json-patch';
|
import * as jsonpatch from 'json-patch';
|
||||||
import {SCMetaTranslations} from '../general/i18n';
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {SCISO8601Date} from '../general/time';
|
import {SCISO8601Date} from '../general/time';
|
||||||
import {SCThingsWithoutDiff} from '../meta';
|
import {SCIndexableThings} from '../meta';
|
||||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,14 +48,13 @@ export interface SCDiffWithoutReferences
|
|||||||
* A diff
|
* A diff
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
* @indexable
|
|
||||||
*/
|
*/
|
||||||
export interface SCDiff
|
export interface SCDiff
|
||||||
extends SCDiffWithoutReferences, SCThing {
|
extends SCDiffWithoutReferences, SCThing {
|
||||||
/**
|
/**
|
||||||
* Original object the diff was generated on
|
* Original object the diff was generated on
|
||||||
*/
|
*/
|
||||||
object: SCThingsWithoutDiff;
|
object: SCIndexableThings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a diff
|
* Type of a diff
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -14,45 +14,24 @@
|
|||||||
*/
|
*/
|
||||||
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
||||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCAcademicEventWithoutReferences} from './academic-event';
|
|
||||||
import {SCArticleWithoutReferences} from './article';
|
|
||||||
import {SCBookWithoutReferences} from './book';
|
|
||||||
import {SCBuildingWithoutReferences} from './building';
|
|
||||||
import {SCPersonWithoutReferences} from './person';
|
|
||||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
|
||||||
import {SCRoomWithoutReferences} from './room';
|
|
||||||
import {SCSportCourseWithoutReferences} from './sport-course';
|
|
||||||
import {SCToDoWithoutReferences} from './todo';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Types that can be made a favorite (added as a favorite)
|
|
||||||
*/
|
|
||||||
export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences
|
|
||||||
| SCArticleWithoutReferences
|
|
||||||
| SCBookWithoutReferences
|
|
||||||
| SCBuildingWithoutReferences
|
|
||||||
| SCPersonWithoutReferences
|
|
||||||
| SCPointOfInterestWithoutReferences
|
|
||||||
| SCRoomWithoutReferences
|
|
||||||
| SCSportCourseWithoutReferences
|
|
||||||
| SCToDoWithoutReferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A favorite without references
|
* A favorite without references
|
||||||
*/
|
*/
|
||||||
export interface SCFavoriteWithoutReferences
|
export interface SCFavoriteWithoutReferences
|
||||||
extends SCSaveableThingWithoutReferences {
|
extends SCSaveableThingWithoutReferences {
|
||||||
// noop
|
/**
|
||||||
|
* Type of a favorite
|
||||||
|
*/
|
||||||
|
type: SCThingType.Favorite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A favorite
|
* A favorite
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
* @indexable
|
|
||||||
*/
|
*/
|
||||||
export interface SCFavorite
|
export interface SCFavorite extends SCSaveableThing {
|
||||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
|
||||||
/**
|
/**
|
||||||
* Type of a favorite
|
* Type of a favorite
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ export enum SCSettingInputType {
|
|||||||
* A setting with references
|
* A setting with references
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
* @indexable
|
|
||||||
*/
|
*/
|
||||||
export interface SCSetting
|
export interface SCSetting
|
||||||
extends SCSettingWithoutReferences, SCThing,
|
extends SCSettingWithoutReferences, SCThing,
|
||||||
|
|||||||
@@ -6,17 +6,67 @@
|
|||||||
"uid": "3af3ccaa-f066-5eff-9a3d-a70567f3d70d",
|
"uid": "3af3ccaa-f066-5eff-9a3d-a70567f3d70d",
|
||||||
"data": {
|
"data": {
|
||||||
"type": "academic event",
|
"type": "academic event",
|
||||||
"description": "Grundlagen, algebraische Grundbegriffe, Vektorräume, lineare Abbildungen und Gleichungen, Determinanten",
|
"description": "Fortsetzung der Algebra I: Galoistheorie mit Anwendungen, ausgewählte Spezialthemen.",
|
||||||
"uid": "b17eb963-42b5-5861-adce-2b7b2607ef0a",
|
"uid": "681a59a1-23c2-5d78-861a-8c86a3abf2b9",
|
||||||
"name": "Lineare Algebra I für Mathematiker",
|
"name": "Algebra II",
|
||||||
"categories": [
|
"categories": [
|
||||||
"lecture"
|
"lecture"
|
||||||
],
|
],
|
||||||
|
"academicTerms": [
|
||||||
|
{
|
||||||
|
"uid": "aacd5611-b5be-54ce-b39f-c52f7e9a631d",
|
||||||
|
"type": "semester",
|
||||||
|
"name": "Sommersemester 2018",
|
||||||
|
"acronym": "SS 2018",
|
||||||
|
"alternateNames": [
|
||||||
|
"SoSe 2018"
|
||||||
|
],
|
||||||
|
"startDate": "2018-04-01",
|
||||||
|
"endDate": "2018-09-30",
|
||||||
|
"eventsStartDate": "2018-04-09",
|
||||||
|
"eventsEndDate": "2018-07-13"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"performers": [
|
||||||
|
{
|
||||||
|
"type": "person",
|
||||||
|
"uid": "7f8ce700-2679-51a5-86b5-3dfba85a33ff",
|
||||||
|
"givenName": "Peter",
|
||||||
|
"familyName": "Bürgisser",
|
||||||
|
"gender": "male",
|
||||||
|
"honorificPrefix": "Prof. Dr.",
|
||||||
|
"name": "Peter Bürgisser"
|
||||||
|
}
|
||||||
|
],
|
||||||
"majors": [
|
"majors": [
|
||||||
"Wirtschaftsmathematik BSc",
|
"Mathematik D",
|
||||||
"Technomathematik BSc",
|
"Mathematik L2",
|
||||||
"Mathematik BSc"
|
"Mathematik StRGym",
|
||||||
]
|
"Mathematik StRBeruf",
|
||||||
|
"Mathematik BSc",
|
||||||
|
"Mathematik MSc"
|
||||||
|
],
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "Dummy",
|
||||||
|
"type": "remote",
|
||||||
|
"maintainer": {
|
||||||
|
"type": "organization",
|
||||||
|
"name": "tubIT",
|
||||||
|
"uid": "25f76840-db89-5da2-a8a2-75992f637613"
|
||||||
|
},
|
||||||
|
"modified": "2018-09-01T10:00:00Z",
|
||||||
|
"originalId": "foo bar",
|
||||||
|
"responsibleEntity": {
|
||||||
|
"type": "person",
|
||||||
|
"uid": "7f8ce700-2679-51a5-86b5-3dfba85a33ff",
|
||||||
|
"givenName": "Peter",
|
||||||
|
"familyName": "Bürgisser",
|
||||||
|
"gender": "male",
|
||||||
|
"honorificPrefix": "Prof. Dr.",
|
||||||
|
"name": "Peter Bürgisser"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"origin": {
|
"origin": {
|
||||||
"created": "2018-09-11T12:30:00Z",
|
"created": "2018-09-11T12:30:00Z",
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export class SchemaSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const thingsReflection = SchemaSpec.objects.SCThingsWithoutDiff;
|
const thingsReflection = SchemaSpec.objects.SCIndexableThings;
|
||||||
|
|
||||||
// tslint:disable-next-line:no-unused-expression
|
// tslint:disable-next-line:no-unused-expression
|
||||||
expect(thingsReflection).not.to.be.undefined;
|
expect(thingsReflection).not.to.be.undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user