Code Monkey home page Code Monkey logo

class-collab-build-110121-shawsystem's Introduction

SUPER MVP

🌟 User -< Alerts

User:Auth

MVP

🌟 User -< UserLocation/UserLivesHere/UserIsHere/UserCurrentLocation >- Location >- ...CAN CONTINUE...

🌟 User -< Alert -< AlertDamages >- DamageTypes (Categories/Tags/Types)

🌟 Alert -< AlertLocation >- Location >- ...CAN CONTINUE...

Locations

Location (ZipCodes/Neighborhood/Township/Villiages/provinices) >- ...

... >- County >- Town >- City >- State >- Country >- Planet >- SolarSystem >- Galaxies >- ...

!! πŸ‘€ !! THERE ARE JOINS BETWEEN EVERY SINGLE FORM OF RELATIONAL-LOCATIONS

#< NYC >< USA > #< DC >< USA > #< Indonesia >

MODELS

User

User:Auth 🌟

Attributes

t.string :name

t.string :username

t.string :email

t.string :current_location

t.string :password_digest

:password * -> salted + hashed -> password_digest

123, password, abc ->->->->->->->->->->->-> XBJ7-JCKDB JCDS-NJ4K-KS6J-N5JH-D737

-x- t.integer :age

age users

-x- t.string :hometown


Alert

Attributes

t.string :title

t.string :description

t.datetime :alert_time

t.belongs_to :user

-x- date + time sepreately - At This Time πŸ˜‰


JOIN: AlertDamage

Attributes

t.string :level :: "minor", "moderate", "high", "critical"

t.belongs_to :alert

t.belongs_to :damage_type


DamageType

Attributes

t.string :level :: "minor", "moderate", "high", "critical"

-x-

t.integer :level :: 10, 20, 30, ... 100

~ DamagedThings

Could Be Another Model 😬

#< The Tapapn Zee >

#May Windup Being Instances ~ #Infrastructure t.boolean #Bridge #Electrical #Weather #Fire #Flood #Airborne


Location


JOIN: AlertLocation


@channel #BACKENDTEAM (And Anyone Who Would Like to Join Them - Ofcorse)

Your Assignment for Today Do All Generators for the Remaining Models

  • Alert
  • JOIN: AlertDamage
  • DamageType
  • Location
  • JOIN: AlertLocation

Establish sensible Attributes for all Models Remember - That Will Be Established in the Migrations

Start Working on Controller Actions for Any Requests Y’all Think Will Be Necessary Feel Free to Use Postman to test those Routes + Controller Actions πŸ‘Œ:skin-tone-5:πŸ’«

Make Seeds in a bunch of Combinations for Each Relaionship Between Models Test Out the Macros and Confirm That They Work Properly πŸ‘Œ:skin-tone-5:πŸ‘€

πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»

‼️ PLEASE ‼️

:arrow-right: NO ONE PUSH TO THE MAIN BRANCH WITHOUT TELLING ME/ALERTING THE CHANNEL

tnx :meow_ok:

πŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”Ί

Have Fuuuuuuuun:sparkles::meow_party::sparkles:

################################ ################################ ################################ ################################

The Wooblies Are Selling Snacks βœ¨πŸ±πŸ‡πŸͺ🍿🍩🍫🧁🍨🍑πŸ₯¨πŸŠπŸ±βœ¨

Models - DONE :)

You need to create the following relationships:

❗️❗️❗️❗️

❗️❗️❗️❗️

Validations

Routes

Set up the following routes. Make sure to return JSON data in the format specified along with the appropriate HTTP verb.

GET /wooblies

GET /wooblies/:id

POST /wooblies

DELETE /wooblies/:id

GET /snacks

GET /snacks/:id

POST /snacks

POST /wooblie_snacks

This route should create a new WooblySnack that is associated with an existing Snack and Woobly. It should accept an object with the following properties in the body of the request:

{
  "price": 5.55,
  "special_additional_ingredients": "LoveπŸ’›βœ¨",
  "marked_as_healthy": true,
  "snack_id": 1,  // (or any valid :id)
  "woobly_id": 5 // (or any valid :id)
}

If the WooblySnack is created successfully, send back a response with the data related to the Snack:

{
  "name": "Ice Cream",
  "ingredients": "Ice, Cream, Happiness",
  "being_sold_for": 5.55 
}

If the WooblySnack is not created successfully, return the following JSON data, along with the appropriate HTTP status code:

{
  "errors": ["validation errors"]
}

DELETE /wooblie_snacks

################################ ################################ ################################ ################################

Rails Mock Challenge - Camping Fun

Congratulations! You have been hired by Access Camp and for your first job, you have been tasked with building out a website to log campers with their activities.

In this repo, there is a Rails application with some features built out. There is also a fully built React frontend application, so you can test if your API is working.

Your job is to build out the Rails API to add the functionality described in the deliverables below.

Setup

To download the dependencies for the frontend and backend, run:

$ bundle install
$ npm install --prefix client

There is some starter code in the db/seeds.rb file so that once you've generated the models, you'll be able to create data to test your application.

You can run your Rails API on localhost:3000 by running:

$ rails s

You can run your React app on localhost:4000 by running:

$ npm start --prefix client

You are not being assessed on React, and you don't have to update any of the React code; the frontend code is available just so that you can test out the behavior of your API in a realistic setting.

There are also tests included which you can run using rspec to check your work.

Depending on your preference, you can either check your progress by:

  • Running rspec and seeing if your code passes the tests
  • Running the React application in the browser and interacting with the API via the frontend
  • Running the Rails server and using Postman to make requests

Models

You need to create the following relationships:

  • A Camper has many Signups, and has many Activitys through Signups
  • An Activity has many Signups, and has many has many Campers through Signups
  • A Signup belongs to a Camper and belongs to a Activity

Start by creating the models and migrations for the following database tables:

domain diagram

If you use a Rails generator to create the models, make sure to use the --no-test-framework flag to avoid overwriting the test files.

Add any code needed in the model files to establish the relationships.

Then, run the migrations and seed file:

$ rails db:migrate db:seed

If you aren't able to get the provided seed file working, you are welcome to generate your own seed data to test the application.

Validations

Add validations to the Signup model:

  • must have a time between 0 and 23 (referring to the hour of day for the activity)

Routes

Set up the following routes. Make sure to return JSON data in the format specified along with the appropriate HTTP verb.

GET /campers

GET /campers/:id

POST /campers

GET /activities

DELETE /activities/:id

POST /signups

This route should create a new Signup that is associated with an existing Camper and Activity. It should accept an object with the following properties in the body of the request:

{
  "time": 9,
  "camper_id": 1,
  "activity_id": 3
}

If the Signup is created successfully, send back a response with the data related to the Activity:

{
  "id": 1,
  "name": "Archery",
  "difficulty": 2
}

If the Signup is not created successfully, return the following JSON data, along with the appropriate HTTP status code:

{
  "errors": ["validation errors"]
}

class-collab-build-110121-shawsystem's People

Contributors

sdboahen avatar

Watchers

 avatar  avatar

Forkers

lucastempleton

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.