dancingnomads's People
dancingnomads's Issues
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.
CreateMessage updates Conversation
When a message is sent and CreateMessage is called, we should also update the updated_at timestamp in the respective Conversation.
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:
-
- Trouble retrieving partnership data. Please try again.
Success:
- Trouble retrieving partnership data. Please try again.
-
- Returns the full profile data of both partners and any relevant partnership data in JSON.
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:
-
- There was an error updating your dances. Please try again.
Success:
- There was an error updating your dances. Please try again.
-
- Update successful.
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:
-
- There was a problem getting your messages. Please refresh to try again.
Success:
-
- Returns array of messages. Ordered by created_at. Returned in JSON format.
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: /invite/:id/delete (Dupe'd by 17 - functionality wise)
models.Validate should validate if the user is able to delete invitations
DELETE an invite request.
Error:
-
- "Something went wrong with that delete. Please try again."
Success:
- "Something went wrong with that delete. Please try again."
-
- Invitation deleted.
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: /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
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: /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
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:
-
- There was some trouble deleting this partnership. Please try again.
Success:
- There was some trouble deleting this partnership. Please try again.
-
- Partnership deleted.
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:
-
- "There was an error accepting the invitation, please try again."
Success:
- "There was an error accepting the invitation, please try again."
-
- "Partner Invitation Accepted."
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:
-
- "Sorry, we weren't able to retrieve your partners. Please refresh to try again."
Success:
- "Sorry, we weren't able to retrieve your partners. Please refresh to try again."
-
- Returns a JSON formatted array of partners for the current user.
GET API: /search
Free to use without account.
GET with parameters at /search.
Error:
-
- "There was an error with your search. Please try again."
Success:
-
- Return JSON array of matching results.
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."
DELETE API: /invitation/:id/delete
models.Validate should validate if the user is able to delete invitations
DELETE an invitation request.
Error:
-
- "Something went wrong with that delete. Please try again."
Success:
- "Something went wrong with that delete. Please try again."
-
- Invitation deleted.
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:
-
- "There was a problem retrieving your conversations. Please refresh to try again."
Success:
- "There was a problem retrieving your conversations. Please refresh to try again."
-
- Returrn a JSON array of all the conversations this user is involved in.
Validating inputs for /login, /signup, and /profile/update routes
The routes for /login, /signup, and /profile/update needs validation for their inputs on the server side.
Acceptance criteria: Inputs are validated on the server side.
Change all ID uint to int64
Might possibly want to change all uint types to int64 for IDs
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
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:
-
- "Message failed to send. Please try again."
Success:
-
- "Message sent."
Only users in the conversation can see the conversation
GET API: /conversation/:conversation_id/messages
POST API: /conversation/:conversation_id/message
We need to do validation such that only users within a conversation can see the messages in the conversation.
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)
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.
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:
-
- "There was an error. Please refresh to try again"
Success:
- Return JSON data of all resulting invites.
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:
-
- "There was an error. Please refresh to try again"
Success:
- Return JSON data of all resulting invitations.
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.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.