Home Manual Reference Source
import ProjectLoader from 'pvbid-sdk/src/ProjectLoader.js'
public class | source

ProjectLoader

This class serves to quickly load a Project instance with included Bids

Constructor Summary

Public Constructor
public

constructor(pvbidContext: PVBidContext)

Creates an instance of ProjectLoader.

Member Summary

Public Members
public

context: *

Method Summary

Public Methods
public

async load(projectId: number, options: object): Promise<Project>

Loads a project and bid instances.

public

loadVirtualClone(project: Project, bidIds: number[]): Project

Generate a new project instance based on the original data from the given project.

Public Constructors

public constructor(pvbidContext: PVBidContext) source

Creates an instance of ProjectLoader.

Params:

NameTypeAttributeDescription
pvbidContext PVBidContext

Public Members

public context: * source

Public Methods

public async load(projectId: number, options: object): Promise<Project> source

Loads a project and bid instances.

Params:

NameTypeAttributeDescription
projectId number

The id of the project to be loaded

options object

Loading options

options.loadBidEntities boolean
  • optional
  • default: true

Determines if the bids should be loaded with their entities. They can be loaded later with bid.load() if

Return:

Promise<Project>

public loadVirtualClone(project: Project, bidIds: number[]): Project source

Generate a new project instance based on the original data from the given project. For safety, any methods involving repositories or persistance are absent in the clone.

Params:

NameTypeAttributeDescription
project Project

The project instance to make a virtual clone of.

bidIds number[]

Optionally limit the bids that get cloned into the virtual project clone by giving their IDs here.

Return:

Project