jglez / web-sprint-challenge-adding-data-persistence

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding Data Persistence Sprint Challenge

Read these instructions carefully. Understand exactly what is expected before starting this Sprint Challenge.

This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored Data Persistence. During this sprint, you studied RDBMS, including SQL, multi-table queries, and data modeling. In your challenge this week, you will demonstrate your mastery of these skills by creating a database based on given specifications.

This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers on Monday following the challenge submission. For more information on the review process click here.

You are not allowed to collaborate during the sprint challenge. However, you are encouraged to follow the twenty-minute rule and seek support by dropping a đź‘‹ in your help channel should a blocker arise.

Sprint challenges open at Midnight PST on Thursday and close at 5pm PST on Friday. You will receive feedback on what you have submitted by 5pm. No retakes will be accepted.

Project Set Up

  • Fork and clone the repo. Delete your old fork from Github first if you are repeating this Unit.
  • Open the assignment in Canvas and click on the "Set up git" option.
  • Follow instructions to set up Codegrade's Webhook and Deploy Key.
  • Push your first commit: git commit --allow-empty -m "first commit" && git push.
  • Check to see that Codegrade has accepted your git submission.

For a step-by-step on setting up Codegrade see this guide.

Project Instructions

Introduction

In this project you will be given a set of requirements and must design a database to satisfy them. As a part of this process you'll also build an API with endpoints to access the data.

Required Tables

Build the migration(s) in Knex inside the data/migrations folder using appropriate data types and constraints. You must use the table names and the column names described below. To give a primary key a name different than id, do table.increments("project_id") instead of table.increments().

  • A project is what needs to be done and is stored in a projects table with the following columns:

    • project_id - primary key
    • project_name - required
    • project_description - optional
    • project_completed - the database defaults it to false (integer 0) if not provided
  • A resource is anything needed to complete a project and is stored in a resources table with the following columns:

    • resource_id - primary key
    • resource_name - required and unique
    • resource_description - optional
  • A task is one of the steps needed to complete a project and is stored in a tasks table with the following columns:

    • task_id - primary key
    • task_description - required
    • task_notes - optional
    • task_completed - the database defaults it to false (integer 0) if not provided
    • project_id - required and points to an actual project_id in the projects table
  • A resource assignment connects a resource and a project, and is stored in a project_resources table. You decide what columns to use.

Required Endpoints

Build an API inside the api folder with endpoints for:

  • [POST] /api/resources

    • Example of response body: {"resource_id":1,"resource_name":"foo","resource_description":null}
  • [GET] /api/resources

    • Example of response body: [{"resource_id":1,"resource_name":"foo","resource_description":null}]
  • [POST] /api/projects

    • Even though project_completed is stored as an integer, the API uses booleans when interacting with the client
    • Example of response body: {"project_id":1,"project_name":"bar","project_description":null,"project_completed":false}
  • [GET] /api/projects

    • Even though project_completed is stored as an integer, the API uses booleans when interacting with the client
    • Example of response body: [{"project_id":1,"project_name":"bar","project_description":null,"project_completed":false}]
  • [POST] /api/tasks

    • Even though task_completed is stored as an integer, the API uses booleans when interacting with the client
    • Example of response body: {"task_id":1,"task_description":"baz","task_notes":null,"task_completed":false,"project_id:1}
  • [GET] /api/tasks

    • Even though task_completed is stored as an integer, the API uses booleans when interacting with the client
    • Each task must include project_name and project_description
    • Example of response body: [{"task_id":1,"task_description":"baz","task_notes":null,"task_completed":false,"project_name:"bar","project_description":null}]

Notes:

  • Run tests locally by executing npm run test.
  • You are welcome to create additional files for middlewares etc, but do not move or rename existing files or folders.
  • Do not make changes to your package.json except to add extra dependencies and scripts.
  • In your solution, it is essential that you follow best practices and produce clean and professional results.
  • Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work.
  • It is better to submit a challenge that meets MVP than one that attempts too much and does not.

Stretch Goals

IMPORTANT: Do not break any MPV functionality by adding "stretch" code! Keep an eye on those tests!

After finishing your required elements, you can push your work further. These goals may or may not be things you have learned in this module but they build on the material you just studied. Time allowing, stretch your limits and see if you can deliver on the following optional goals:

  • Add an endpoint to get a list of project resources.
  • Add an endpoint to get a list of project tasks.
  • Add an endpoint to see all projects using a particular resource.

Submission format

  • Submit via Codegrade by committing and pushing any new changes.
  • Create a pull request to merge <firstName-lastName> branch into main.
  • Please don't merge your own pull request and make sure you are on your own repo.
  • Check Codegrade for automated feedback.
  • Check Codegrade on Monday following the Sprint Challenge for reviewer feedback.
  • Any changes pushed after the deadline will not receive any feedback.

Interview Questions

Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand.

  1. Explain the difference between Relational Databases and SQL.
  2. Why do tables need a Primary Key?
  3. What is the name given to a table column that references the Primary Key on another table?
  4. What do we need in order to have a many to many relationship between two tables?

About


Languages

Language:JavaScript 100.0%