mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 01:22:54 +00:00
30
src/core/base/SaveableThing.ts
Normal file
30
src/core/base/SaveableThing.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018, 2019 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 {SCThing, SCThingUserOrigin} from '../Thing';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||||
|
*/
|
||||||
|
export interface SCSaveableThing<T extends SCThing> extends SCThing {
|
||||||
|
/**
|
||||||
|
* The contained data
|
||||||
|
*/
|
||||||
|
data: T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of the origin
|
||||||
|
*/
|
||||||
|
origin: SCThingUserOrigin;
|
||||||
|
}
|
||||||
@@ -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.
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
* 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 {SCThing, SCThingMeta, SCThingType} from '../Thing';
|
import {SCSaveableThing} from '../base/SaveableThing';
|
||||||
import {SCISO8601Date} from '../types/Time';
|
import {SCThingMeta, SCThingType} from '../Thing';
|
||||||
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
|
||||||
import {SCArticleWithoutReferences} from './Article';
|
import {SCArticleWithoutReferences} from './Article';
|
||||||
import {SCBookWithoutReferences} from './Book';
|
import {SCBookWithoutReferences} from './Book';
|
||||||
@@ -24,41 +24,9 @@ import {SCRoomWithoutReferences} from './Room';
|
|||||||
import {SCSportCourseWithoutReferences} from './SportCourse';
|
import {SCSportCourseWithoutReferences} from './SportCourse';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A favorite without references
|
* Types that can be made a favorite (added as a favorite)
|
||||||
*/
|
*/
|
||||||
export interface SCFavoriteWithoutReferences extends SCThing {
|
export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences
|
||||||
/**
|
|
||||||
* When the favorite was last changed.
|
|
||||||
*/
|
|
||||||
changed: SCISO8601Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When the favorite was created.
|
|
||||||
*/
|
|
||||||
created: SCISO8601Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If it is deleted or not, defaults to false.
|
|
||||||
*/
|
|
||||||
deleted?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of a favorite
|
|
||||||
*/
|
|
||||||
type: SCThingType.Favorite;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A favorite
|
|
||||||
*
|
|
||||||
* @validatable
|
|
||||||
*/
|
|
||||||
export interface SCFavorite extends SCFavoriteWithoutReferences {
|
|
||||||
/**
|
|
||||||
* The contained thing.
|
|
||||||
*/
|
|
||||||
data:
|
|
||||||
SCAcademicEventWithoutReferences
|
|
||||||
| SCArticleWithoutReferences
|
| SCArticleWithoutReferences
|
||||||
| SCBookWithoutReferences
|
| SCBookWithoutReferences
|
||||||
| SCBuildingWithoutReferences
|
| SCBuildingWithoutReferences
|
||||||
@@ -68,8 +36,11 @@ export interface SCFavorite extends SCFavoriteWithoutReferences {
|
|||||||
| SCSportCourseWithoutReferences;
|
| SCSportCourseWithoutReferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a favorite
|
* A favorite
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
|
export interface SCFavorite extends SCSaveableThing<SCFavoriteDataTypes> {
|
||||||
type: SCThingType.Favorite;
|
type: SCThingType.Favorite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user