import CohortAssignment from 'clinical6/src/helpers/cohort/CohortAssignment.js'
CohortAssignment
Mixin Extends:
Helper class representing an cohortAssignment.
Example:
// To get a list of Cohort Assignments you must have the cohort first, then get it based on this cohort
import { clinical6, CohortAssignment } from 'clinical6';
const cohort = new Cohort({...}); // get the cohort in some way
cohort.getAssignments().then(a => console.log(a)); // use getAssignments
clinical6.getChildren(cohort, CohortAssignment).then(a => console.log(a)); // or using get children
// To get a single cohort, you can also use clinical6
clinical6.get({ id: 5, type: 'cohort_assignments'});
// To save or insert, you can either use the .save() capability or clinical6
myCohortAssignment.save(); // insert if no id, save if id
clinical6.insert(new CohortAssignment({...}));
clinical6.update(myCohortAssignment);
// To delete, use clinical6 or .delete();
myCohortAssignment.delete();
clinical6.delete(myCohortAssignment);
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) Constructor for helper class representing an CohortAssignment |
Member Summary
Public Members | ||
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
Method Summary
Public Methods | ||
public |
Deletes a cohortAssignment |
|
public |
Saves a cohortAssignment (insert if id doesn't exist, update if it does) |
Inherited Summary
From class CohortAssignmentModel | ||
public |
|
|
public |
|
|
public |
|
Public Constructors
public constructor(json: Object) source
Constructor for helper class representing an CohortAssignment
Override:
CohortAssignmentModel#constructorParams:
Name | Type | Attribute | Description |
json | Object | json api response from server |
Public Members
Public Methods
public delete(): Promise source
Deletes a cohortAssignment
Example:
import { CohortAssignment, Client } from 'clinical6';
// Removes cohortAssignment from server and local storage
const cohortAssignment = new CohortAssignment({...});
cohortAssignment.delete();
// No longer in storage
Client.instance.storageUtility.has('cohort_assignments', { id: 1 });
public save(): Promise<CohortAssignment> source
Saves a cohortAssignment (insert if id doesn't exist, update if it does)
Example:
import { CohortAssignment, clinical6 } from 'clinical6';
// Insert is different from other inserts. Uses mobile application key
const cohortAssignment = new CohortAssignment({...});
cohortAssignment.save();
// After you have the authtoken and then you've logged in
// Updates existing cohortAssignment (has existing id)
clinical6.get(CohortAssignment).then(cohortAssignments => cohortAssignments[0].save());