mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-03 20:12:51 +00:00
178 lines
4.5 KiB
TypeScript
178 lines
4.5 KiB
TypeScript
/*
|
|
* Copyright (C) 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 {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
|
import {SCISO8601Date, SCISO8601Duration} from '../general/time';
|
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
|
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
|
|
import {
|
|
SCAcademicPriceGroup,
|
|
SCThingThatCanBeOffered,
|
|
SCThingThatCanBeOfferedMeta,
|
|
SCThingThatCanBeOfferedTranslatableProperties,
|
|
SCThingThatCanBeOfferedWithoutReferences,
|
|
} from './abstract/thing-that-can-be-offered';
|
|
import {SCAcademicEventWithoutReferences} from './academic-event';
|
|
import {SCPersonWithoutReferences} from './person';
|
|
import {SCSportCourseWithoutReferences} from './sport-course';
|
|
|
|
/**
|
|
* Price groups for sport courses
|
|
*/
|
|
export interface SCSportCoursePriceGroup
|
|
extends SCAcademicPriceGroup {
|
|
/**
|
|
* Price for alumnis
|
|
*
|
|
* @float
|
|
*/
|
|
alumni?: number;
|
|
}
|
|
|
|
/**
|
|
* A date without references
|
|
*/
|
|
export interface SCDateSeriesWithoutReferences
|
|
extends SCThingThatCanBeOfferedWithoutReferences {
|
|
/**
|
|
* Dates of the date series that are initially planned to be held
|
|
*
|
|
* @filterable
|
|
*/
|
|
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
|
|
*
|
|
* @filterable
|
|
*/
|
|
repeatFrequency?: SCISO8601Duration;
|
|
|
|
/**
|
|
* Translated properties
|
|
*/
|
|
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
|
|
|
|
/**
|
|
* Type of a date series
|
|
*/
|
|
type: SCThingType.DateSeries;
|
|
}
|
|
|
|
/**
|
|
* A date series
|
|
*
|
|
* @validatable
|
|
* @indexable
|
|
*/
|
|
export interface SCDateSeries
|
|
extends SCDateSeriesWithoutReferences,
|
|
SCThingInPlace,
|
|
SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
|
|
/**
|
|
* 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: SCThingType.DateSeries;
|
|
}
|
|
|
|
/**
|
|
* Meta information about a date series
|
|
*/
|
|
export class SCDateSeriesMeta
|
|
extends SCThingMeta
|
|
implements SCMetaTranslations<SCDateSeries> {
|
|
/**
|
|
* Translations of fields
|
|
*/
|
|
fieldTranslations = {
|
|
de: {
|
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
|
.de,
|
|
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
|
.fieldTranslations.de,
|
|
dates: 'Einzeltermine',
|
|
duration: 'Dauer',
|
|
event: 'Event',
|
|
exceptions: 'Ausnahmen',
|
|
repeatFrequency: 'Frequenz',
|
|
performers: 'Vortragende',
|
|
},
|
|
en: {
|
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
|
|
.en,
|
|
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
|
.fieldTranslations.en,
|
|
dates: 'dates',
|
|
duration: 'duration',
|
|
event: 'event',
|
|
exceptions: 'exceptions',
|
|
repeatFrequency: 'frequency',
|
|
performers: 'performers',
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Translations of values of fields
|
|
*/
|
|
fieldValueTranslations = {
|
|
de: {
|
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
|
.fieldValueTranslations.de,
|
|
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
|
.fieldValueTranslations.de,
|
|
type: 'Terminserie',
|
|
},
|
|
en: {
|
|
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
|
|
.fieldValueTranslations.en,
|
|
...SCThingThatCanBeOfferedMeta.getInstance<SCSportCoursePriceGroup>()
|
|
.fieldValueTranslations.en,
|
|
type: SCThingType.DateSeries,
|
|
},
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Translatable properties of date series'
|
|
*/
|
|
export interface SCDateSeriesTranslatableProperties
|
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
|
}
|