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

Feat: Admin managing posts feature added successfully issue 339 #406

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

MeetDOD
Copy link
Contributor

@MeetDOD MeetDOD commented Jul 9, 2024

Pull Request Resolves [#339 ]

Title: Admin managing posts feature added successfully.

Description

  1. In Backend, created 3 controllers for editing, delete post and getpostbyid and their controllers respectively.
  2. In Frontend, creating a new route for update the post, deleting the post by delete api and updating first by fetching the data from id getpostbyid and updating it and navigate back to posts page.
  3. Used appropriate toast notification.
  4. The design is responsive for all the devices.

Related Issues

Fixes #339

Changes Made

New feature: Admin managing posts feature added.

Screenshots

image

image

image

Video

Style.Share._.Login.page.-.Google.Chrome.2024-07-10.02-21-23.online-video-cutter.com.mp4

I certify that I have carried out the relevant code of conduct and provided the requisite screenshot for validation by submitting this pull request.

Thank You for this contribution.

Copy link

vercel bot commented Jul 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
style-share ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 3:11pm

Copy link

github-actions bot commented Jul 9, 2024

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

Comment on lines 281 to 295
const user = await prisma.user.findFirst({
where: {
id: userId,
},
select: {
isAdmin: true,
},
});

if (!user?.isAdmin) {
return res.status(403).json({
error: "User is not admin!",
});
}

Copy link
Owner

Choose a reason for hiding this comment

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

This user admin check is not needed since it is already done in isAdmin middleware

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@VaibhavArora314 I was also not doing this but I taught lets do like the user post contoller approach, My bad but i removed that check now 👍

@MeetDOD
Copy link
Contributor Author

MeetDOD commented Jul 12, 2024

@VaibhavArora314 can you add the label and level please !

@akbatra567 akbatra567 merged commit 67b0856 into VaibhavArora314:main Jul 12, 2024
3 checks passed
Copy link

🎉 Your pull request has been successfully merged! 🎉 Thank you for your valuable contribution to our project. Your efforts are greatly appreciated. Feel free to reach out if you have any more contributions or if there's anything else we can assist you with. Keep up the fantastic work! 🚀

@MeetDOD
Copy link
Contributor Author

MeetDOD commented Jul 12, 2024

@VaibhavArora314 @Ultimateutkarsh11 please add level 3 and GGSOC labels please 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gssoc GSSOC level3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Creating manging post by admin created by users
4 participants