mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +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,
|
||||
};
|
||||
|
||||
export type SCThingsWithoutDiff =
|
||||
export type SCIndexableThings =
|
||||
SCAcademicEvent
|
||||
| SCArticle
|
||||
| SCBook
|
||||
@@ -82,7 +82,6 @@ export type SCThingsWithoutDiff =
|
||||
| SCCourseOfStudies
|
||||
| SCDateSeries
|
||||
| SCDish
|
||||
| SCFavorite
|
||||
| SCFloor
|
||||
| SCMessage
|
||||
| SCOrganization
|
||||
@@ -90,7 +89,6 @@ export type SCThingsWithoutDiff =
|
||||
| SCPointOfInterest
|
||||
| SCRoom
|
||||
| SCSemester
|
||||
| SCSetting
|
||||
| SCSportCourse
|
||||
| SCStudyModule
|
||||
| SCTicket
|
||||
@@ -102,8 +100,8 @@ export type SCThingsWithoutDiff =
|
||||
* An object that exists in the StAppsCore
|
||||
*/
|
||||
export type SCThings =
|
||||
SCThingsWithoutDiff
|
||||
| SCDiff;
|
||||
SCIndexableThings
|
||||
| SCDiff | SCFavorite | SCSetting;
|
||||
|
||||
/**
|
||||
* A field of a thing
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* 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 {SCIndexableThings} from '../../meta';
|
||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||
|
||||
/**
|
||||
@@ -19,18 +20,17 @@ import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||
*/
|
||||
export interface SCSaveableThingWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
/**
|
||||
* The contained data
|
||||
*/
|
||||
data: T;
|
||||
data: SCIndexableThings;
|
||||
/**
|
||||
* Type of the origin
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import * as jsonpatch from 'json-patch';
|
||||
import {SCMetaTranslations} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThingsWithoutDiff} from '../meta';
|
||||
import {SCIndexableThings} from '../meta';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
|
||||
/**
|
||||
@@ -48,14 +48,13 @@ export interface SCDiffWithoutReferences
|
||||
* A diff
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCDiff
|
||||
extends SCDiffWithoutReferences, SCThing {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
object: SCThingsWithoutDiff;
|
||||
object: SCIndexableThings;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -14,45 +14,24 @@
|
||||
*/
|
||||
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-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
|
||||
*/
|
||||
export interface SCFavoriteWithoutReferences
|
||||
extends SCSaveableThingWithoutReferences {
|
||||
// noop
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
type: SCThingType.Favorite;
|
||||
}
|
||||
|
||||
/**
|
||||
* A favorite
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCFavorite
|
||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
||||
export interface SCFavorite extends SCSaveableThing {
|
||||
/**
|
||||
* Type of a favorite
|
||||
*/
|
||||
|
||||
@@ -84,7 +84,6 @@ export enum SCSettingInputType {
|
||||
* A setting with references
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCSetting
|
||||
extends SCSettingWithoutReferences, SCThing,
|
||||
|
||||
@@ -6,17 +6,67 @@
|
||||
"uid": "3af3ccaa-f066-5eff-9a3d-a70567f3d70d",
|
||||
"data": {
|
||||
"type": "academic event",
|
||||
"description": "Grundlagen, algebraische Grundbegriffe, Vektorräume, lineare Abbildungen und Gleichungen, Determinanten",
|
||||
"uid": "b17eb963-42b5-5861-adce-2b7b2607ef0a",
|
||||
"name": "Lineare Algebra I für Mathematiker",
|
||||
"description": "Fortsetzung der Algebra I: Galoistheorie mit Anwendungen, ausgewählte Spezialthemen.",
|
||||
"uid": "681a59a1-23c2-5d78-861a-8c86a3abf2b9",
|
||||
"name": "Algebra II",
|
||||
"categories": [
|
||||
"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": [
|
||||
"Wirtschaftsmathematik BSc",
|
||||
"Technomathematik BSc",
|
||||
"Mathematik BSc"
|
||||
]
|
||||
"Mathematik D",
|
||||
"Mathematik L2",
|
||||
"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": {
|
||||
"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
|
||||
expect(thingsReflection).not.to.be.undefined;
|
||||
|
||||
Reference in New Issue
Block a user