Users service handles and stores all user-related information for the application.
- Usage
- [Technologies] (#Technologies)
- Structure
- API Endpoints
- [Contributing] (#Contributing)
Start by cloning the latest version of the rice-users repository on your local machine by running:
$ git clone https://github.com/dadamaka/rice-users
$ cd rice-usersIn the root directory, run the following command to install dependencies:
$ npm install- Copy and save the
example.envfile in the env folder asdevelopment.env. - Enter your desired
PORT
-
Start the server by running the following command from the root directory:
$ npm start
-
Your server is now live at
http://localhost:PORT
-
Run the following command from the root directory to run tests.
$ npm test
- Node
- Express
- Bookshelf/Knex
- MySQL
- Mocha
- Chai
- AWS EC2
- AWS RDS
- Docker
├── /node_modules/ # 3rd-party libraries and utilities
├── /server/ # Server source code
│ ├── /config/ # Server configuration files
│ ├── /controller/ # Database interaction functions
│ ├── /env/ # Environment variables
│ ├── /models/ # Database mySQL models and schemas
│ ├── /routes/ # Routes for incoming AJAX requests
│ ├── /lib/ # Library for utility functions
│ └── /server.js # Server-side startup script
├── /test/ # Server-side tests
└── package.json # npm configuration file
└── .README.md # Quick overview of the Users Service
└── Dockerfile # Docker build file
GET /api/users/users
POST /api/users/user
POST /api/users/user/update
POST /api/users/friends
POST /api/users/friends/new
POST /api/users/preferences
POST /api/users/preferences/update
POST /api/users/group/preferences
Objective: Get all Users profile in the database
Output:
[
{
id : *integer*,
clientId : *string*,
name : *string*,
email : *string*,
review_count : *integer*,
isOnboarded : *binary*,
password : *string*
},
{
...
},
{
id : *integer*,
clientId : *string*,
name : *string*,
email : *string*,
review_count : *integer*,
isOnboarded : *binary*,
password : *string*
}
]
Objective: Get a Users's profile
Input:
{
clientId: *string*
}
Output:
{
id : *integer*,
clientId : *string*,
name : *string*,
email : *string*,
review_count : *integer*,
isOnboarded : *binary*,
password : *string*
}
###POST /api/users/user/update
Objective: Updates a User's profile
Input:
{
clientId : *string*,
name : *string* (optional),
email : *string* (optional),
review_count : *integer* (optional),
isOnboarded : *binary* (optional),
password : *string* (optional),
preferences : *array of string (preference)* (optional)
}
Output:
'Successfully Updated User Profile'
Objective: Get all of a Users's friends
Input:
{
clientId: *string*
}
Output:
[
{
id : *integer*,
clientId : *string*,
name : *string*,
email : *string*,
review_count : *integer*,
isOnboarded : *binary*,
password : *string*
},
{
...
},
{
id : *integer*,
clientId : *string*,
name : *string*,
email : *string*,
review_count : *integer*,
isOnboarded : *binary*,
password : *string*
}
]
###POST /api/users/friends/new
Objective: Add friends to a User
Input:
{
clientId: *string*,
friends: *array of string (clientId)*
}
Output:
'Friends Added Successfully'
###POST /api/users/preferences
Objective: Get all of a Users's preferences
Input:
{
clientId: *string*
}
Output:
[
*string*,
...,
*string*
]
###POST /api/users/preferences/update
Objective: Add preferences to a User's profile
Input:
{
clientId: *string*,
preferences: *array of string (preference)*
}
Output:
'Preferences Saved Successfully'
###POST /api/users/group/preferences
Objective: Get prefereces of all Users in specificed in group
Input:
{
clientId: *string*,
group: *array of string (clientId)*
}
Output:
[
[
*string*,
...,
*string*
],
[
...
],
[
*string*,
...,
*string*
],
]