Conversation
bdc34
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think that it is. (which is good)
| """ | ||
| Tapir email templates | ||
| """ | ||
| def manage_email_templates() -> Response: |
There was a problem hiding this comment.
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.
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.
| # 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.
Oh here is an example of joinedLoad.
| .all() | ||
| ) | ||
| count = session.execute(count_stmt).scalar_one() | ||
|
|
There was a problem hiding this comment.
Probably need to paginate the mods
| TapirUsers.user_id == mod.user_id | ||
| ))) | ||
| mods_map[pair].append(user) | ||
|
|
There was a problem hiding this comment.
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.
| @@ -0,0 +1,23 @@ | |||
|
|
|||
There was a problem hiding this comment.
Mark has started working on making something like arxiv-db in arxiv-base .
There was a problem hiding this comment.
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.