I'm Dylan Meskis, a software engineer at Homebot.
dmeskis / pitch_battles_be Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://pitch-battles-api.herokuapp.com
Home Page: https://pitch-battles-api.herokuapp.com
I'm Dylan Meskis, a software engineer at Homebot.
POST api/v1/klasses
User must be authorized
User must have a role of 1
Have each user create an auth token on create
Currently the endpoint for posting a user class is
api/v1/users/:id/class
Change this to be
api/v1/users/:id/class
Create a join table for linking games to a class
Attributes:
Add endpoint for removing a user from class to backend README
Set up fastjson_api for serializing our objects
https://github.com/Netflix/fast_jsonapi
Create sad paths for user creation testing minimum name length, valid email, empty strings are invalid
Create a join table linking Users/Games
A user should have many games and games belong to many users
Attributes:
As a user,
if I sent a GET request to api/v1/users/:id/games,
it returns the following response with a 200 status code:
{
data: {
"id": <user_id>,
"type": ,
"attributes": ,
"games": {
"data": [
{
"id": <game_id>,
"type": "Game",
"attributes": {
}
}
}
}
Revisit the sessions controller and refactor how the user data is being passed back
Create a seed file for seeding databases
Create a badges table, badges should include the following properties
GET api/v1/dashboard
Returns ALL user information for the currently authenticated user
Add an endpoint for deleting a class
Create a class model
A class should have the following attributes:
POST api/v1/login
request should contain the following
{
email: [email protected],
password: password
}
response is either 200 ok
{
"auth_token":
}
OR
400 Bad info
{
"error": "Incorrect credentials"
}
Add a filter to prevent teacher from removing themselves from a class
As a user,
if I wish to add myself to a class,
I make a POST request to api/v1/user/:id/classes
with the following body:
{
class_key: <class_key>
}
If the request is successful, respond with the following and a 200 status code:
{ "success": "Successfully joined ${class_name}!" }
If the request is unsuccessful, response with the following and a 400 error:
{ "error": "Class not found." }
Test and implement dependent destroy to Models
Build a dashboard endpoint that pulls down EVERYTHING a user has
Stuff we need:
All achievements/badges
Fastest times
Total games played
Last game played
Class id's and names
Install redis-rails and find a way to implement caching on the API side of things.
Examples:
Routes that should require a user auth token
PATCH users/:id
POST users/:id/games
POST users/:id/class
post /api/v1/users
As a user,
I send the following request:
{
email: “[email protected]”,
first_name: “billy”,
last_name: “bob”,
role: 0,
password: “password”,
password_confirmation: “password”
}
All fields are required.
If post is successful, returns the following response with status 200:
Response
{
“success”: “Account successfully created”
}
If post fails, returns the following response with a 400 error:
{
"error": "Account creation failed. Please try again."
}
Create a game model
Games should have the following attributes:
*Subject to change, check in with Kevin
Forgot to write tests for validating that models possess certain attributes, revisit the following models and implement these tests:
Once we have created our badges, create a service that runs every time a game is posted that analyzes whether or not a badge has been earned and then updates the user badges table correspondingly
Add top times to user model:
Per level and top overall
In post game processing,
Revisit the user update and make it require either an api_key or password
Add a password reset by email, using either ActionMailer or Sendgrid
Reference below link:
https://www.sitepoint.com/handle-password-and-email-changes-in-your-rails-api/
Create a join table for joining users to classes. UserClasses should have the following attributes:
Create a user model
A user should have the following properties
Create a join table for joining students to teachers
Attributes:
User with teacher_id requires a role of 1 ("teacher")
user with student_id requires a role of 0 ("student")
Create a join table for user badges
DELETE api/v1/user/:id/classes
Delete a user from a class
Authorize that user is teacher of class by using @current_user and seeing if role is 1 and class relationship exists
Write tests for user model to ensure it has the correct attributes
Display EVERYTHING a user has on their get endpoint
On game post, the response should include ALL user data again
POST /api/v1/games
As a user,
I send the following request with the following fields to post a completed game:
{
email: “[email protected]”,
total_duration: 1000,
level_one_duration: 400,
level_two_duration: 200,
level_three_duration: 200,
level_four_duration: 200,
remaining_lives: 0..3
}
Email is REQUIRED!
Total duration can be calculated front-end or back-end
If a level duration is null, consider that level incompleted.
Level duration is in milliseconds
Remaining lives must be in the valid range of maximum life (Ask Kevin)
If post is successful, returns the following response with status 200:
Response
{
data: {
id: 3,
type: "Game",
attributes: {
total_duration: 1000,
level_one_duration: 400,
level_two_duration: 200,
level_three_duration: 200,
level_four_duration: 200,
remaining_lives: 2
}
}
}
If post fails, returns the following response with a 400 error:
{
"error": "Game post failed. Check error logs."
}
Any user response should have ALL user info!
Setup a JWT auth system for users
Currently the endpoint for patching a user uses a lookup, with the :id
As a user,
I send a GET request to api/v1/users/:id/badges
Upon a successful request I get the following response (200):
{
data: {
id: <user_id>,
type: "User",
attributes: { <user_attributes> },
badges: { }
}
}
Create database migration that adds a one to many relationship for teacher games
Set up continuous integration on the back end with CircleCI
As a user,
I send a GET request to api/v1/users/:id,
if it is a valid user id, the server responds with the following:
{
"data": {
"id": "1",
"type": "user",
"attributes": {
“email”: “[email protected]”,
“first_name”: “billy”,
“last_name”: “bob”,
“role”: “student”,
“badges”: {
“level_1_badge”: “true”,
“level_2_badge”: “false”,
etc. etc.
}
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.