mentorship-backend
mentorship-backend copied to clipboard
created early CLI prototype
Description
In my opinion, working with the backend using Postman isn't really a great experience. POST
Register user with a real email, open mailbox and confirm, then POST
login. And if you want to use many other endpoints, you also need JWT for a particular user. And that user sometimes needs to be an admin (when u perform admin-like things). Huh, a lot of boring and tedious work.
I've seen issue #275, then #78, and thought...let's do it! I decided to go with Click, as it's provided by Flask out-of-the-box (Flask uses it internally for its own stuff, too). It's also very cool. From an "architectural side" I use Blueprints. They fit this use case quite well and are fairly simple.
And here it is, an early CLI prototype. I really hope it makes its way to the merge with main branch. It will save a lot of time:)
Features:
- dropping and creating database
- populating database with initial data
- creating, updating and removing users
- easy listing of all users and specific user (by id, username and email)
- listing, assigning and revoking admins
- managing mentorship relations
- managing tasks
To be added:
- unit tests
- some decent documentation
fixes #275, #78 (well, it will fix when it gets stable)
Type of Change:
- Code
- Quality Assurance
- User Interface [I'm not sure here...CLI is kinda like UI for a developer)
- Documentation
I think it's worth mentioning that I had to upgrade Flask
dependency to 1.1.1
. That's beacuse this very useful functionality is available since 1.1.0
. And 1.1.0
messed some things that 1.1.1
fortunately fixed.
Code/Quality Assurance Only
- Bug fix (non-breaking change which fixes an issue)
- This change requires a documentation update (software upgrade on readme file)
How Has This Been Tested?
Tested manually, but as said above, this is an early prototype. Consider this whole things as unstable - no unit tests, functionality isn't guarranteed to work. Use at you own risk (in the worst case you'll nuke your local database).
How to use it? (Example)
- Make sure that virtualenv is activated.
-
flask
(yea, just typeflask
in the terminal) - You'll see commands at the bottom
- Let's say you want to create a new user.
-
flask user
will show you methods available for managing users. - You see that
flask user create
is what you need. Type it in the terminal. - Follow the instructions on screen.
- User is added.
- Now let's display all users using
flask user show -s
. -s flag shows only essential data.
I encourage you to explore and try (and find inevitable bugs). I'll try to write some more examples or maybe even ~~record a short video tutorial on how to use it~~ demo/tutorial here
Checklist:
- [ ] My PR follows the style guidelines of this project
- [x] I have performed a self-review of my own code or materials
- [ ] I have commented my code or provided relevant documentation, particularly in hard-to-understand areas (I will)
- [ ] I have made corresponding changes to the documentation (I will)
- [ ] Any dependent changes have been merged
- [x] Update requirements.txt
Code/Quality Assurance Only
- [x] My changes generate no new warnings
- [ ] My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
PS Any feedback would be greatly appreciated. I'm coming from NodeJS-land and still feel quite new and uncertain in this astonishing Python-Flasky world.
PPS I'll squash the commits when we it gets approved by mentors.
@isabelcosta I think it may interest you
Sure, changed :)
I've recorded video demonstration.
@isabelcosta @BadduCoder I'd love to hear your opinion and suggestions 😄 (if you have time of course)
@bartekpacia This is my first time looking and actually thinking about this, so I just watched your video and this is pretty amazing :) And I just love that this helps to create a set of users just from a JSON file. I feel that this will require some changes, I will review soon. Do you wish to continue with this issue, if I end up proposing changes?
I already learned new things from this PR.
@isabelcosta Oh, this PR. I remember how much work I put into this:) happy to hear you like it. I'd love this to be developed further because it has the potential of saving many hours of rather tedious work (I remember I was using this very often during GCI for my private testing purposes).
I'll wait for your opinions and will try to find some time to polish this. Hopefully it'll make its way into master.
i accidentaly closed👀
help
I accidentally opened 👀
hi @bartekpacia could you mind to resolve the conflicts in this PR so, that it can be ready to merge :)
@robotjellyzone Sure, resolving now.
I've spent 1 hour trying to setup dev env for this project, but some extremely strange bugs appear. Finally, I resolved it using GitHub's website editor, so I couldn't test it :/
at least checks are passing🙏
@isabelcosta any response on this? I'd really love to see this get merged. (It might need some testing & updates, but I'm willing to provide necessary help)
just a ping @isabelcosta :)
Closing this due to inacativity also author is not assigned to the issue .
@vj-codes , I'd really like to finish this feature:) Please consider reopening and assigning me – I will try to work on it when I have time. Are there any hard limits on the duration of how long can a PR be worked on by an author?
@bartekpacia suree I'll assign it to you! No limits on duration but you should update the progress or approx time required so the PR is not inactive otherwise it could be closed by someone again 👀
@bartekpacia also there are some merge conflicts do solve them when you have time, thanks!
That's great, thank you:)
I'm looking at the list of all my PRs and this is one of the oldest ones. Unfortunately I don't see a chance on getting this merged, last change (d878a013060785a0a077ea16342707b501880827) was made more than a year ago, so I'm going to reluctantly close this PR. Maybe, hopefully, in the future someone will be willing to pick this up.
Good old Google Code-in times. Thanks to everyone involved!