Interface SiteRepositoryInterface

The RestRepository retreives resources from the database through the REST API.

A full list of resources can be fetched by calling findAll and a specific resource by calling findOne.

interface SiteRepositoryInterface {
    create(): SiteInterface;
    filter(params: RestFilterInterface): Promise<SiteInterface[]>;
    findAll(forceFetch?: boolean): Promise<SiteInterface[]>;
    findByLocation(location: Vector3): Promise<SiteInterface>;
    findOne(id: number, forceFetch?: boolean): Promise<SiteInterface>;
    remove(item: SiteInterface): Promise<void>;
    save(items: SiteInterface | SiteInterface[]): Promise<SiteInterface[]>;
}

Hierarchy (view full)

Methods

  • Gets all repository items. The cached data will be returned if the data has been fetched before. Using the forceFetch parameter, a user can order a fresh copy to be fetched from the server.

    Parameters

    • OptionalforceFetch: boolean

      Whether to bypass the cache and retrieve a fresh copy from the server.

    Returns Promise<SiteInterface[]>

    Promise with the repository items.

  • Returns the site that is closest to the specified global coordinate.

    Parameters

    • location: Vector3

      Location of the site in WGS 84

    Returns Promise<SiteInterface>

    Promise that resolves with the site

  • Get one repository item by id. The cached data will be returned if the data has been fetched before. Use the forceFetch parameter to retrieve a fresh copy from the server. In case a new record is fetched, the data and dataMap will be updated accordingly.

    Parameters

    • id: number

      Identifier of the repository item

    • OptionalforceFetch: boolean

      Whether to bypass the cache and retrieve a fresh copy from the server.

    Returns Promise<SiteInterface>

  • Deletes an item from the repository.

    Parameters

    Returns Promise<void>

    Promise that resolves once the request has completed.