RealDevSquad / RealDevSquad/website-backend

Refactor `getItems` to accept an object

Open
#849 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactor
Dominant language
JavaScript
Stars
74
Forks
276
Avg merge
1d 26m
Merged PRs (30d)
14

Description

Could these be merged into just function, and we could pass an object as argument to select the itemId or the tagtype?

ItemModel.getItems({ itemId });
ItemModel.getItems({ tagType });

Having to maintain a lot of code per field type seems like something we can avoid.

Originally posted by @ankushdharkar in https://github.com/Real-Dev-Squad/website-backend/pull/815#discussion_r1035061550

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating ItemModel.getItems and reading its current field-specific implementations and callers. Confirm how itemId and tagType are handled, then assess the affected call sites and verify that both object forms preserve the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.