mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
refactor: change meta class structure to include types.
Introduce requiredness of translations via implemented interface.
This commit is contained in:
committed by
Karl-Philipp Wulfert
parent
90e3d22399
commit
62975b9ded
@@ -12,14 +12,15 @@
|
||||
* 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 {SCEvent, SCEventWithoutReferences} from '../base/Event';
|
||||
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
SCThingWithCategoriesWithoutReferencesMeta,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* An academic event without references
|
||||
@@ -66,18 +67,6 @@ export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferenc
|
||||
type: SCThingType.AcademicEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event meta data
|
||||
*/
|
||||
export class SCAcademicEventMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
type: 'Event',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Categories of academic events
|
||||
*/
|
||||
@@ -111,3 +100,42 @@ export interface SCAcademicEventTranslatableProperties
|
||||
*/
|
||||
originalCategory?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about academic events
|
||||
*/
|
||||
export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations<SCAcademicEvent> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCEventMeta.getInstance().fieldTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCEventMeta.getInstance().fieldTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.de,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||
type: 'akademische Veranstaltung',
|
||||
},
|
||||
en: {
|
||||
... SCEventMeta.getInstance().fieldValueTranslations.en,
|
||||
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
|
||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||
type: SCThingType.AcademicEvent,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user