feat: add different origin types: remote and user

Related to #12
This commit is contained in:
Jovan Krunić
2018-12-18 22:34:29 +01:00
parent e58d92e781
commit 13a49650c4

View File

@@ -75,7 +75,7 @@ export interface SCThing {
/** /**
* Origin of the thing * Origin of the thing
*/ */
origin: SCThingOrigin; origin: SCThingRemoteOrigin | SCThingUserOrigin;
/** /**
* Translations of specific values of the object * Translations of specific values of the object
* *
@@ -96,15 +96,12 @@ export interface SCThing {
url?: string; url?: string;
} }
export type SCThingOriginType = 'remote' | 'user';
/** /**
* Origin of a thing * Origin of a thing
*/ */
export interface SCThingOrigin { export interface SCThingOrigin {
/**
* When the thing was indexed last from the origin
*/
indexed: SCISO8601Date;
/** /**
* Maintainer of the origin * Maintainer of the origin
* *
@@ -117,6 +114,21 @@ export interface SCThingOrigin {
*/ */
modified?: SCISO8601Date; modified?: SCISO8601Date;
/**
* Type of the origin
*/
type: SCThingOriginType;
}
/**
* Remote origin of a thing
*/
export interface SCThingRemoteOrigin extends SCThingOrigin {
/**
* When the thing was indexed last from the origin
*/
indexed: SCISO8601Date;
/** /**
* Name of the origin * Name of the origin
*/ */
@@ -134,12 +146,42 @@ export interface SCThingOrigin {
*/ */
responsibleEntity?: SCPerson | SCOrganization; responsibleEntity?: SCPerson | SCOrganization;
/**
* Type of the origin
*/
type: 'remote';
/** /**
* Main URL of the origin * Main URL of the origin
*/ */
url?: string; url?: string;
} }
/**
* User origin of a thing (data created through user interaction)
*/
export interface SCThingUserOrigin extends SCThingOrigin {
/**
* When the thing was created
*/
created: SCISO8601Date;
/**
* If it is deleted or not, defaults to false
*/
deleted?: boolean;
/**
* Type of the origin
*/
type: 'user';
/**
* When the saved thing was last updated with the latest state (e.g. from the backend)
*/
updated?: SCISO8601Date;
}
/** /**
* Meta information about things * Meta information about things
*/ */