Skip to content
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

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open

Register, admin, mod views #8

wants to merge 62 commits into from

Conversation

willyao99
Copy link
Contributor

This PR encapsulates the following routes

  • /register and /register/step2 (two step registration with Flask session)
  • /protected (Tapir landing page styles)
  • /users/{ID} (single user view)
  • /users/administrators (admin list view)
  • /users/administrators/sys (admin list view with edit system)
  • /users/moderators (moderators list view)

Going forward I will make smaller PRs for the forthcoming features.

@bdc34 bdc34 changed the base branch from master to develop January 24, 2024 21:42
Copy link
Contributor

@bdc34 bdc34 left a 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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.

# 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)
Copy link
Contributor

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()

Copy link
Contributor

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)

Copy link
Contributor

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.

@@ -0,0 +1,23 @@

Copy link
Contributor

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 .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants