mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-11 12:12:55 +00:00
138 lines
3.7 KiB
TypeScript
138 lines
3.7 KiB
TypeScript
/*
|
|
* Copyright (C) 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.
|
|
*
|
|
* 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 {
|
|
SCCreativeWork,
|
|
SCCreativeWorkMeta,
|
|
SCCreativeWorkTranslatableProperties,
|
|
SCCreativeWorkWithoutReferences,
|
|
} from './abstract/creative-work';
|
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
|
import {
|
|
SCThingWithCategoriesSpecificValues,
|
|
SCThingWithCategoriesTranslatableProperties,
|
|
SCThingWithCategoriesWithoutReferences,
|
|
SCThingWithCategoriesWithoutReferencesMeta,
|
|
} from './abstract/thing-with-categories';
|
|
|
|
/**
|
|
* Categories of a periodical
|
|
*/
|
|
export type SCPeriodicalCategories = 'journal' | 'electronic';
|
|
|
|
/**
|
|
* A periodical without references
|
|
*/
|
|
export interface SCPeriodicalWithoutReferences
|
|
extends SCCreativeWorkWithoutReferences,
|
|
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
|
|
/**
|
|
* Categories of a periodical
|
|
*/
|
|
categories: SCPeriodicalCategories[];
|
|
/**
|
|
* A list of ISSNs of a periodical
|
|
*
|
|
* @filterable
|
|
* @keyword
|
|
*/
|
|
ISSNs?: string[];
|
|
|
|
/**
|
|
* Translated properties of a periodical
|
|
*/
|
|
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
|
|
|
/**
|
|
* Type of a periodical
|
|
*/
|
|
type: SCThingType.Periodical;
|
|
}
|
|
|
|
/**
|
|
* A publication published at regular intervals (e.g. a magazine or newspaper)
|
|
*
|
|
* @validatable
|
|
* @indexable
|
|
*/
|
|
export interface SCPeriodical
|
|
extends SCCreativeWork, SCPeriodicalWithoutReferences {
|
|
/**
|
|
* Translated properties of a periodical
|
|
*/
|
|
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
|
|
|
/**
|
|
* Type of a periodical
|
|
*/
|
|
type: SCThingType.Periodical;
|
|
}
|
|
|
|
/**
|
|
* Translatable properties of a periodical
|
|
*/
|
|
export interface SCPeriodicalTranslatableFields
|
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
|
}
|
|
|
|
/**
|
|
* Meta information about a periodical
|
|
*/
|
|
export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<SCPeriodical> {
|
|
/**
|
|
* Translations of fields
|
|
*/
|
|
fieldTranslations = {
|
|
de: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de,
|
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories,
|
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
|
categories: 'Format',
|
|
ISSNs: 'ISSN',
|
|
},
|
|
en: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en,
|
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories,
|
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
|
categories: 'format',
|
|
ISSNs: 'ISSN',
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Translations of values of fields
|
|
*/
|
|
fieldValueTranslations = {
|
|
de: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
|
.fieldValueTranslations.de,
|
|
type: 'Periodikum',
|
|
categories: {
|
|
electronic: 'E-Journal',
|
|
journal: 'Zeitschrift',
|
|
},
|
|
},
|
|
en: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
|
.fieldValueTranslations.en,
|
|
type: 'periodical',
|
|
categories: {
|
|
electronic: 'E-Journal',
|
|
journal: 'journal',
|
|
},
|
|
},
|
|
};
|
|
}
|