eronka / culero-api

Open source alternative to LinkedIn
https://www.culero.com
13 stars 10 forks source link

API to get average review score #34

Closed hsb1007 closed 6 months ago

hsb1007 commented 6 months ago
image

API to get user's average review score 1. overall 2. each category (professionalism/ reliability / communication).

1 API for logged in user 2 API for other user's profile

What would be the best way to handle the caching this?

hsb1007 commented 6 months ago

/bounty $30

algora-pbc[bot] commented 6 months ago

💎 $30 bounty created by eronka 🙋 If you start working on this, comment /attempt #34 along with your implementation plan 👉 To claim this bounty, submit a pull request that includes the text /claim #34 somewhere in its body 📝 Before proceeding, please make sure you can receive payouts in your country 💵 Payment arrives in your account 2-5 days after the bounty is rewarded 💯 You keep 100% of the bounty award 🙏 Thank you for contributing to eronka/culero!

👉 Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @mehulmathur16 #44
mehulmathur16 commented 6 months ago

@hsb1007 can I be assigned?

mehulmathur16 commented 6 months ago

@hsb1007 Thanks for assigning.

rajdip-b commented 6 months ago

Adding a comment to address the caching issue:

Considering that we have a caching layer set (using nest cache or anything else), we can follow this approach:

P.S. for better performance, we can use pg-boss to schedule jobs to run on postgres since we are already using psql.

@hsb1007 thoughts?

hsb1007 commented 6 months ago

Adding a comment to address the caching issue:

Considering that we have a caching layer set (using nest cache or anything else), we can follow this approach:

  • We maintain a key witht the user id. The relation will be userId -> score
  • Whenever the review data is updated/added, we first write the data in the db, then we compute the score, then we add it in cache asynchronously.
  • Whenever we try retrieving the data, we can check the cache for userId, see if the key is present. If yes, return it. If no, compute the score, store the cache, return the data.

P.S. for better performance, we can use pg-boss to schedule jobs to run on postgres since we are already using psql.

@hsb1007 thoughts?

Sounds awesome! @mehulmathur16 can you please incorporate this?

hsb1007 commented 6 months ago

Adding a comment to address the caching issue: Considering that we have a caching layer set (using nest cache or anything else), we can follow this approach:

  • We maintain a key witht the user id. The relation will be userId -> score
  • Whenever the review data is updated/added, we first write the data in the db, then we compute the score, then we add it in cache asynchronously.
  • Whenever we try retrieving the data, we can check the cache for userId, see if the key is present. If yes, return it. If no, compute the score, store the cache, return the data.

P.S. for better performance, we can use pg-boss to schedule jobs to run on postgres since we are already using psql. @hsb1007 thoughts?

Sounds awesome! @mehulmathur16 can you please incorporate this?

@mehulmathur16 All good, I will raise it as a separate issue!

mehulmathur16 commented 6 months ago

@hsb1007 I'll look into this.

algora-pbc[bot] commented 6 months ago

💡 @mehulmathur16 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] commented 6 months ago

🎉🎈 @mehulmathur16 has been awarded $30! 🎈🎊