Sarah King
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Wine-os App Resubmit All the work you did over the first weekend definitely shows because most of your sequelize functionality is there!~~The main reason your app isn't functioning is because there is a lack of connection between your API, your database, and your routes. In order to simplify this app and get you to passing, I'm giving you a detailed road map of your user stories, info you'll need to get from the api, models, and routes.~~ Utilize TAs, and please keep us updated throughout the process! Please resubmit a working project by **Monday, September 6th at 9am PST**. This may seem like a huge revamping of your app, but you have a lot of the database functionality and routing in place, so you won't have to write it all from scratch (unless that's what you want to do) ## What you have left: * [ ] Add/finish installation instructions to the readme * [x] Protect your note CRUD routes so one user can't edit/delete another user's notes * [x] Fix the redirects on the note post/update routes so they redirect to the wine show page, not the wine index page * [x] Add the `/notes` route so a user can view all the wines that they have made notes on * [x] Remove bottom script tag from your `layout.ejs` and line 13 from your `server.js` (they're not doing anything) * [x] Change the link text on the wine cards from 'add a tasting note' to just 'tasting notes' or something like that (so the user knows that's where they go to view the tasting notes and edit/delete them too) * [x] Have *something* relevant displaying on the user profile page (like the name and a link to the `/notes` route) * [x] Make sure all of your tasting notes routes are in the tasting notes controller file (and not in the wine controller) ## User Stories * [X] A user can log in. * [x] A user can view all wines _(query the api)_ * [x] A user can view all notes for a wine _(query the database)_ * [x] A user can add a note _(POST to database)_ * [x] A user can edit a note they wrote _(PUT to the databse)_ * [x] A user can delete a note they wrote _(DELETE to the databse)_ ## API vs. Seeding ~~Rather than worrying about using your API to seed your database (which it looks like you were trying to do), use the api for finding a list of wines. Your api can take up to 10 requests per minute, which isn't a lot, so be mindful of the number of times you hit the route that queries it.~~ I get why it makes sense to seed the db - that's totally cool if you have a seed file that works and you can put instructions on how to run it in your readme. ## Models * [x] User * [x] Note ### User | Column Name | Data Type | Notes | | --------------- | ------------- | ------------------------------ | | id | Integer | Serial Primary Key, Auto-generated | | name | String | Must be provided | | email | String | Must be unique / used for login | | password | String | Stored as a hash | | createdAt | Date | Auto-generated | | updatedAt | Date | Auto-generated | ### Note | Column Name | Data Type | Notes | | --------------- | ------------- | ------------------------------ | | id | Integer | Serial Primary Key, Auto-generated | | body | Text | Must be provided _(ie "full bodied with notes of chocolate")_ | | userId | Integer | Must be provided | | title | String | Must be provided _(This is to identify different notes, can be the name of the wine)_ | | wineId | Integer | Must be provided, from API _(This will correlate to the ID provided by the API so you can use it to get details about a specific wine)_| | createdAt | Date | Auto-generated | | updatedAt | Date | Auto-generated | ### Routes #### GET ROUTES * [x] `/profile` THIS NEEDS TO HAVE SOME INFO ON IT IF ITS GOING TO EXIST * [x] `/wines` * [x] `/wines/:wineId` * [ ] `/notes` * [ ] ~~`/notes/new/:wineID/:wineName`~~ * [x] `/notes/:id` * [ ] ~~`/notes/edit/:id`~~ #### POST, PUT, DELETE ROUTES (these need to be properly protected and redirected) * [ ] POST `/notes` * [ ] PUT `/notes/:id` * [ ] DELETE `/notes/:id` Your auth routes are done, so I am not including them here. | Method | Path | Location | Purpose | Links or Redirects to | | ------ | ---------------- | -------------- | ------------------- |---| | GET | /profile | server.js | show basic user data like name and email| LINKS: /notes | | GET | /wines | wines.js | Show a list of all wines from the **api** | LINKS: /wines/:wineId | | GET | /wines/:wineId | wine.js | Show the wine information from the **api** as well as ALL notes from the **database** with that associated wineId| LINKS: /notes/new/:wineId | GET | /notes | wineTasting.js | This will show a list of all the wines a user has made a note on in the **database** | LINKS: /notes/:id | ~~GET~~ | ~~/notes/new/:wineID/:wineName~~ | ~~wineTasting.js~~ | ~~will show a form to create a new note about a wine _(the :wineName is optional, but useful for the new form so it's a little clearer what the tasting is about)_~~| ~~ACTION: /notes~~ | GET | /notes/:id | wineTasting.js | Show a specific note from the **database** | LINKS: /wines/:wineId AND /notes/edit/:id | ~~GET~~ | ~~/notes/edit/:id~~ | ~~wineTasting.js~~ | ~~show a form to edit a specific note~~ | ~~ACTION: /notes/:id (both PUT and DELETE)~~ | POST | /notes | wineTasting.js | will add a wine to the **database** | REDIRECTS: /notes/:id | PUT | /notes/:id | wineTasting.js | edit a specific note | REDIRECTS: /notes/:id | DELETE | /notes/:id | wineTasting.js | delete a specific note | REDIRECTS: /notes ## Suggested Plan There is a lot to implement here, but if you go step by step and utilize TA support, you will be able to make good progress while understanding each step. 1. Stub out your routes—get your routes to the point where, when you hit them, they `res.send('HIT /notes')` or something along those lines. 2. Get your Get routes rendering—render your ejs pages, if they will eventually have information in them (for example `/notes/:id`) then simply create a stub EJS that has everything but the info that will come from the database (you can write something like `"coming soon!"` in a `<p>` tag) 3. Get information from your api—write a test route that, when hits, queries the API and `res.send` the data to your front end. Get that working for the two types of request you'll be making. 4. Hook up your API to your API-dependent GET routes—get information rendering on the page in the way that you want. 5. Test your forms—hook up your forms to your routes, check that they work by console logging the information passed up to the form and redirecting back home. Make sure that you can console log all the information that your database will need (to see what your DB needs, look to your schema) 6. Test adding a note 7. Test deleting a note 8. Test updating a note 9. Style—If you have time, this part is optional 10. Deploy up to heroku—it might be easier to start fresh on this deploy to clean up your database on Heroku 11. Message your instructors with the link!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully