Giter VIP home page Giter VIP logo

conference-connect's Introduction

confcon

Installation

Clone the repository and run:

npm install  

Set the following environment variables:

  • MONGO_URI -- should point to a mongoDB connection. Ex: mongodb://localhost/conference-connect
  • APP_SECRET -- a string used to generate tokens
  • PORT -- what port you would the app to run on. The default if none is specified is 9000. This can also be specified in the command line as an option to index.js.

Then, run:

npm start

The default user is Admin and the default password is 'password'. You are encouraged to create a new user, set it as admin, and delete Admin immediately.

Things you can do with the REST API

VALIDATE
SIGN UP
SIGN IN

The following endpoints require a valid token, provided with sign up or sign in

VIEW POSTS
VIEW POSTS PAGINATED
POSTCOUNT
CREATE POST
DELETE POST
UPDATE POST

VIEW USERS
VIEW USER DETAIL
CREATE USER
DELETE USER
UPDATE USER

VIEW AGENDA
ADD AGENDA ITEM
DELETE AGENDA ITEM

VIEW EVENTS
VIEW EVENT DETAIL
CREATE EVENT
DELETE EVENT
UPDATE EVENT

VIEW TOPIC
CREATE TOPIC
DELETE TOPIC
UPDATE TOPIC

UPDATE CONFIG


VALIDATE

URL: /validate
Method: GET Description: returns true if a user is valid, and true if the user is an admin. Authorized roles: N/A
Inputs:

  • token -- Supplied in the header.

Outputs:

  • valid: boolean
  • admin: boolean

SIGN UP

URL: /signup
Method: POST Description: Creates a new user and returns a token. The token must be included in all API calls in the header as the VALUE for the KEY 'token'.
Authorized roles: N/A
Inputs:

  • username --the username must be unique. an error will be returned if the username if found in the database.
  • password --The password is encrypted before saved to database.
  • email (OPTIONAL)
  • organization (OPTIONAL)
  • roles (OPTIONAL) --an admin role can only be assigned with the CREATE USER or UPDATE USER end points
  • profile_twitter_username

Outputs:

  • token

SIGN IN

URL: /signin
Method: POST
Description: If the login returns a successful authentication, a token is returned. The token must be included in all API calls in the header as the VALUE for the KEY 'token'.
Authorized roles: N/A
Inputs:

  • username
  • password --The password is encrypted before saved to database.

Outputs:

  • token

The following endpoints require a valid token, provided with sign up or sign in

VIEW POSTS

URL: /api/post/list
Method: GET
Description: Returns posts in reverse chronological order, includes all posts. Authorized roles: attendee, admin

Outputs:

  • id
  • body --the full text of the post
  • user --name of poster
  • topics --all associated topics
  • event --name of associated event
  • link --HTTP link associated with post
  • edit_history --array of datetimes of edits, an empty array if has never been edited
  • creation_date --timestamp of creation date

VIEW POSTS PAGINATED

URL: /api/post/list/[perPage]/[page]
Method: GET
Description: Returns posts in reverse chronological order, includes [perPage] posts, offset by [page].
Authorized roles: attendee, admin

Outputs:

  • id
  • body --the full text of the post
  • user --name of poster
  • topics --all associated topics
  • event --name of associated event
  • link --HTTP link associated with post
  • edit_history --array of datetimes of edits, an empty array if has never been edited
  • creation_date --timestamp of creation date

POSTCOUNT

URL: /api/postcount
Method: GET
Description: Returns the total number of posts
Authorized roles: attendee, admin

Outputs:

  • integer

CREATE POST

URL: /api/post
Method: POST
Description: Creates a new message board post, returns post details with id.
Authorized roles: admin, attendee
Inputs:

  • body --text body of message
  • user_id --id of User making the post
  • topic_ids (OPTIONAL) --array of topic ids
  • event_id (OPTIONAL) --id of associated Event
  • link (OPTIONAL) --String of HTTP URL

Outputs:

  • id
  • body
  • user_id
  • topic_ids
  • event_id
  • link
  • edit_history
  • creation_date

DELETE POST

URL: /api/post/[id] --pass the id of the post to be deleted as the path parameter
Method: DELETE
Description: Deletes a specified message board post, returns the deleted post details.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee that created the post
Inputs:
Outputs:

  • id
  • body
  • user_id
  • topic_ids
  • event_id
  • link
  • edit_history
  • creation_date
  • modification_date

UPDATE POST

URL: /api/post/[id] --pass the id of the post to be updated as the path parameter
Method: PATCH
Description: Updates the details of a message board post, returns updated post details. Whatever optional inputs are provided are the fields that will be updated. Fields that are not updated are left with their original values. It will automatically add a new entry to the edit_history array with a new timestamp.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee that created the post
Inputs:

  • body (OPTIONAL) --text body of message
  • topic_ids (OPTIONAL) --array of topic ids
  • event_id (OPTIONAL) --id of associated Event
  • link (OPTIONAL) --String of HTTP URL

Outputs:

  • id
  • body
  • user_id
  • topic_ids
  • event_id
  • link
  • edit_history
  • creation_date

VIEW USERS

URL: /api/user/list
Method: GET
Description: Returns a list of attendees.
Authorized roles: admin, attendee
Inputs:
Outputs:

  • id
  • username
  • organization

VIEW USER DETAIL

URL: /api/user/[id] --pass the id of the user as the path parameter
Method: GET
Description: Returns details for an specified user.
Authorized roles: admin (all details), attendee (a censored list based on profile settings) --token of user making the request must be an admin role, or possess the same id as that of the attendee to be updated to view full, uncensored details
Inputs:
Outputs:

  • id
  • username
  • organization
  • email
  • roles
  • agenda
  • profile_description
  • profile_image
  • profile_website
  • profile_twitter_username

DELETE USER

URL: /api/user/[id] --pass the id of the user to be deleted as the path parameter
Method: DELETE
Description: Deletes the specified user account. Returns the deleted user details.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee to be updated
Inputs:
Outputs:

  • id
  • username
  • organization
  • email
  • email_hidden
  • roles
  • agenda
  • profile_description
  • profile_image
  • profile_website
  • profile_twitter_username
  • profile_twitter_hidden

UPDATE USER

URL: /api/user/[id] --pass the id of the user to be updated as the path parameter
Method: PATCH
Description: Updates a specified User account. Updates all optional fields included in the submission. Returns the updated User.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee to be updated
Inputs:

  • username (OPTIONAL)
  • password (OPTIONAL) --The password is encrypted before saved to database.
  • email (OPTIONAL)
  • email_hidden (OPTIONAL) --default is true
  • roles (OPTIONAL)
  • organization (OPTIONAL)
  • agenda (OPTIONAL) --an array of Event ids
  • profile_description (OPTIONAL)
  • profile_image (OPTIONAL)
  • profile_website (OPTIONAL)
  • profile_twitter_username (OPTIONAL)
  • profile_twitter_hidden (OPTIONAL) --default is true

Outputs:

  • id
  • username
  • organization
  • email
  • email_hidden
  • roles
  • agenda
  • profile_description
  • profile_image
  • profile_website
  • profile_twitter_username
  • profile_twitter_hidden

VIEW AGENDA

URL: /api/agenda/[id] --pass the id of the specified user as the path parameter
Method: GET
Description: Returns the list of favorited Events (the agenda) for a specified user.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee agenda
Inputs:
Outputs:

  • id --id of the Event
  • title --title of the Event
  • date
  • speakers
  • topics
  • max_attendance
  • current_attendance
  • location

ADD AGENDA ITEM

URL: /api/agenda/[id] --pass the id of the specified user as the path parameter
Method: PATCH
Description: Returns the updated list of favorited Events (the agenda) for a specified user.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee agenda
Inputs:

  • event_id --id of the specified event to be added to the agenda

Outputs:

  • id --id of the Event
  • title --title of the Event
  • date
  • speakers
  • topics
  • max_attendance
  • current_attendance
  • location

DELETE AGENDA ITEM

URL: /api/agenda/[id] --pass the id of the specified user as the path parameter
Method: DELETE
Description: Returns the updated list of favorited Events (the agenda) for a specified user.
Authorized roles: admin, (attendee) --token of user making the request must be an admin role, or possess the same id as that of the attendee agenda
Inputs:

  • event_id --id of the specified event to be removed from the agenda

Outputs:

  • id --id of the Event
  • title --title of the Event
  • date
  • speakers
  • topics
  • max_attendance
  • current_attendance
  • location

VIEW EVENTS

URL: /api/event/list
Method: GET
Description: Returns a list event title and date, includes all events unless input has the optional filter parameter.
Authorized roles: admin, attendee
Inputs:

  • topic_id (OPTIONAL) --filters to return only records possessing this ID in its topic field

Outputs:

  • id
  • title
  • date
  • speakers
  • topics
  • location

VIEW EVENT DETAIL

URL: /api/event/[id] --pass the id of the event as the path parameter
Method: GET
Description: Returns all detailed information for a given event.
Authorized roles: admin, attendee
Inputs:
Outputs:

  • id
  • title
  • date
  • speakers
  • topics
  • location

CREATE EVENT

URL: /api/event
Method: POST
Description: Creates a new event. Returns event details including the id.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:

  • title
  • date
  • speakers (OPTIONAL)
  • topics (OPTIONAL)
  • location (OPTIONAL)

Outputs:

  • id
  • title
  • date
  • speakers
  • topics
  • location

DELETE EVENT

URL: /api/event/[id] --pass the id of the event to be deleted as the path parameter
Method: DELETE
Description: Deletes a specified event. Returns the deleted event details.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:
Outputs:

  • id
  • title
  • date
  • speakers
  • topics
  • location

UPDATE EVENT

URL: /api/event/[id] --pass the id of the event to be updated as the path parameter
Method: PATCH
Description: Updates a specified event. Updates all optional fields submitted. Returns the updated event details.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:

  • title (OPTIONAL)
  • date (OPTIONAL)
  • speakers (OPTIONAL)
  • topics (OPTIONAL)
  • location (OPTIONAL)

Outputs:

  • id
  • title
  • date
  • speakers
  • topics
  • location

VIEW TOPICS

URL: /api/topic/list
Method: GET
Description: Returns available topics.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:

  • title
  • color (OPTIONAL)

Outputs:

  • id
  • title
  • color

CREATE TOPIC

URL: /api/topic
Method: POST
Description: Create a new topic.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:

  • title
  • color (OPTIONAL)

Outputs:

  • id
  • title
  • color

DELETE TOPIC

URL: /api/topic/[id] --pass the id of the topic to be deleted as the path parameter
Method: DELETE
Description: Delete a specified topic. Returns the deleted topic.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:
Outputs:

  • id
  • title
  • color

UPDATE TOPIC

URL: /api/topic/[id] --pass the id of the topic to be updated as the path parameter
Method: PATCH
Description: Update a specified topic. It will updated whatever optional fields are provided. Returns the updated topic.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:

  • title (OPTIONAL)
  • color (OPTIONAL)

Outputs:

  • id
  • title
  • color

VIEW CONFIG

URL: /api/config
Method: GET
Description: View configuration details
Authorized roles: admin, attendee
Inputs:
Outputs:

  • config_id
  • name
  • year
  • city
  • description
  • contact_email
  • contact_phone
  • contact_address
  • posts_are_public

UPDATE CONFIG

URL: /api/config
Method: PATCH
Description: Updates the conference site configuration details. Any fields submitted will be overwritten with the new info. Returns the updated Config.
Authorized roles: admin --token of user making the request must be an admin role
Inputs:

  • config_id --use value of 1
  • name (OPTIONAL)
  • year (OPTIONAL)
  • city (OPTIONAL)
  • description (OPTIONAL)
  • contact_email (OPTIONAL)
  • contact_phone (OPTIONAL)
  • contact_address (OPTIONAL)
  • posts_are_public (OPTIONAL)

Outputs:

  • config_id
  • name
  • year
  • city
  • description
  • contact_email
  • contact_phone
  • contact_address
  • posts_are_public

Tests are available:

npm test

conference-connect's People

Contributors

goodwid avatar billyham avatar araedavis avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.