-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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-#178: added admin UI to frontend #369
feat-#178: added admin UI to frontend #369
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey @devsharmagit! Thanks for sticking to the guidelines! High five! 🙌🏻 |
@devsharmagit can you kindly rebase to upstream's main |
1 similar comment
@devsharmagit can you kindly rebase to upstream's main |
@devsharmagit kindly finish this |
@krishnaacharyaa |
feat-krishnaacharyaa#178: rebase to the main
ffc2cc7
to
8af331c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please just have a video in PR description showcasing the functionality
frontend/src/pages/admin-users.tsx
Outdated
_id: string; | ||
fullName: string; | ||
role: 'ADMIN' | 'USER'; | ||
email: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This guy shouldn't he use the enum defined below?
Can you kindly replace all the interface to types
</p> | ||
</div> | ||
{user.role === 'ADMIN' && ( | ||
<button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use enum instead, kindly replace all the places this is used to use enum
Hey @devsharmagit! Thanks for sticking to the guidelines! High five! 🙌🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
The enum role as far as I know, he is been used everywhere, Can we lift it up
And the User type isn't it already defined? I feel it should go to its proper types folder,
Because it is not specific to onlyadmin-users
right? -
And we need to call the clean redis function as well, when ever any post is deleted or edited.
-
I guess editing is not functional, if it is not create an issue so that someone else can work on this, so that we don't miss.
I can get this in, if you can raise another PR for the refactoring (1)
We need (2) changes and (3) to get this in, meaning merge, (1) we can take it seperately
cc: @devsharmagit
Thank you for all the support :)
@krishnaacharyaa I will raise an issue related to editing the place and eventually work on it and complete it. |
Just use the existing util function @devsharmagit to clean up the redis |
@krishnaacharyaa apart from that everything is fine from your side? |
Yes. Figure out from other places it is being used |
okay @krishnaacharyaa ! |
@krishnaacharyaa |
@devsharmagit kindly raise 1 and 3 and comment here, so that i close this |
res.status(HTTP_STATUS.OK).json(updatedPost); | ||
// invalidate the redis cache | ||
await deleteDataFromCache(REDIS_KEYS.ALL_POSTS), | ||
await deleteDataFromCache(REDIS_KEYS.FEATURED_POSTS), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should ideally format, I'm confused, why isn't it working for you !!
we have a husky hook which actually formats the code,
Isn't it working for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess its not working for me.
i will manually do "npm run format" in both frontend and backend and push the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure @devsharmagit
@@ -152,7 +155,11 @@ export const deletePostByIdHandler = async (req, res) => { | |||
} | |||
await User.findByIdAndUpdate(post.authorId, { $pull: { posts: req.params.id } }); | |||
|
|||
res.status(HTTP_STATUS.OK).json({ message: RESPONSE_MESSAGES.POSTS.DELETED }); | |||
// invalidate the redis cache | |||
await deleteDataFromCache(REDIS_KEYS.ALL_POSTS), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @devsharmag99 for the efforts
@krishnaacharyaa |
Oooh okay cool hai no problem @devsharmagit |
Summary
Added admin UI to frontend
Description
This PR adds all the admin functionality and UI to the frontend.
Checkout by logging in as admin.
/admin/user and /admin/blog route is implemented correctly.
A button in the header layout is also added to navigate to the admin dash board.
2024-06-13.08-50-00.mp4
Issue(s) Addressed
Closes #178
Prerequisites