This schema defines the GraphQL structure used to return GRP information. GRP defines a God Related Place, and it stores location information, schedules, names, and contributors.
This module defines the main methods to create, validate, get different information related to a GRP, etc. Most if not all DB operations for GRPs should go thru method defined here.
This method adds timestamps updated/created to the input GRP, then it validated the input GRP and if nothing is incorrect it is stored in mongo.
(Object)
the object to be validated and stored
This method get the current time, and adds that time as both the created and updated properties.
(Object)
a GRP object
This method changes the updated field of a GRP to the current time
(Object)
a GRP object
This method generates count number of dates from to until. The dates are generated based on the recurrences stored within the GRP schedules. All of these are retrieved and based on that all of the schedules are generated.
(Object)
a GRP object
(Number)
an integer specifying the max number of dates that can be generated
(Date)
the starting date from which to generate dates.
(Date)
the ending date until which to generate dates.
(any)
Array<Date>
:
the calculated dates
This method returns a promise to a Mongo Collection of GRP. The method will make sure to connect to the DB before returning the collection.
Promise<Collection>
:
a Mongo DB Collection
This is a resolver function as defined in Apollo's resolver docs it will return a promise which should return an array of GRPs if the function succesfully queried the DB.
(undefined)
takes nothing as the first input this is to ignore context
(Object)
parameters to the searchGrps query function
Name | Description |
---|---|
parms.name String?
|
the name of the GRP where order and spaces don't matter |
parms.polygon Object?
|
A polygon represention using coordinates |
parms.point Array<Float>?
|
An array [ lat,lon ] specifying the coordinates of a point |
parms.sortBy String?
|
A String specifying the order by which to sort eg. TIME, BEST, etc. |
parms.city String?
|
A String specifying the name of a city (case, accent's, etc don't matter) |
parms.state String?
|
A String specifying the name of a state (case, accent's, etc don't matter) |
parms.first Number?
|
A Number for the 'first' number of GRPs to return |
parms.after String?
|
An opaque ID String specifying the offset from the 0's result of the query |
Promise<Array<Object>>
:
the GRPs from search