Commit 13a49650 authored by Jovan Krunić's avatar Jovan Krunić
Browse files

feat: add different origin types: remote and user

Related to #12
parent e58d92e7
Loading
Loading
Loading
Loading
+48 −6
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ export interface SCThing {
  /**
   * Origin of the thing
   */
  origin: SCThingOrigin;
  origin: SCThingRemoteOrigin | SCThingUserOrigin;
  /**
   * Translations of specific values of the object
   *
@@ -96,15 +96,12 @@ export interface SCThing {
  url?: string;
}

export type SCThingOriginType = 'remote' | 'user';

/**
 * Origin of a thing
 */
export interface SCThingOrigin {
  /**
   * When the thing was indexed last from the origin
   */
  indexed: SCISO8601Date;

  /**
   * Maintainer of the origin
   *
@@ -117,6 +114,21 @@ export interface SCThingOrigin {
   */
  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
   */
@@ -134,12 +146,42 @@ export interface SCThingOrigin {
   */
  responsibleEntity?: SCPerson | SCOrganization;

  /**
   * Type of the origin
   */
  type: 'remote';

  /**
   * Main URL of the origin
   */
  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
 */