Location
Expression Extends:
class Location extends aggregate(LocationModel, Helper)
Helper class representing a location object. Location must have, at a minimum, one of the following:
- latitude and longitude OR
- country, state, ZIP code, city, and address
Test:
- [unit] Location should handle location data with a normal json format
- [unit] Location should handle location data with json api format
- [unit] Location should generate json api format when converted to string
- [unit] Location should handle location data with a normal json format
- [unit] Location should handle location data with json api format
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) Constructor for helper class representing a Location |
Member Summary
Public Members | ||
public get |
|
|
public set |
|
Method Summary
Public Methods | ||
public |
Saves a location (insert if id doesn't exist, update if it does) |
|
public |
toJSON(): * |
Public Constructors
Public Methods
public async save(): Promise<Location> source
Saves a location (insert if id doesn't exist, update if it does)
Example:
import { Location, clinical6 } from 'clinical6';
// Inserts new role (no existing id)
const location = new Location({
"title": "Test Location",
"address_line_1": "New Hospital",
"address_line_3": "Unit #59",
"city": "Poway",
"state": "CA",
"country": "USA",
"zip_code": "92064"
});
location.save();
// Updates existing location(has existing id)
clinical6.get(Location).then(locations => locations[0].save());