Giter Club home page Giter Club logo

bootcamp-project's Introduction

Bootcamp Project API

Set up

createdb bootcampproject
npm run copy-env

In a separate terminal, run

npm run db
bootcampproject=# \i config/script.sql

Run

npm run start

Make migration

npx knex migrate:make <MIGRATION_NAME>

Seed with mock data

npx knex seed:run

Walkthrough

Stage 1

Create Knex tables and Objection.js models for users, posts, and hobbies. See below for the required fields:

All fields

  • id
  • createdAt
  • updatedAt

Users:

  • name
  • email
  • password
  • birthday
  • concentration
  • hometown
  • house
  • gender
  • bio
  • picture (in URL form)

Posts:

  • content
  • userId

Hobbies:

  • hobby (one of 'SPORTS', 'ARTS', 'MUSIC', 'READING', 'TRAVEL', 'DINING', 'CODING')
  • userId

You should go about doing this in the following manner. If you need help with syntax, reference the lecture code.

  1. Make the tables using Knex migrations
    • run npx knex migrate:make <MIGRATION_NAME> to make a migration file
    • find the new file in the /db/migrations/ directory
    • in that migration, fill in the information needed for that table. Look at the lecture code as an example
  2. Make the Objection.js models for users, posts, and hobbies in the /src/models/ directory.
    • A skeleton of the User model is already provided.
    • Here, implement methods which get the table name corresponding to the Knex tables made in Step 1
    • Determine the proper relations between different models and make another method to add the relation
    • HINT: For the following relation, you'll need a different type of relation than the other two, and this relation might (it will!) require creating a new 'join table' through knex.

Stage 2

Complete functions which take advantage of Objection.js functionality to query for various kinds of data.

Implement the functions marked as TODO in /src/graphql/types/user, /src/graphql/types/post, and src/graphql/mutations/Post as per the specifications given therein.

Refer to the Knex documentation and lecture code for syntactical clarifications: https://knexjs.org/

It will be hard to test your functionality without knowledge of GraphQL (look forward to tomorrow!), but if you're curious, just ask one of the TFs!

bootcamp-project's People

Contributors

jbperry004 avatar marwalbaadani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.