profile and authentication information. All other models reference their owner through a user property.
profile: Profile,
authid: {
facebook: String,
google: String
},
stripe: StripeAccount,
admin: Boolean
#### Lot
A Lot is simply a collection of Spots that share a common user. The Lot's price, availability, and location are used as defaults for new Spots. The name of a Lot is only shown to the owner (for easy management) while the description will be displayed publicly.
User: User
attendants: [User]
location: Location,
price: Price,
available: Ranger,
name: String,
description: String
#### Spot
A Spot can be booked by users for a set period of time. Once a Spot is created you cannot modify the location. Modifying the price of a Spot will not modify existing Bookings. Associating a Spot with a Lot will overwrite the Spot's location with the one in the Lot. The name of a Spot is only shown to the owner (for easy management) while the description will be displayed publicly.
user: User,
attendants: [User],
lot: Lot,
name: String,
reserved: Boolean,
location: Location,
price: Price,
available: Ranger,
booked: Ranger,
description: String
#### Booking
A Booking is an immutable object that is used to track bookings on a Spot. Once a Booking is created you cannot modify the spot, price, start, nor end properties. The status defaults to `unpaid` and will change to `paid` once payment has been succesfuly processed. A Booking's price is calculated using it's duration (calculated using it's start and end properties) multiplied by the price of the Spot that it is associated with. All Bookings must have a spot. The lot for a Booking must be left empty unless the Spot is generic, then the Booking's lot must be set.
user: User,
car: Car,
lot: Lot,
spot: Spot,
status: BookingStatus,
price: Price,
start: Date,
end: Date,
------------
## Authentication
Certain API routes requre a JWT and/or the associated user to have certain privelages. The specific requirements for each route are listed below.
In order to make API calls that are auth protected use the following flow:
1. Authenticate with a 3rd party authentication server of your choice. Currently supported options:
- Facebook
- Google
2. Hit `POST /auth/:strat` with an access_token as supplied by the social network you are authenticating with
3. You will receieve a JWT in the response if authentication was successful after one of the following operations has completed:
- A user was found in db
- A new user was created
4. Set an `Authorizaton` header with the `JWT` scheme (as in: `Authorization: JWT | public | Anyone can access this route |
| authorized | A valid JWT must be provided |
| attendant | You must be an attendant that is specified on the resource |
| owner | You must be an owner of the resource (user id is set in the resource's user property) |
| admin | You must be an admin |
| status | One word status description: ERROR or SUCCESS. |
| message | Optional for ERROR responses. Contains some response message describe the back-end operation that took place |
| errors | Array of strings containing the different errors that occured. Sometimes present on SUCCESS responses as well when performing an action on a collection and some documents succeeded while others did not |
| data | Any data being returned by the server as per the request |
| Security | public |
| address | The address you wish to geocode |
| Security | public |
| strat | The social network with which to authenticate. Can be one of: ['facebook', 'google']. |
| access_token | The access token as provided by the social network |
| security | admin |
| security | authorized |
| security | admin |
| security | admin |
| security | admin |
| security | admin |
| security | admin |
| Profile properties | |
| name | Name of the User |
| security | admin |
account object.
| security | admin |
customer object.
| security | admin |
| security | admin |
| security | owner |
| security | owner |
| security | owner |
| security | owner |
| security | owner |
| token | The card token to use as the source of payment |
| security | attendant |
| security | authorized |
| count | Number of Lots to create (defaults to 1) |
| location | An object containing a coordinates property with the coordinates of the location of the LotCan either be a number array of [longitude, latitude] or
an object containing long or lon and lat and properties |
| (optional) price | A price object containing the price breakdown for the Lot (to be used as a default for the Lot's spots) |
| lot | An object containing the properties you want to intiate the Lot(s) with (if this is used the rest of the request body except count is ignored) |
| security | attendant |
| security | owner |
| name | The new name for the lot |
| description | The new description for the lot |
| price | The new price object for the lot (only needs to have the price divisions you wish to update) |
| security | attendant |
| security | owner |
| security | owner |
| attendants | The id's of User's to add as attendants |
| security | owner |
| start | The start of the range to add |
| end | The end of the range to add |
| interval | (optional - required for recuring ranges) The interval (in ms) at which to repeat this range |
| count | (optional - required for recuring ranges) The number of times to repeat the recuring range |
| finish | (optional - required for recuring ranges) The limit at which to stop repeating the recuring range |
| schedules | An array of schedules each with start, end, and optionally interval and either count or finish. If using an array, the rest of the body of the request will be ignored. |
count (of reptitions) or finish (final upper limit) must be set if using a recuring range.
| security | owner |
| start | The start of the range to remove |
| end | The end of the range to remove |
| interval | (optional - required for recuring ranges) The interval (in ms) at which to repeat this range |
| count | (optional - required for recuring ranges) The number of times to repeat the recuring range |
| finish | (optional - required for recuring ranges) The limit at which to stop repeating the recuring range |
| schedules | An array of schedules each with start, end, and optionally interval and either count or finish. If using an array, the rest of the body of the request will be ignored. |
count (of reptitions) or finish (final upper limit) must be set if using a recuring range.
| security | attendant |
| security | authorized |
| location | An object containing an address: String property with the address of the Spot; this address will be geocoded again to retrieve a uniform formattedAddress and coordinates
|
| price | A price object containing the price breakdown for the Spot (to be used as a default for the Spot's Spots) |
| (optional) lot | Either the id or the entire Lot object of the lot to associate with this Spot (* when this property is provided, price and location properties are attempted to be retrieved from the Lot object) |
| (optional) Spot | An object containing the properties you want to intiate the Spot(s) with (if this is used the rest of the request body except count is ignored) |
| (optional) count | Number of Spots to create (defaults to 1) |
| security | public |
| long | Longitude of the target location |
| lat | Latitude of the target location | available | A datetime during which this Spot should be available (if unassigned then current time is used) |
| count | Number of Spots to return |
| security | attendant |
| security | owner |
| name | The new name for the lot |
| description | The new description for the lot |
| price | The new price object for the lot (only needs to have the price divisions you wish to update) |
| security | attendant |
| security | owner |
| security | owner |
| attendants | The id's of User's to add as attendants |
| security | attendant |
| security | attendant |
| start | The start of the booking |
| end | The end of the booking |
| bookings | The Booking object(s) to add, can be either a single Booking object or an Array of them that must include properties start and end (when this is used, the rest of the request body is ignored)
|
| security | attendant |
| id | The id of the booking |
| (used instead of id) start | The start of the booking |
| (used instead of id) end | The end of the booking |
| bookings | The Booking object(s) to remove, can be either a single Booking object or an Array of them that must include properties start and end or an id (when this is used, the rest of the request body is ignored)
|
| security | owner |
| start | The start of the range to add |
| end | The end of the range to add |
| interval | (optional - required for recuring ranges) The interval (in ms) at which to repeat this range |
| count | (optional - required for recuring ranges) The number of times to repeat the recuring range |
| finish | (optional - required for recuring ranges) The limit at which to stop repeating the recuring range |
| schedules | An array of schedules each with start, end, and optionally interval and either count or finish. If using an array, the rest of the body of the request will be ignored. |
count (of reptitions) or finish (final upper limit) must be set if using a recuring range.
| security | owner |
| start | The start of the range to remove |
| end | The end of the range to remove |
| interval | (optional - required for recuring ranges) The interval (in ms) at which to repeat this range |
| count | (optional - required for recuring ranges) The number of times to repeat the recuring range |
| finish | (optional - required for recuring ranges) The limit at which to stop repeating the recuring range |
| schedules | An array of schedules each with start, end, and optionally interval and either count or finish. If using an array, the rest of the body of the request will be ignored. |
count (of reptitions) or finish (final upper limit) must be set if using a recuring range.