GithubHelp home page GithubHelp logo

dancingnomads's People

Watchers

 avatar  avatar

dancingnomads's Issues

GET API: /invites

models.Validate should validate if the user is able to see all their invites (invites they've sent)

GET all invites that the user has sent (i.e. invitation.sender_id = user.id)

Error:

    1. "There was an error. Please refresh to try again"

Success:

  • Return JSON data of all resulting invites.

Client Side: Search + Invitations

Client side should show this feature only for signed in users.

Client side check:
Check for invitation.status and output whatever the status is, else if the invitation.status is nil, the output a "Send Partner Invite" button.

On the search JOIN the users table with the invitations table on users.id = sender.id if the row exists, returns a invitation.status "Invitation Pending, Partner" else the row does not exist, return "Send Partner Invite"

If invitation.status exists: Cannot send an invitation request (locked) (either Invitation Pending / Partner)
If invitation.status doesn't exist: Can send invitation via /invite/send

GET API: /search

Free to use without account.

GET with parameters at /search.

Error:

    1. "There was an error with your search. Please try again."

Success:

    1. Return JSON array of matching results.

DELETE API: /profile/delete

models.Validate to check if user is authorized to do this action.

Spin up a modal to double check if this is an action the user really wants to take.

If error:

  • Throw back a 500 response "Unable to delete, please try again."

If success:

  • Throw back a 200 success response

DELETE API: /invitation/:id/delete

models.Validate should validate if the user is able to delete invitations

DELETE an invitation request.

Error:

    1. "Something went wrong with that delete. Please try again."
      Success:
    1. Invitation deleted.

GET API: /dances

models.Validate should validate if the user is able to see this page.

If error:

  • Return a 400 (bad request) error with a message (There was an error, please refresh your page).

If success:

  • Return JSON data of all the dances this person leads/follows/does not do

GET API: /partners

Retrieve a list of the user's partners.

models.Validate should validate if the user is able to see their partners.

Partners table [HABTM Users]
Users table [HABTM Partners]

SELECT * FROM Partners WHERE user1_id IN :id OR user2_id IN :id

Error:

    1. "Sorry, we weren't able to retrieve your partners. Please refresh to try again."
      Success:
    1. Returns a JSON formatted array of partners for the current user.

POST API: /signup

Signup should do two things:

Errors:

  • If email was already taken, return a 500 with JSON Message "Email was already taken"
  • If any other error, then return a 500 with JSON "There was an error creating the account. Please try again."

Success:

  • Redirect them to the profile route to return profile data in JSON format.

POST API: /conversation/:conversation_id/message

models.Validate should validate if the user is able to send this message.

Messages belongs_to Conversations
Conversations has_many messages

Send a message to another user.
This should create a message on the messages table with receiver_id: being :id, and sender_id being the current_user.id and respectively a conversation on the conversations table with receiver_id: being :id, and sender_id being the current_user.id if this is the first message.

Error:

    1. "Message failed to send. Please try again."

Success:

    1. "Message sent."

GET API: /profile Unauthenticated access to profile

If an unauthenticated user tries to go to their profile:

  • Return a 401 (Unauthorized) if there was no auth cookie. "You need to be logged in to view this page. Please login again."
  • Return a 500 (Internal Server Error) on all other errors with message "There was a server error. Please try again."

GET API: /conversation/:conversation_id/messages

Index. Gets all the messages between current_user and receiver.
models.Validate should validate if the user is able to retrieve messages.

Messages belongs_to Conversations
Conversations has_many messages

Error:

    1. There was a problem getting your messages. Please refresh to try again.

Success:

    1. Returns array of messages. Ordered by created_at. Returned in JSON format.

POST API: /invitation/accept

models.Validate should validate if the user is able to accept invitations

On accept, add a row to the Partners table [HABTM Users] and delete the invitation from the invitations table.

Error:

    1. "There was an error accepting the invitation, please try again."
      Success:
    1. "Partner Invitation Accepted."

GET API: /profile

Validation has been handled by the models.Validate method. If user makes it here, all we need to do is:

  • Return user data in JSON format.

DELETE API: /partner/:id/delete

models.Validate should validate if the user is able to delete the partnership

A modal should popup to confirm that this action is what they want to take.

Error:

    1. There was some trouble deleting this partnership. Please try again.
      Success:
    1. Partnership deleted.

POST/PUT API: /profile/update

Client-side handles form validation.
Server-side also handles validation of data.

Before we update, validate that user is authorized to perform the update. Validation has been handled by the models.Validate method. If user makes it here, all we need to do is:

If error:

  • Return a 500 (Internal Server error) and the fields that were wrong. "The following fields were wrong..."

If success:

  • Return a 200 success.

GET API: /partner/:id

Show give the full profile of both partners on one screen.

models.Validate should validate if the user is able to see the partnership.

Error:

    1. Trouble retrieving partnership data. Please try again.
      Success:
    1. Returns the full profile data of both partners and any relevant partnership data in JSON.

POST API: /login

POST action

Login should do two things:

Errors:

  • If there were any errors, return JSON response "The user/password combination was invalid."

Success:

  • Redirect them to the profile route to return profile data in JSON format

Add Filters to User Profile

We need filters with the search so people can find more accurate results of people they actually want to see.

Ex Filters:

MUST
Age
Gender
Goals (social, performance, competition, training/practice)
Body type (Slim, Average, Muscular/Athletic, A few extra pounds, large)

LATER
Partner's Ethnicity
Partner's Drinking (non-drinker, social, regular)
Partner's Smoking (non-smoker, occasional, regular)
Partner's Relationship Status (Single, Separated, In a Relationship, Married)

Accept existing invites between a pair

When an invitation is accepted, if there is a pending invite between the same people that is not accepted, then accept that one too.

Ex. User 1 and User 2 both sent invites to another, when User 2 accepts the invite from user 1, then the invite that User 2 sent should automatically be accepted.

POST API: /invite/send

models.Validate should validate if the user is able to send an invite (i.e. must be logged in).

Creates an invitation if it doesn't already exist and updates the fields: sender_id, receiver_id, status

Error: 500. "There was an error with the invitation request. Please send again."

Success: 200.

GET API: /conversations

Gets all the conversations for the current user based on receiver_id and sender_id.

models.Validate should validate if the user is able to see all their conversations.

Error:

    1. "There was a problem retrieving your conversations. Please refresh to try again."
      Success:
    1. Returrn a JSON array of all the conversations this user is involved in.

POST/PUT API: /dances/update

models.Validate should validate if the user is able to see this page.

There would be a table of types of dances. One dance per column.
There would be a dictionary dictating what options are available for each dance.

L = Lead
F = Follow
B = Both
N = Does not dance this dance.

POST would POST the data in JSON format in order to update the database.
Error:

    1. There was an error updating your dances. Please try again.
      Success:
    1. Update successful.

GET API: /invitations

models.Validate should validate if the user is able to see all their invitations

GET all invitations that were received from other dancers (invitations.receiver_id = user.id)

Error:

    1. "There was an error. Please refresh to try again"

Success:

  • Return JSON data of all resulting invitations.

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.