Home Manual Reference Source
public class | source

BidService

Constructor Summary

Public Constructor
public

Creates an instance of BidService.

Member Summary

Public Members
public

context: *

public

Method Summary

Public Methods
public

async addAssemblies(bid: Bid, assemblyMapIds: number[]): Promise<Object[]>

Adds assemblies to bid.

public

async addDynamicGroup(bid: Bid, title: string): Promise<DynamicGroup>

Adds a new Dynamic Group to the Bid.

public

async addField(bid: Bid, title: string, type: string): Promise<Field>

Adds a new field to the bid.

public

async addLineItem(bid: Bid, title: string): Promise<LineItem>

Adds a new line item to the bid.

public

async addMetric(bid: Bid, title: string): Promise<Metric>

Adds a new metric to the bid.

public

async clone(bid: Bid): Promise<Bid>

Clones bid returning an initialized Bid

public

async createSnapshot(bid: Bid, title: string, description: string): Promise<object>

Creates a snapshot of the current bid.

public

async deleteBid(bid: Bid): Promise<null>

Deletes bid.

public

async moveBidToProject(originalBid: *, project: *): Promise<*>

Moves a bid to a project by first detaching the bid from its original project, then moves the bid to a given project by attaching the project id to the bid.

public

async recoverBid(bid: Bid, snapshotId: number): Promise<null>

Recovers a bid from a snapshot.

public

async reload(bid: Bid): Bid

Reload a bid with all of its entities while maintaining the same instance.

public

async removeAssembly(bid: Bid, assemblyId: number): Promise<null>

Removes assembly from a bid.

public

validate(bid: Bid): object[]

Validates bid structure and references.

Public Constructors

public constructor(context: PVBidContext) source

Creates an instance of BidService.

Params:

NameTypeAttributeDescription
context PVBidContext

Public Members

public context: * source

public repositories: * source

Public Methods

public async addAssemblies(bid: Bid, assemblyMapIds: number[]): Promise<Object[]> source

Adds assemblies to bid.

Params:

NameTypeAttributeDescription
bid Bid
assemblyMapIds number[]

An array of assembly mapping ids to add.

Return:

Promise<Object[]>

Array of created bid entities

public async addDynamicGroup(bid: Bid, title: string): Promise<DynamicGroup> source

Adds a new Dynamic Group to the Bid.

Params:

NameTypeAttributeDescription
bid Bid
title string
  • optional
  • default: "New Dynamic Group"

Return:

Promise<DynamicGroup>

public async addField(bid: Bid, title: string, type: string): Promise<Field> source

Adds a new field to the bid.

Params:

NameTypeAttributeDescription
bid Bid
title string
  • optional
  • default: New Field
type string
  • optional
  • default: number

Return:

Promise<Field>

public async addLineItem(bid: Bid, title: string): Promise<LineItem> source

Adds a new line item to the bid. The added line item is uncategorized in all component groups.

Params:

NameTypeAttributeDescription
bid Bid
title string
  • optional
  • default: New Line Item

Return:

Promise<LineItem>

public async addMetric(bid: Bid, title: string): Promise<Metric> source

Adds a new metric to the bid.

Params:

NameTypeAttributeDescription
bid Bid
title string
  • optional
  • default: New Metric

Return:

Promise<Metric>

public async clone(bid: Bid): Promise<Bid> source

Clones bid returning an initialized Bid

Params:

NameTypeAttributeDescription
bid Bid

Return:

Promise<Bid>

public async createSnapshot(bid: Bid, title: string, description: string): Promise<object> source

Creates a snapshot of the current bid.

Params:

NameTypeAttributeDescription
bid Bid
title string
  • nullable: true

Title of the snapshot

description string
  • nullable: true

Description of the snapshot.

Return:

Promise<object>

Return Properties:

NameTypeAttributeDescription
id number

The snapshot id.

title string
bid_id number
description string
is_auto boolean

A flag to indicate the snapshot was generated automatically by the PVBid system.

created_at string

Example format: 2016-04-10T21:08:05+00:00

public async deleteBid(bid: Bid): Promise<null> source

Deletes bid.

Params:

NameTypeAttributeDescription
bid Bid

Return:

Promise<null>

public async moveBidToProject(originalBid: *, project: *): Promise<*> source

Moves a bid to a project by first detaching the bid from its original project, then moves the bid to a given project by attaching the project id to the bid.

Reassessing the projects after moving.

Params:

NameTypeAttributeDescription
originalBid *
project *

Return:

Promise<*>

public async recoverBid(bid: Bid, snapshotId: number): Promise<null> source

Recovers a bid from a snapshot. An auto snapshot of the current state will be created.

Params:

NameTypeAttributeDescription
bid Bid
snapshotId number

Return:

Promise<null>

public async reload(bid: Bid): Bid source

Reload a bid with all of its entities while maintaining the same instance.

Params:

NameTypeAttributeDescription
bid Bid

Return:

Bid

public async removeAssembly(bid: Bid, assemblyId: number): Promise<null> source

Removes assembly from a bid.

Params:

NameTypeAttributeDescription
bid Bid
assemblyId number

Return:

Promise<null>

public validate(bid: Bid): object[] source

Validates bid structure and references.

Params:

NameTypeAttributeDescription
bid Bid

Return:

object[]

Returns an array of validation errors.