erp-backend icon indicating copy to clipboard operation
erp-backend copied to clipboard

[Feat]: [Add Validation for Activity]

Open TejasNair9977 opened this issue 2 years ago • 11 comments

Description

There needs to be validation for all IDs in here. The validation must be done in the controller. You need to provide the service with a proper filter so that it can check if the ID provided in req.body actually exists for each collection that it belongs to. For example, In req.body for adding Activity, it needs to check that the provided IDs actually exist in the database. As always, never trust that the user is providing valid data.

Use Case

It will make sure that data given by the user to the database is valid.

Proposed Solution

Right before the function that creates the document, check if the IDs provided by the user is valid.

TejasNair9977 avatar Oct 29 '23 10:10 TejasNair9977

Hi there. This would actually be my first ever contribution. I'll go ahead as instructed on the readme if that's ok

churrundo avatar Oct 29 '23 11:10 churrundo

Aaand I just found the contribution guidelines and the instruction to not start working until being assigned the issue... 😳

I haven't actually touched anything. I've been doing the installations and setting up the environment. I'll wait for a green light to continue

churrundo avatar Oct 29 '23 12:10 churrundo

ah sorry for being late @churrundo . you can go ahead anytime, i have assigned this issue to you. thank you for taking interest in this project!

TejasNair9977 avatar Oct 29 '23 12:10 TejasNair9977

Thanks!

churrundo avatar Oct 29 '23 12:10 churrundo

@churrundo the testcases for Activity might act up after you make your changes, so just like add data into your DB with the same IDs as in the testcase files through compass or atlas, wherever you code on, like so image and after that ig you should be fine.

TejasNair9977 avatar Oct 29 '23 13:10 TejasNair9977

Perfect, thank you

churrundo avatar Oct 29 '23 13:10 churrundo

@churrundo I'd recommend you to sync your branch and have a look at the new middleware. I'm sure itll make this issue a lot easier to solve!

TejasNair9977 avatar Oct 29 '23 18:10 TejasNair9977

Ok... So it just needs to count the amount of id's?

churrundo avatar Oct 29 '23 18:10 churrundo

effectively yeah @churrundo

TejasNair9977 avatar Oct 29 '23 18:10 TejasNair9977

Lmao. That's so much simpler

churrundo avatar Oct 29 '23 18:10 churrundo

plz assign this issue to me

hricha11 avatar Dec 10 '23 13:12 hricha11