ApproverGroup
Mixin Extends:
Helper class representing an approver group.
Example:
// To get a list of ApproverGroups use clinical6.get
import { clinical6, ApproverGroup } from 'clinical6';
clinical6.get(ApproverGroup).then(a => console.log(a));
// To get a single approverGroup, you can also use clinical6
clinical6.get({ id: 5, type: 'consent__approver_groups'});
// To save or insert, you can either use the .save() capability or clinical6
myApproverGroup.save(); // insert if no id, save if id
clinical6.insert(new ApproverGroup({...}));
clinical6.update(ApproverGroup);
// To delete you can use the .delete() capability or clinical6
myApproverGroup.delete();
clinical6.delete(myApproverGroup);
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) Constructor for helper class representing an ApproverGroup |
Member Summary
Public Members | ||
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
Method Summary
Public Methods | ||
public |
async addApprover(approver: ConsentApprover): Promise<ApproverAssignment This will create a ApproverAssignment and save it to the server based on this current approver and the approver parameter |
|
public |
async addFormVersion(formVersion: User): Promise<ApproverGroupAssignment This will create an ApproverGroupAssignment and save it to the server based on this current ApproverGroup and the Consent Form Version parameter |
|
public |
async getApproverAssignments(params: Object, options: String): Promise Gets the approver group assignment associated to this approver group. |
|
public |
async getApprovers(): Promise<ConsentApprover[]> Gets the list of approvers after calling this.getApproverAssignments() |
|
public |
async removeApprover(obj: ApproverAssignment | ConsentApprover): Promise Removes an assignment from a ApproverGroup. |
|
public |
async removeFormVersion(obj: ApproverGroupAssignment | ConsentFormVersion): Promise Removes an assignment from an ApproverGroup. |
|
public |
async save(): Promise<ApproverGroup> Saves an approverGroup (insert if id doesn't exist, update if it does) |
Inherited Summary
From class ApproverGroupModel | ||
public |
|
|
public |
|
|
public |
|
|
public |
|
Public Constructors
public constructor(json: Object) source
Constructor for helper class representing an ApproverGroup
Override:
ApproverGroupModel#constructorParams:
Name | Type | Attribute | Description |
json | Object | json api response from server |
Public Members
public get approvers: ConsentApprover[] source
public set approvers: ConsentApprover[] source
public get formVersions: ConsentFormVersion[] source
public set formVersions: ConsentFormVersion[] source
Public Methods
public async addApprover(approver: ConsentApprover): Promise<ApproverAssignment source
This will create a ApproverAssignment and save it to the server based on this current approver and the approver parameter
Params:
Name | Type | Attribute | Description |
approver | ConsentApprover | The approver to be added to this approver |
Return:
Promise<ApproverAssignment | Returns the approver assignment |
Example:
import { clinical6, ConsentApprover, ApproverGroup } from 'clinical6';
const approverAssignments = await clinical6.get(ApproverGroup);
const approver = new ConsentApprover({...}); // some new approver
const assignment = await approverAssignments[0].addApprover(approver);
public async addFormVersion(formVersion: User): Promise<ApproverGroupAssignment source
This will create an ApproverGroupAssignment and save it to the server based on this current ApproverGroup and the Consent Form Version parameter
Params:
Name | Type | Attribute | Description |
formVersion | User | The consent form version to be added to this Approver Group |
Return:
Promise<ApproverGroupAssignment | Returns the Approver Group Assignment |
Example:
import { clinical6, ConsentFormVersion, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const consentFormVersion = new ConsentFormVersion({...}); // some new ConsentFormVersion
const assignment = await approverGroups[0].addFormVersion(consentFormVersion);
public async getApproverAssignments(params: Object, options: String): Promise source
Gets the approver group assignment associated to this approver group.
Params:
Name | Type | Attribute | Description |
params | Object |
|
Parameters used to get information from server |
params.id | Number |
|
Id to get data from the server |
params.type | String |
|
Type to be used for storage |
params.filters | Object |
|
Filters to be used for get |
options | String |
|
Modify the nature of the call and response |
options.url | String |
|
Override the url for this call |
options.cacheMode | String |
|
Override the caching method for this call |
Example:
import { ApproverGroup, clinical6 } from 'clinical6';
const approverGroup = new ApproverGroup({ id: 23 });
approverGroup.getApproverAssignments({ id: 5 });
// Combined with clinical6.get
clinical6.get(ApproverGroup).then(approverGroups => { approverGroups[0].getAssignments() });
public async getApprovers(): Promise<ConsentApprover[]> source
Gets the list of approvers after calling this.getApproverAssignments()
Example:
import { clinical6, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const approvers = await approverGroups[0].getApprovers();
console.log(approvers);
public async removeApprover(obj: ApproverAssignment | ConsentApprover): Promise source
Removes an assignment from a ApproverGroup.
Params:
Name | Type | Attribute | Description |
obj | ApproverAssignment | ConsentApprover | Object that is to be removed from current ApproverGroup. |
Example:
import { clinical6, ConsentApprover, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const approver = new ConsentApprover({...}); // some new approver
const assignment = await approverGroups[0].removeApprover(approver);
public async removeFormVersion(obj: ApproverGroupAssignment | ConsentFormVersion): Promise source
Removes an assignment from an ApproverGroup.
Params:
Name | Type | Attribute | Description |
obj | ApproverGroupAssignment | ConsentFormVersion | Object that is to be removed from current ApproverGroup. |
Example:
import { clinical6, ConsentFormVersion, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const formVersion = new ConsentFormVersion({...}); // some new formVersion
const assignment = await approverGroups[0].removeFormVersion(formVersion);
public async save(): Promise<ApproverGroup> source
Saves an approverGroup (insert if id doesn't exist, update if it does)
Example:
import { ApproverGroup, clinical6 } from 'clinical6';
// Inserts new approver group (no existing id)
const approverGroup = new ApproverGroup({
"type": "consent__approver_groups",
"attributes": {
"name": "an approver group name"
}
});
approverGroup.save();
// Updates existing approverGroup(has existing id)
clinical6.get(ApproverGroup).then(capproverGroups => approverGroups[0].save());