-
Notifications
You must be signed in to change notification settings - Fork 2
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
Register, admin, mod views #8
base: develop
Are you sure you want to change the base?
Conversation
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 looks fine. I'm concerned that work that already exists on the develop
branch is being re-done.
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.
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 think that it is. (which is good)
""" | ||
Tapir email templates | ||
""" | ||
def manage_email_templates() -> Response: |
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.
Maybe a different name here? maybe all_email_templates()
""" | ||
Get user profile | ||
""" | ||
def user_profile(user_id:int) -> Response: |
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.
SQLAlchemy has the ability to add query options and one of those is "joinedLoad" so that when an ORM object is brought back from the DB, a joined set of rows is also brought back.
An example from modapi:
https://github.com/arXiv/modapi/blob/2adf28577778c22b8e0b679902f4667289d42dd0/modapi/rest/submissions/routes.py#L40
Docs:
https://docs.sqlalchemy.org/en/14/orm/loading_relationships.html
In this case something like:
[joinedLoad(TapirUser.demographics)]
might be useful.
admin_webapp/controllers/users.py
Outdated
# TODO: this is broken because of a faulty TapirUser-Demographic relationship | ||
def suspect_listing(per_page:int, page: int) -> dict: | ||
session = get_db(current_app).session | ||
report_stmt = (select(TapirUsers) |
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.
Oh here is an example of joinedLoad
.
.all() | ||
) | ||
count = session.execute(count_stmt).scalar_one() | ||
|
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.
Probably need to paginate the mods
TapirUsers.user_id == mod.user_id | ||
))) | ||
mods_map[pair].append(user) | ||
|
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.
Also may need to paginate this. We don't think of mods for a category as getting very large but result sets often creeps up over time when the system starts to get used in ways we didn't originally think of.
You can start with a large page size.
admin_webapp/models.py
Outdated
@@ -0,0 +1,23 @@ | |||
|
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.
Mark has started working on making something like arxiv-db
in arxiv-base
.
admin_webapp/routes/endorsement.py
Outdated
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.
A lot of work on endorsement exists on develop
https://github.com/arXiv/admin-webapp/blob/develop/admin_webapp/routes/endorsement.py
…qlalchemy woot woot
This PR encapsulates the following routes
Going forward I will make smaller PRs for the forthcoming features.