mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
feat: add core
This commit is contained in:
125
src/core/things/DateSeries.ts
Normal file
125
src/core/things/DateSeries.ts
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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 {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta} 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
|
||||
*/
|
||||
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
|
||||
/**
|
||||
* Price for alumnis
|
||||
*/
|
||||
alumni: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date without references
|
||||
*/
|
||||
export interface SCDateSeriesWithoutReferences
|
||||
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
||||
/**
|
||||
* Dates of the date series that are initially planned to be held
|
||||
*/
|
||||
dates: SCISO8601Date[];
|
||||
|
||||
/**
|
||||
* Duration of the date series
|
||||
*/
|
||||
duration: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Dates that where initially planned to be held but are cancelled
|
||||
*/
|
||||
exceptions?: SCISO8601Date[];
|
||||
|
||||
/**
|
||||
* Frequency of the date series
|
||||
*/
|
||||
frequency: string;
|
||||
|
||||
/**
|
||||
* Translated properties
|
||||
*/
|
||||
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a date series
|
||||
*/
|
||||
type: SCDateSeriesType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date series
|
||||
*/
|
||||
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Event to which the date series belongs
|
||||
*/
|
||||
event: SCAcademicEventWithoutReferences
|
||||
| SCSportCourseWithoutReferences;
|
||||
|
||||
/**
|
||||
* Performers of the date series
|
||||
*/
|
||||
performers?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated properties
|
||||
*/
|
||||
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a date series
|
||||
*/
|
||||
type: SCDateSeriesType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date series meta data
|
||||
*/
|
||||
export class SCDateSeriesMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
dates: 'Einzeltermine',
|
||||
duration: 'Dauer',
|
||||
frequency: 'Wiederholung',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Translatable properties of date series'
|
||||
*/
|
||||
export interface SCDateSeriesTranslatableProperties
|
||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||
frequency?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user