Skip to content

Commit b4571c3

Browse files
committed
initial
0 parents  commit b4571c3

19 files changed

+9261
-0
lines changed

.eslintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"commonjs": true,
4+
"es2021": true,
5+
"node": true,
6+
"jest": true
7+
},
8+
"extends": "eslint:recommended",
9+
"parserOptions": {
10+
"ecmaVersion": "latest"
11+
},
12+
"rules": {
13+
}
14+
}

.github/lockdown.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# PLEASE DO NOT REMOVE THIS FILE
2+
3+
# Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown
4+
5+
# Skip issues and pull requests created before a given timestamp. Timestamp must
6+
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
7+
skipCreatedBefore: false
8+
9+
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
10+
exemptLabels: []
11+
12+
# Comment to post before closing or locking. Set to `false` to disable
13+
comment: false
14+
15+
# Label to add before closing or locking. Set to `false` to disable
16+
label: false
17+
18+
# Close issues and pull requests
19+
close: true
20+
21+
# Lock issues and pull requests
22+
lock: true
23+
24+
# Limit to only `issues` or `pulls`
25+
only: pulls
26+
# Optionally, specify configuration settings just for `issues` or `pulls`
27+
# issues:
28+
# label: wontfix
29+
30+
# pulls:
31+
# comment: >
32+
# This repository does not accept pull requests, see the README for details.
33+
# lock: false
34+
35+
# Repository to extend settings from
36+
# _extends: repo

.gitignore

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
.parcel-cache
78+
79+
# Next.js build output
80+
.next
81+
out
82+
83+
# Nuxt.js build / generate output
84+
.nuxt
85+
dist
86+
87+
# Gatsby files
88+
.cache/
89+
# Comment in the public line in if your project uses Gatsby and not Next.js
90+
# https://nextjs.org/blog/next-9-1#public-directory-support
91+
# public
92+
93+
# vuepress build output
94+
.vuepress/dist
95+
96+
# Serverless directories
97+
.serverless/
98+
99+
# FuseBox cache
100+
.fusebox/
101+
102+
# DynamoDB Local files
103+
.dynamodb/
104+
105+
# TernJS port file
106+
.tern-port
107+
108+
# Stores VSCode versions used for testing VSCode extensions
109+
.vscode-test
110+
111+
# yarn v2
112+
.yarn/cache
113+
.yarn/unplugged
114+
.yarn/build-state.yml
115+
.yarn/install-state.gz
116+
.pnp.*
117+
118+
# Mac cruft
119+
.DS_Store
120+
121+
# VSCode
122+
.vscode
123+
124+
# Databases
125+
*.db3

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Adding Data Persistence Sprint Challenge
2+
3+
**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.**
4+
5+
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**.
6+
7+
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 a few days after the challenge submission. For more information on the review process [click here.](https://www.notion.so/bloomtech/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a)
8+
9+
You are not allowed to collaborate during the sprint challenge.
10+
11+
## Project Set Up
12+
13+
- [ ] Run `npm install` to install your dependencies.
14+
- [ ] Run tests locally executing `npm test`.
15+
16+
## Project Instructions
17+
18+
### Introduction
19+
20+
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.
21+
22+
### Files to Complete
23+
24+
1. `package.json`
25+
2. `index.js`
26+
3. `api/server.js`
27+
4. `model.js` inside `api/project`, `api/resource` and `api/task`
28+
5. `router.js` inside `api/project`, `api/resource` and `api/task`
29+
6. migration file(s)
30+
7. seed file(s) **optional**
31+
32+
### Required Dependencies
33+
34+
The project needs some additional NPM dependencies in order to work.
35+
36+
### Required Scripts
37+
38+
Add `"start"`. `"server"`, `"migrate"` and `"rollback"` scripts to the `package.json` file. The tests depend on these scripts being correct!
39+
40+
### Required Tables
41+
42+
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()`.
43+
44+
- [ ] A **project** is what needs to be done and is stored in a `projects` table with the following columns:
45+
46+
- [ ] `project_id` - primary key
47+
- [ ] `project_name` - required
48+
- [ ] `project_description` - optional
49+
- [ ] `project_completed` - the database defaults it to `false` (integer 0) if not provided
50+
51+
- [ ] A **resource** is anything needed to complete a project and is stored in a `resources` table with the following columns:
52+
53+
- [ ] `resource_id` - primary key
54+
- [ ] `resource_name` - required and unique
55+
- [ ] `resource_description` - optional
56+
57+
- [ ] A **task** is one of the steps needed to complete a project and is stored in a `tasks` table with the following columns:
58+
59+
- [ ] `task_id` - primary key
60+
- [ ] `task_description` - required
61+
- [ ] `task_notes` - optional
62+
- [ ] `task_completed` - the database defaults it to `false` (integer 0) if not provided
63+
- [ ] `project_id` - required and points to an actual `project_id` in the `projects` table
64+
65+
- [ ] A **resource assignment** connects a resource and a project, and is stored in a `project_resources` table. You decide what columns to use.
66+
67+
### Required Endpoints
68+
69+
Build an API inside the `api` folder with endpoints for:
70+
71+
- [ ] `[POST] /api/resources`
72+
- Example of response body: `{"resource_id":1,"resource_name":"foo","resource_description":null}`
73+
74+
- [ ] `[GET] /api/resources`
75+
- Example of response body: `[{"resource_id":1,"resource_name":"foo","resource_description":null}]`
76+
77+
- [ ] `[POST] /api/projects`
78+
- Even though `project_completed` is stored as an integer, the API uses booleans when interacting with the client
79+
- Example of response body: `{"project_id":1,"project_name":"bar","project_description":null,"project_completed":false}`
80+
81+
- [ ] `[GET] /api/projects`
82+
- Even though `project_completed` is stored as an integer, the API uses booleans when interacting with the client
83+
- Example of response body: `[{"project_id":1,"project_name":"bar","project_description":null,"project_completed":false}]`
84+
85+
- [ ] `[POST] /api/tasks`
86+
- Even though `task_completed` is stored as an integer, the API uses booleans when interacting with the client
87+
- Example of response body: `{"task_id":1,"task_description":"baz","task_notes":null,"task_completed":false,"project_id:1}`
88+
89+
- [ ] `[GET] /api/tasks`
90+
- Even though `task_completed` is stored as an integer, the API uses booleans when interacting with the client
91+
- Each task must include `project_name` and `project_description`
92+
- Example of response body: `[{"task_id":1,"task_description":"baz","task_notes":null,"task_completed":false,"project_name:"bar","project_description":null}]`
93+
94+
**Important Notes (READ!)**
95+
96+
- Run tests locally by executing `npm run test`. Tests will be very broken until you flesh out the project sufficiently.
97+
- You are welcome to create additional files for middlewares etc, but **do not move or rename existing files** or folders.
98+
- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages.
99+
- Delete `test.db3` and `database.db3` and re-run migrations and tests, if you suspect half-finished code left your databases in a broken state.
100+
- In your solution, it is essential that you follow best practices and produce clean and professional results.
101+
102+
## Submission format
103+
104+
- [ ] Submit via Codegrade by pushing commits to your `main` branch on Github.
105+
- [ ] Check Codegrade before the deadline to compare its results against your local tests.
106+
- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback.
107+
- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline.
108+
109+
## Interview Questions
110+
111+
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.
112+
113+
1. Explain the difference between Relational Databases and SQL.
114+
2. Why do tables need a Primary Key?
115+
3. What is the name given to a table column that references the Primary Key on another table?
116+
4. What do we need in order to have a _many to many_ relationship between two tables?

api/project/model.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// build your `Project` model here

api/project/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// build your `/api/projects` router here

api/resource/model.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// build your `Resource` model here

api/resource/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// build your `/api/resources` router here

api/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// build your server here and require it from index.js

api/task/model.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// build your `Task` model here

0 commit comments

Comments
 (0)