An API where you can store your run data, join teams and set goals, and find run data between specific dates.
Stretching out like our man Mo:
- Decided that we were going to run a half marathon when we'd signed up for the 10km
- "They decided not me" - Ako
- We agreed too many routes would be a better target than too few
- And why just do one to many tables when you can do many to many
- Initial testing: lot's of debugging to get through.
- PGUSERNAME and single '
- merge conflicts likely from the starting pistol
- testing
- Postman
- queries
How much work do you do for your client?
function getTeamMembersFromTeamName(req, res, next) {
modelTeams.getAllFromTeamName(teamName) // STEP 1
.then(result => modelTeams.getAllUsersFromTeam(teamId)) // STEP 2
.then(userIds => modelUsers.getUserById(userIds)) // STEP 3
.then('Create an array with all users') // STEP 4
.catch(next)
})
}
- Promises hate everyone (sometimes)
function getTeamMembersFromTeamName(req, res, next) {
modelTeams.getAllFromTeamName(teamName).then(result => {
const teamId = result.id
modelTeams.getAllUsersFromTeam(teamId)
.then(results => {
// We are creating an Array. But each db query is a PROMISE
let usersDataPromiseArray = results.map(users => {
return modelUsers.getUserById(users.user_id).then(result => {
return result
})
})
// What method would we use to wait for all of our promises to fulfill?
// The Promise.all() Method!
Promise.all(usersDataPromiseArray).then(usersDataArray => {
res.send(nameArray)
})
})
.catch(next)
})
}
Promise.all(usersDataPromiseArray).then(Do something else)
- Because the above is asyncronous we have to Promise.all() to use the result from our results.map
The Promise.all() method returns a single Promise that fulfills when all of the promises passed as an iterable have been fulfilled - MDN
- More complex db queries using dates
function getRunsInDates(userID, date1, date2) {
return db.query
('SELECT * FROM runs WHERE user_id=($1) AND date BETWEEN ($2) AND ($3)',
}
- making queries work
- focusing on making a helpful README
- potentially understanding what an API is
- you don't need log out / you do need to set expiry
- Authorization ✔️
- CI/CD
- other reflections
- issue with id not always being extracted properly
- server tests
- Join a team post sign up
- Update junction table when adding and removing users :giraffe_face:
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (team_id) REFERENCES books(id) ON UPDATE CASCADE ON DELETE CASCADE;
- Mapping promises you can't keep
- Making sure every group is building a running app next week
- COVID19 project
- Finish
- Make sure code reviews issues are done before going back to original plans
- Being....... LEGENDARY
- Scrum Master 🤝
- miro and readmes
- Smooth as silk planning and execution
- Focus on flow fom user perspective
- Amazing knowledge sharing
- Great debugging
- Celebrating victories
- working on a project
-
Jack: yes we will need to ensure that everyone succeeds. We are CADO
-
Ako: I want to enforce the same idea that we didn't start building in Week 5. Anyone interested? We are CADO
-
Finish stopping or stop finishing? You decide. Double negative city.
-
Jack: Great point on doing the code review issues before craking on with what you're interested in.
-
Joe: Jack did really good job of being SM especially in the beginning focusing on how we are meeting the acceptability criteria befire going into granular details.
-
Ako & Jack: Doc driven development for API is really powerful. Really good to use this going forward always.
-
User driven design. As a user what do I want to experience. Powerful starting point
-
Joe: Quite touched when everyone puts what they are doing to one side to share knowledge, summed up by code review and going through authentication stuff together and mobbing
-
Jack: really good to use debugging modules.
- Action: Jack to put resource in Slack.
-
Jack: Great idea to make a log of breakthrough moments so we don't forget them in future (like with the E.Variables)
-
Ako: Would be great to work on projects together after FAC19.