Skip to content

Commit

Permalink
Merge pull request #4 from G2-Supply/plastic-pallets
Browse files Browse the repository at this point in the history
added the the db model and route changes to handle plastic pallets
  • Loading branch information
ElijahMcKay authored Mar 12, 2020
2 parents cf07289 + c5319bc commit d8b7c3c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 28 deletions.
37 changes: 23 additions & 14 deletions models/pallets-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,29 @@ const mongoose = require('mongoose');
const palletSchema = new mongoose.Schema({
user_id: { type: mongoose.Schema.Types.ObjectId, ref: 'Users' },
kit_id: { type: mongoose.Schema.Types.ObjectId, ref: 'Kits' },
style_of_stringer: String,
length_of_stringer: String,
qty_of_stringers: String,
side_access: String,
stringer_wood_quality: String,
required_pallet_certifications: String,
stringer_special_notes: String,
style_of_top_boards: String,
qty_of_top_boards: String,
length_of_deck_boards: String,
style_of_bottom_boards: String,
qty_of_bottom_boards: String,
deck_board_wood_quality: String,
deck_board_special_notes: String,
wood: {
style_of_stringer: String,
length_of_stringer: String,
qty_of_stringers: String,
side_access: String,
stringer_wood_quality: String,
required_pallet_certifications: String,
stringer_special_notes: String,
style_of_top_boards: String,
qty_of_top_boards: String,
length_of_deck_boards: String,
style_of_bottom_boards: String,
qty_of_bottom_boards: String,
deck_board_wood_quality: String,
deck_board_special_notes: String,
},
plastic: {
type_of_plastic: String,
length_of_pallet: String,
width_of_pallet: String,
height_of_pallet: String,
}

});

// instatiating the collection with the schema we created
Expand Down
36 changes: 22 additions & 14 deletions routes/pallet-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,28 @@ router.post('/:_id', (req, res) => {
const pallet = new Pallets({
user_id: req.params,
kit_id: req.body.kitId,
style_of_stringer: req.body.styleOfStringer,
length_of_stringer: req.body.lengthOfStringer,
qty_of_stringers: req.body.qtyOfStringers,
side_access: req.body.sideAccess,
stringer_wood_quality: req.body.runnerWoodQuality,
required_pallet_certifications: req.body.requiredPalletCertifications,
stringer_special_notes: req.body.runnerSpecialNotes,
style_of_top_boards: req.body.styleOfTopBoards,
qty_of_top_boards: req.body.qtyOfTopBoards,
length_of_deck_boards: req.body.lengthOfDeckBoards,
style_of_bottom_boards: req.body.styleOfBottomBoards,
qty_of_bottom_boards: req.body.qtyOfBottomBoards,
deck_board_wood_quality: req.body.deckBoardWoodQuality,
deck_board_special_notes: req.body.deckBoardSpecialNotes,
wood: {
style_of_stringer: req.body.wood.styleOfStringer,
length_of_stringer: req.body.wood.lengthOfStringer,
qty_of_stringers: req.body.wood.qtyOfStringers,
side_access: req.body.wood.sideAccess,
stringer_wood_quality: req.body.wood.runnerWoodQuality,
required_pallet_certifications: req.body.wood.requiredPalletCertifications,
stringer_special_notes: req.body.wood.runnerSpecialNotes,
style_of_top_boards: req.body.wood.styleOfTopBoards,
qty_of_top_boards: req.body.wood.qtyOfTopBoards,
length_of_deck_boards: req.body.wood.lengthOfDeckBoards,
style_of_bottom_boards: req.body.wood.styleOfBottomBoards,
qty_of_bottom_boards: req.body.wood.qtyOfBottomBoards,
deck_board_wood_quality: req.body.wood.deckBoardWoodQuality,
deck_board_special_notes: req.body.wood.deckBoardSpecialNotes,
},
pallet: {
type_of_plastic: req.body.plastic.typeOfPlastic,
length_of_pallet: req.body.plastic.lengthOfPallet,
width_of_pallet: req.body.plastic.widthOfPallet,
height_of_pallet: req.body.plastic.heightOfPallet,
}
});

// saving the user to the users collection
Expand Down

0 comments on commit d8b7c3c

Please sign in to comment.