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

setup_values_get_put_delete Issue #11 Resolved #16

Merged
merged 4 commits into from
Jan 9, 2024

Conversation

Xire7
Copy link
Contributor

@Xire7 Xire7 commented Dec 6, 2023

Added GET PUT DELETE route handling functions to ValueRouter.js

Copy link
Contributor

@ctc-devops ctc-devops left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

eslint

routes/valueRouter.js|109 col 9| Identifier 'canned_dog_food_quantity' is not in camel case.
routes/valueRouter.js|110 col 9| Identifier 'dry_dog_food_quantity' is not in camel case.
routes/valueRouter.js|111 col 9| Identifier 'canned_cat_food_quantity' is not in camel case.
routes/valueRouter.js|112 col 9| Identifier 'dry_cat_food_quantity' is not in camel case.
routes/valueRouter.js|113 col 9| Identifier 'misc_items' is not in camel case.
routes/valueRouter.js|114 col 9| Identifier 'volunteer_hours' is not in camel case.

try {
const { id } = req.params;
const {
business_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'business_id' is not in camel case.

const { id } = req.params;
const {
business_id,
donation_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'donation_id' is not in camel case.

const {
business_id,
donation_id,
food_bank_donation,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'food_bank_donation' is not in camel case.

reporter,
email,
date,
canned_dog_food_quantity,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'canned_dog_food_quantity' is not in camel case.

email,
date,
canned_dog_food_quantity,
dry_dog_food_quantity,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'dry_dog_food_quantity' is not in camel case.

: ''
}
${dry_cat_food_quantity ? `, dry_cat_food_quantity = $(dry_cat_food_quantity) ` : ''}
${misc_items ? `, misc_items = $(misc_items) ` : ''}
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'misc_items' is not in camel case.

}
${dry_cat_food_quantity ? `, dry_cat_food_quantity = $(dry_cat_food_quantity) ` : ''}
${misc_items ? `, misc_items = $(misc_items) ` : ''}
${volunteer_hours ? `, volunteer_hours = $(volunteer_hours) ` : ''}
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'volunteer_hours' is not in camel case.

RETURNING *;`,
{
id,
business_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'business_id' is not in camel case.

{
id,
business_id,
donation_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'donation_id' is not in camel case.

id,
business_id,
donation_id,
food_bank_donation,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'food_bank_donation' is not in camel case.

Copy link
Member

@Madhu2244 Madhu2244 left a comment

Choose a reason for hiding this comment

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

Please take a look at the comments and resolve them. Overall make sure that you are using yarn format and are not bypassing eslint error messages with a force commit.

app.js Outdated
Comment on lines 13 to 14
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
Copy link
Member

Choose a reason for hiding this comment

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

make sure to pull in the code next time before you work, otherwise we will lose some code

valueRouter.put('/:id', async (req, res) => {
try {
const { id } = req.params;
const {
Copy link
Member

Choose a reason for hiding this comment

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

const { business_id: businessId, message, timestamp, been_dismissed: beenDismissed } = req.body;

do it like so, we redefine the snake case into camel case so that we have consistent variables across our different code packages

misc_items,
volunteer_hours,
} = req.body;
if (!business_id) throw new Error('business_id is required.');
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this, we will be doing frontend validation instead.

Comment on lines 62 to 73
if (!business_id) throw new Error('business_id is required.');
if (!donation_id) throw new Error('donation_id line is required.');
if (!food_bank_donation) throw new Error('food_bank_donation is required.');
if (!reporter) throw new Error('business_id is required.');
if (!email) throw new Error('donation_id line is required.');
if (!date) throw new Error('food_bank_donation is required.');
if (!canned_dog_food_quantity) throw new Error('canned_dog_food_quantity is required.');
if (!dry_dog_food_quantity) throw new Error('dry_dog_food_quantity line is required.');
if (!canned_cat_food_quantity) throw new Error('canned_cat_food_quanitty is required.');
if (!dry_cat_food_quantity) throw new Error('dry_cat_food_quantity is required.');
if (!misc_items) throw new Error('misc_items line is required.');
if (!volunteer_hours) throw new Error('volunteer_hours is required.');
Copy link
Member

Choose a reason for hiding this comment

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

Please remove all of these "is required" lines", we will be doing frontend validation instead.

@Madhu2244 Madhu2244 merged commit 8e07f58 into dev Jan 9, 2024
1 check passed
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.

4 participants