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

Subscription controllers #81

Open
GRajKumar2512 opened this issue Jan 23, 2024 · 3 comments
Open

Subscription controllers #81

GRajKumar2512 opened this issue Jan 23, 2024 · 3 comments

Comments

@GRajKumar2512
Copy link

GRajKumar2512 commented Jan 23, 2024

i am not sure whether these controller functions are at there correct place:

const router = Router();
router.use(verifyJWT); // Apply verifyJWT middleware to all routes in this file

router
  .route("/c/:channelId")
  .get(getSubscribedChannels)
  .post(toggleSubscription);

router.route("/u/:subscriberId").get(getUserChannelSubscribers);

because in the controllers files:
getSubscribedChannels is fetching the subscriberId
and
getUserChannelSubscribers is fetching the channelId

@AdityaChaudhary3
Copy link

Yes,
When I am working on it. I also saw this problem.
So, then we can change them as our requirement. But, It is good to raise this issue for future concern.
Will it affect other functions or not? please update here. If I find one I will update.

@SaunakNandi
Copy link

Can't you include the getSubscribedChannels inside the post() method as a middleware.

@anurag2169
Copy link

I have update the subscription router and now it is working as excepted:

updated code 👍🏼

router
.route("/c/:channelId")
.get(getUserChannelSubscribers)
.post(toggleSubscription);

// router.route("/u/:subscriberId").get(getUserChannelSubscribers);
router.route("/u/:subscriberId").get(getSubscribedChannels);

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

No branches or pull requests

4 participants