fix: adjust model to remove references from things without references

Fixes #69
This commit is contained in:
Karl-Philipp Wulfert
2019-05-14 17:57:10 +02:00
parent da0507ee34
commit ca72c20bd0
36 changed files with 585 additions and 400 deletions

View File

@@ -12,7 +12,7 @@
* 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 {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCGeoInformation} from '../types/GeoInformation';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCPostalAddress} from '../types/PostalAddress';
@@ -20,7 +20,8 @@ import {SCPostalAddress} from '../types/PostalAddress';
/**
* A place without references
*/
export interface SCPlaceWithoutReferences extends SCThing {
export interface SCPlaceWithoutReferences
extends SCThingWithoutReferences {
/**
* Address of the place
*/
@@ -44,38 +45,53 @@ export interface SCPlaceWithoutReferences extends SCThing {
* Translated fields of a place
*/
translations?: SCTranslations<SCPlaceWithoutReferencesTranslatableProperties>;
}
export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties {
/**
* A place
*/
export interface SCPlace
extends SCPlaceWithoutReferences, SCThing {
/**
* Translated fields of a place
*/
translations?: SCTranslations<SCPlaceWithoutReferencesTranslatableProperties>;
}
/**
* Translatable properties of a place without references
*/
export interface SCPlaceWithoutReferencesTranslatableProperties
extends SCThingTranslatableProperties {
address?: SCPostalAddress;
}
/**
* Meta information about creative works
*/
export class SCPlaceWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> {
export class SCPlaceWithoutReferencesMeta
extends SCThingMeta implements SCMetaTranslations<SCPlaceWithoutReferences> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance().fieldTranslations.de,
},
en: {
... SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
fieldValueTranslations = {
de: {
... SCThingMeta.getInstance().fieldValueTranslations.de,
...SCThingMeta.getInstance().fieldValueTranslations.de,
},
en: {
... SCThingMeta.getInstance().fieldValueTranslations.en,
...SCThingMeta.getInstance().fieldValueTranslations.en,
},
};
}