refactor: change meta class structure to include types.

Introduce requiredness of translations via implemented interface.
This commit is contained in:
Rainer Killinger
2019-02-06 14:21:46 +01:00
committed by Karl-Philipp Wulfert
parent 90e3d22399
commit 62975b9ded
32 changed files with 1060 additions and 246 deletions

View File

@@ -13,9 +13,9 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCThingInPlace} from '../base/ThingInPlace';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
@@ -61,12 +61,6 @@ export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
type: SCThingType.Floor;
}
/**
* Meta information about a floor
*/
export class SCFloorMeta extends SCThingMeta {
}
/**
* A feature collection
*/
@@ -98,3 +92,34 @@ export interface SCFloorTranslatableProperties extends SCThingTranslatableProper
*/
floorName?: string;
}
/**
* Meta information about floors
*/
export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFloor> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.de,
},
en: {
... SCThingInPlaceMeta.getInstance().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.de,
type: 'Etage',
},
en: {
... SCThingInPlaceMeta.getInstance().fieldValueTranslations.en,
type: SCThingType.Floor,
},
};
}