The Social Tours API is based on the REST architecture. The API uses a predefined set of URLs to represent various resources, accepts form-endcoded responses, and uses standard HTTP response codes, authentication and verbs.
https://prod-socialtours.herokuapp.com/api
https://dbdiagram.io/d/5d4b8094ced98361d6dd6837
- findAll(table) ⇒
Database model to get all records in a table
- findAllbyId(table) ⇒
Database model to get all records in a table given some search criteria
- findById(table, id) ⇒
Database model to get a single record by id
- findByEmail(email) ⇒
Database model to get a user record by email
- addRecord(table, data) ⇒
Database model to add a record
- updateRecord(table, id, data) ⇒
Database method to update existing record
- removeRecord(table, id) ⇒
Database method to remove record from the database
Database model to get all records in a table
Kind: global function
Returns: array of table records
Param | Type |
---|---|
table | string |
Database model to get all records in a table given some search criteria
Kind: global function
Returns: array of table records
Param | Type |
---|---|
table | string |
columnName | string |
id | string |
Database model to get a single record by id
Kind: global function
Returns: database record
Param | Type |
---|---|
table | string |
id | integer |
Database model to get a user record by email
Kind: global function
Returns: database record
Param | Type |
---|---|
string |
Database model to add a record
Kind: global function
Returns: newly created record
Param | Type |
---|---|
table | string |
data | object |
Database method to update existing record
Kind: global function
Returns: updated record
Param | Type |
---|---|
table | string |
id | integer |
data | object |
Database method to remove record from the database
Kind: global function
Returns: deletion confirmation message in a json object
Param | Type |
---|---|
table | string |
id | integer |
Method | Endpoint | Description |
---|---|---|
POST | /register |
Registers a new user with the system. Requires 'email', and 'password'. |
Method | Endpoint | Description |
---|---|---|
GET | /users |
Retrieves an array of objects listing all users in the database. |
GET | /users/:id |
Retrieves a specific user based on the id. |
PUT | /users/:id |
Modifies an existing user. |
DELETE | /users/:id |
Delete a user. |
HTTP | Path | Description |
---|---|---|
GET | /api/events |
Retrieves an array of objects listing all events in the database. |
GET | /api/events/:id |
Retrieves a specific event based on the id. |
POST | /api/events |
Create a new event. |
PUT | /api/events/:id |
Modifies an existing event. |
DEL | /api/events/:id |
Delete an event. |
HTTP | Path | Description |
---|---|---|
GET | /api/schedules |
Retrieves an array of objects listing all scheduled events in the database. |
GET | /api/schedules/:id |
Retrieves a specific scheduled event based on the id. |
POST | /api/schedules |
Schedule an event. |
PUT | /api/schedules/:id |
Modifies an existing scheduled event. |
DEL | /api/schedules/:id |
Delete a scheduled event. |
HTTP | Path | Description |
---|---|---|
GET | /api/tickets |
Retrieves an array of objects listing all tickets in the database. |
GET | /api/tickets/:id |
Retrieves a specific ticket based on the id. |
POST | /api/tickets |
Create a new ticket. |
PUT | /api/tickets/:id |
Modifies an existing ticket. |
DEL | /api/tickets/:id |
Delete a ticket. |
HTTP | Path | Description |
---|---|---|
GET | /api/sales |
Retrieves an array of objects listing all ticket sales in the database. |
GET | /api/sales/:id |
Retrieves a specific ticket sale based on the id. |
POST | /api/sales |
Create a new ticket sale. |
PUT | /api/sales/:id |
Modifies an existing sales transaction. |
DEL | /api/sales/:id |
Delete a sales transaction. |
HTTP | Path | Description |
---|---|---|
GET | /api/subscritions |
Retrieves all subscriptions in the database. |
GET | /api/subscriptions/:id |
Retrieves all subscriptions for a specific user. |
POST | /api/subscriptions |
Create a new subscription. |
PUT | /api/subscriptions/:id |
Modifies an existing subscription. |
DEL | /api/subscriptions/:id |
Delete a subscription. |
Function which emails event notifications to Followers
Kind: global function
Returns: email message to Followers
Param | Type |
---|---|
recipients | string |
message | string |
subject | string |
Function which sends SMS via Twilio API
Kind: global function
Returns: SMS message
Param | Type |
---|---|
message | string |
userPhone | string |
Function which verifies phone numbers via Twilio API
Kind: global function
Param | Type |
---|---|
phoneNumber | string |
Updated September 26, 2019