daily-code icon indicating copy to clipboard operation
daily-code copied to clipboard

Fixed: Admin

Open ShubhamMewara opened this issue 1 year ago • 9 comments

Fixed #142 also, Fixed #176 Added feat to add and edit Problems and Tracks in admin

Final Changes

https://github.com/code100x/daily-code/assets/136337515/98628979-38de-462d-bec2-ccc042a891a2

ShubhamMewara avatar Apr 08 '24 23:04 ShubhamMewara

Added feat to link Track and Problems

https://github.com/code100x/daily-code/assets/136337515/909b0819-cb9a-424c-80aa-770af1985d1d

ShubhamMewara avatar Apr 09 '24 20:04 ShubhamMewara

good start its missing

  1. image in the track
  2. A way to attach problems to tracks

LMK if u'd like to work on it. If not we can merge this as is and someone else can pick it up

hkirat avatar Apr 11 '24 13:04 hkirat

What does LinkProblems do?

hkirat avatar Apr 11 '24 13:04 hkirat

Added feat to link Track and Problems 2. A way to attach problems to tracks What does LinkProblems do? link.mp4

it lets users add existing Problems to a track by using ProblemID. I have attached a video of it

ShubhamMewara avatar Apr 11 '24 14:04 ShubhamMewara

  1. image in the track

it shows the image link for now do you want it to image and image link when click on edit

ShubhamMewara avatar Apr 11 '24 14:04 ShubhamMewara

LMK if u'd like to work on it. If not we can merge this as is and someone else can pick it up

I would like to work on it and #176

ShubhamMewara avatar Apr 11 '24 14:04 ShubhamMewara

hey @hkirat , I have Added auth to Admin and

good start its missing

  1. image in the track

Changed the image link text to 'Image'. Now, I will work on #176. You can merge it, or I can commit to this PR only, whichever you prefer.

https://github.com/code100x/daily-code/assets/136337515/f0bafb0f-ca54-4da4-9849-8fa0d0f1889b

ShubhamMewara avatar Apr 11 '24 16:04 ShubhamMewara

Have added login for the issue #176?

SujithThirumalaisamy avatar Apr 11 '24 17:04 SujithThirumalaisamy

@hkirat Added #176

https://github.com/code100x/daily-code/assets/136337515/1787577a-703b-480b-8ed4-281a7a2e1b04

ShubhamMewara avatar Apr 12 '24 10:04 ShubhamMewara

reviewing

hkirat avatar Apr 14 '24 14:04 hkirat

Didnt review it too much will be merging and winging it If there are follow ups will create and more issues and tag you @ShubhamMewara /bounty $125

hkirat avatar Apr 14 '24 14:04 hkirat

Can't we add a role in the authOptions callback, Verify the role from .env file

Similar to how it's done in cms

And in /app/admin, add a layout.tsx file which will check the if the role is admin, otherwise redirect to "/"

Add the admin's email id in the env file and you're good to go, no need to keep modifying the db

@hkirat @ShubhamMewara

nimit9 avatar Apr 14 '24 14:04 nimit9

@nimit9 can you tell why that is a better option?

ShubhamMewara avatar Apr 14 '24 14:04 ShubhamMewara

Will have to manually add the admin boolean to the db.

nimit9 avatar Apr 14 '24 14:04 nimit9

ok, I will do it if @hkirat asked thank you.

ShubhamMewara avatar Apr 14 '24 14:04 ShubhamMewara

Didnt review it too much will be merging and winging it If there are follow ups will create and more issues and tag you @ShubhamMewara /bounty $125

Ok , Thank you

ShubhamMewara avatar Apr 14 '24 15:04 ShubhamMewara

Determining admin role can be done anyhow, but adding the check in layout.tsx makes more sense.

This way, there will be a central check done for admin.

Anyone can add the feature in /admin without worrying about how to protect it.

nimit9 avatar Apr 14 '24 15:04 nimit9

Ah that probably makes sense why it was done re: local development Personally I like it better for it to be in the DB For this repo this is fine

hkirat avatar Apr 14 '24 17:04 hkirat

Also I'm going through the change and it is very comprehensive. Amazing job @ShubhamMewara

hkirat avatar Apr 14 '24 17:04 hkirat

@hkirat Thank you so much!

ShubhamMewara avatar Apr 14 '24 17:04 ShubhamMewara

Yes, good job @ShubhamMewara.

nimit9 avatar Apr 14 '24 17:04 nimit9

Yes, good job @ShubhamMewara.

Thank you.

ShubhamMewara avatar Apr 14 '24 17:04 ShubhamMewara