Jesse-Driskill / Tublr

BottomText
0 stars 0 forks source link

Design Docs #1

Open siascone opened 2 years ago

siascone commented 2 years ago

Wiki Page Home


MVP List


Database Schema


Sample State


Backend Routes


Frontend Routes

siascone commented 2 years ago

Above is a list of guide lines you can follow to complete each design docs.

Here is a markdown language cheetsheet

Here is a markdown table generator

I will follow this comment with example markdown for each page and you can fill out/expand on the rest

siascone commented 2 years ago

Wiki Home page

Welcome to the bluebird wiki!

# Bluebird Design Documents

[Bluebird Live]()

+ [MVP list](mvp-list)
+ [Schema](schema)
+ [Sample State](sample-state)
+ [Frontend routes and components](frontend-routes)
+ [Backend routes](backend-routes)
siascone commented 2 years ago

MVP List

Example of MVPs 1, 2, and 7. Everyone will have these, you should add in your four features as MVPs 3, 4, 5, and 6.

### 1. Hosting on Heroku (04/03/2018)

### 2. New account creation, login, and guest/demo login (04/04/2018, 2 days)
  + Users can sign up, sign in, log out
  + Users can use a demo login to try the site
  + Users can't use certain features without logging in (creating chirps & likes)

### 7. Production README (04/13/2018, 0.5 days)
siascone commented 2 years ago

Schema

Here is an example of a users table. You should make the rest of the tables you need with relevant column names, data types, details and bullets


# Postgres Database Schema

## `users`
| column name       | data type | details                   |
|:------------------|:---------:|:--------------------------|
| `id`              | integer   | not null, primary key     |
| `username`        | string    | not null, indexed, unique |
| `email`           | string    | not null, indexed, unique |         
| `password_digest` | string    | not null                  |
| `session_token`   | string    | not null, indexed, unique |
| `created_at`      | datetime  | not null                  |
| `updated_at`      | datetime  | not null                  |

+ index on `username, unique: true`
+ index on `email, unique: true`
+ index on `session_token, unique: true`
+ `has_many chirps`
+ `has_many likes`
siascone commented 2 years ago

Sample State

Example sample state

```js
{
  entities: {
    chirps: {
      1: {
        id: 1,
        body: "bluebirds like blueberries",
        authorId: 11,
      },
      2: {
        id: 2,
        body: "bluebirds also like blue potatoes",
        authorId: 25,
      },
      3: {
        id: 3,
        body: "bluebirds are more like fruit",
        authorId: 11,
      }
    },
    users: {
      11: {
        id: 11,
        username: "blue_macaw",       
      },
      25: {
        id: 25,
        username: "blue_toucan",
        imgUrl: "https://cdn.pixabay.com/photo/2015/10/01/16/43/toucan-967334_960_720.jpg"
      }
    },
    likes: {
        1: {
           id: 1, 
           userId: 2,
           chirpId: 1
        }
    }
  },
  ui: {
    loading: true/false,
    modal: true/false
  },
  errors: {
    login: ["Incorrect username/password combination"],
    chirpForm: ["Chirp body cannot be blank"],
  },
  session: { currentUserId: 25 }
}
siascone commented 2 years ago

Frontend Routes

Example frontend routes

## Frontend Routes
+ `/`
  + `Splash`
+ `/login`
  + `SessionForm`
+ `/signup`
  + `SessionForm`
+ `/feed`
  + `ChirpIndex`
    + `ChirpIndexItem`
+ `/users/:userId`
  + `ProfileComponent`
  + `ChirpIndex`
    + `ChirpIndexItem`
+ `/chirps/new`
  + `ChirpForm`
+ `/chirps/:chirpId`
  + `ChirpShow`
+ `/chirps/:chirpId/edit`
  + `ChirpForm`
siascone commented 2 years ago

Backend Routes

Example backend routes

# Backend Routes

## HTML

+ `GET /` - `StaticPagesController#root`

## API Endpoints

### `users`
+ `GET /api/users` - returns the user information of displayed chirps and for the User Search feature
+ `POST /api/users` - sign up

### `session`
+ `POST /api/session` - log in
+ `DELETE /api/session` - log out

### `chirps`
+ `GET /api/chirps` - returns relevant chirps (filtered by `data`/`params`)
+ `GET /api/chirps/:id` - returns chirp
+ `POST /api/chirps` - creates a chirp
+ `PATCH /api/chirps/:id` - edit a chirp
+ `DELETE /api/chirps/:id` - remove a chirp

### `likes`
+ `POST /api/likes` - like a chirp
+ `DELETE /api/likes/:id` - unlike a chirp

Note: likes does not include a `GET` route because we will have these routes render the `api/chirps/show.json.jbuilder` view. See [Sample State](sample-state). 
siascone commented 2 years ago

updates to make

MVP List

Schema

Sample State

Backend Routes

Frontend Routes

siascone commented 2 years ago

These docs are looking really good. Below are the final updates. Let me know when you have these complete.

MVP List

Backend Routes