In this challenge, you design and build a Data Model and a RESTful API that stores data into a Relational Database.
Read these instructions carefully. Understand exactly what is expected before starting this Sprint Challenge.
This is an individual assessment, please work on it alone. It is an opportunity to demonstrate proficiency in the concepts and objectives introduced and practiced in preceding days.
If the instructions are not clear, please seek support from your TL and Instructor on Slack.
The Minimum Viable Product must be completed in three hours.
Follow these steps to set up and work on your project:
- Create a forked copy of this project.
- Add your Team Lead as collaborator on Github.
- Clone your forked version of the Repository.
- Create a new Branch on the clone: git checkout -b
firstName-lastName
. - Implement the project on this Branch, committing changes regularly.
- Push commits: git push origin
firstName-lastName
.
Follow these steps for completing your project.
- Submit a Pull-Request to merge
firstName-lastName
Branch into master on your fork, don't make Pull Requests against Lambda's repository. - Please don't merge your own pull request.
- Add your Team Lead as a Reviewer on the Pull-request
- Your Team Lead will count the challenge as done by merging the branch into master.
Commit your code regularly and use descriptive messages. This helps both you (in case you ever need to return to old code) and your Team Lead.
Demonstrate your understanding of this week's concepts by answering the following free-form questions. Edit this document to include your answers after each question. Make sure to leave a blank line above and below your answer so it is clear and easy to read by your project manager.
- Explain the difference between
Relational Databases
andSQL
. SQL is the laungauge that you use to parse data bases, relational databases are just databases with multiple tables refereing to one another - Why do tables need a
primary key
? To have a key that can be used to find things in the table its self. - What is the name given to a table column that references the primary key on another table. foreign key
- What do we need in order to have a many to many relationship between two tables. an entire table responsible to bringing together the ID's
Take the steps necessary to complete the project from scratch. Start by initializing your project with a package.json
and go from there.
Complete the following tasks:
- Design the data model and use knex migrations to create the database and tables.
- Build an API with endpoints for:
- adding resources.
- retrieving a list of resources.
- adding projects.
- retrieving a list of projects.
- adding tasks.
- retrieving a list of tasks. The list of tasks should include the project name and project description.
- When returning
project
ortask
information, thecompleted
property should betrue
orfalse
.
For example, instead of returning a task
that looks like this:
{
id: 1,
name: 'convert to boolean',
completed: 1 // the database stores a 1 to represent true values on a boolean field
}
The API should return:
{
id: 1,
name: 'convert to boolean',
completed: true // write code to convert the 1 to true and 0 to false
}
- a
project
can have multipletasks
. - a
task
belongs to only oneproject
. - a
project
can use multipleresources
. - the same
resource
can be used in multipleprojects
. - when adding
projects
the client must provide a name, the description is optional. - when adding
resources
the client must provide a name, the description is optional. - when adding a
task
the client must provide a description, the notes are optional. - when adding a
task
the client must provide theid
of an existing project. - for
projects
andtasks
if no value is provided for thecompleted
property, the API should provide a default value offalse
.
A project
is what needs to be done. We want to store the following data about a project
:
- a unique Id.
- a name. This column is required.
- a description.
- a boolean that indicates if the project has been completed. This column cannot be NULL, the default value should be
false
.
A resource
is anything needed to complete a project, some examples are: a person, a tool, a meeting room or a software license. We want to store the following data about a resource
:
- a unique Id.
- a name. This column is required.
- a description.
The database should not allow resources with duplicate names.
An task
one of the steps needed to complete the project. We want to store the following data about an task
.
- a unique id.
- a description of what needs to be done. This column is required.
- a notes column to add additional information.
- a boolean that indicates if the task has been completed. This column cannot be NULL, the default value should be
false
.