Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rachelle De Jesus Pestanas -COMPLETED- #269

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Rachelle De Jesus Pestanas -COMPLETED- #269

wants to merge 10 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jun 28, 2018

Sprint Challenge Checklist

  • Complete Answers.md
  • Install yarn and its dependencies
  • Add Server Endpoints
  • Create Schemas: budgetModel, expenseModel, and categoryModel
  • Create Routers: budgetRouter, expenseRouter, and categoryRouter

BUDGET

  • POST to '/budget'

EXPENSE

  • POST to '/expense'
    .select budget_id and category_id. Add this to schema if not already there.
    .populate your budget and category docs
  • GET '/expense'

CATEGORY

  • POST to '/category'
    post a minimum of four categories so when you create your expenses you can assign where they go!
  • GET '/category'
    .select the title of the categories

Copy link

@designerexpert designerexpert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments

  • Keep forging ahead, You are making good progress.
  • I see you have a good grasp oh MongoDB and Node already.

.get((req, res) => {
Expense
.find({})
.populate('budget', '_id title budgetAmount' )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid! I like the well placed use of both populates here for budget and category inside the Expense.

@@ -0,0 +1,19 @@
const mongoose = require('mongoose');
const ObjectId = mongoose.Schema.Types.ObjectId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstracting the ObjectId type like this really comes in handy when using it in reference properties. This method is a great shorthand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant