Skip to content

Instantly share code, notes, and snippets.

@chriscarlsondev
chriscarlsondev / drills.js
Created July 1, 2019 16:02
Drill exercises working with shopping list
const knex = require('knex')
require('dotenv').config()
const knexInstance = knex({
client: 'pg',
connection: process.env.DB_URL
})
function searchByName(searchTerm) {
knexInstance
@chriscarlsondev
chriscarlsondev / shopping-list-service.js
Created July 1, 2019 17:40
Service and test for shopping list
const ShoppingListService = {
getAllItems(knex){
return knex.select('*').from('shopping_list')
},
insertItem(knex, newItem) {
return knex
.insert(newItem)
.into('shopping_list')
.returning('*')
.then(rows => {
-- 1. How many people work in the Sales department?
SELECT
COUNT(e.id)
FROM
employee e
JOIN
department d
ON
e.department = d.id
WHERE
@chriscarlsondev
chriscarlsondev / NotefulDatabase.md
Last active July 16, 2019 17:33
Sketch and ERD for Noteful database

These are my sketches and entity relationship diagram for the Noteful database.

IMG_6674

noteful-database-erd

@chriscarlsondev
chriscarlsondev / Learning-A-New-Codebase.md
Last active July 17, 2019 18:56
Q&A for the module on Learning a New Codebase

How are the syntaxes async and await useful when writing JavaScript code?

The word “async” before a function means the function always returns a promise and wraps non-promises in it. The keyword await makes JavaScript wait until that promise settles and returns its result. Async Await makes execution sequential.

With respect to Knex, how does the transaction method relate to BEGIN and COMMIT syntax in PostgreSQL?

In PostgreSQL, BEGIN initiates a transaction block. All statements after a BEGIN command will be executed in a single transaction until an explicit COMMIT or ROLLBACK is given.

@chriscarlsondev
chriscarlsondev / CheckPoint-7-QA.md
Last active July 20, 2019 00:06
Questions and Answers for Check Point 7 - Expiry time

Should the client or the server take more security precautions? Server.

What's the difference between local storage and session storage? Session storage is the same as local storage except that the data doesn't persist outside of the tab (session). The difference between local and session storage is that while local storage is always available in any tab and window of the same machine's browser, session storage isn't. Session storage is only available in the browser tab that the data was saved in, as soon as that tab is closed, the data is gone. As a result, session storage gives us an extra security feature for the frontend.

What problem does a JWT expiry time solve? JWT expiry time restricts the amount of time that an authorization token is valid for. This gives the server more control of the validity of any JWTs it creates instead of relying on the frontend client to ensure tokens aren't stolen.

Is a refresh endpoint protected or public?

@chriscarlsondev
chriscarlsondev / MuchToDo.md
Created July 20, 2019 00:33
An idea for the capstone project for the web development program at Bloc

Tracking the most important things that I need to get done during the week should be as easy as possible so that I can spend more time doing those things. The MuchToDo App will be a simple to do list tracker app.

@chriscarlsondev
chriscarlsondev / MuchToDo-UserStories.md
Last active January 13, 2022 17:06
User Stories for the MuchToDo Todo List App
Role Task Importance
As a new user I want to sign up for an account High
As a returning user I want to add a new to do list item High
As a returning user I want to delete an existing to do list item High
As a returning user I want to update an existing to do list item High
As a returning user I want to check off a completed to do list item High
As a returning user I want to create categories for my to do list items Medium
As a returning user I want to assign a category to my to do list item Medium
As a returning user I want to assign a due date for my to do list item Medium
@chriscarlsondev
chriscarlsondev / MuchToDo-ScreenInventory.md
Last active July 20, 2019 19:31
Screen Inventory for the MuchToDo App

MuchToDo App

Screens

The MuchToDo App will include the followig screens initially:

  1. Landing Page
  2. Home Page
  3. Add New Task Page
  4. Add New Category Page
@chriscarlsondev
chriscarlsondev / MuchToDo-StaticClientFeedback.md
Last active July 21, 2019 03:41
Feedback on the Static Client for MuchToDo

MuchToDo App

Links

User Feedback

User Feedback Action Taken
Erica - Added a category and expected the category to show up on the main page of the app after added instead of as an option when adding a new Category
- Wondered why the tasks didn't stay when she navigated away from the page
- No action taken
- Explained that this was just the frontend version of the code and that I needed backend functionality in place in order to save changes over time
Melissa - Thought that the app overall worked well but the general look of the app needed to be improved in order for her to be interested in using it. - No action taken since UI enhancement will happen later as part of the project