-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from jadmsaadaot/SUBMIT-TASK#74
Display documents in sub package table and download on click
- Loading branch information
Showing
24 changed files
with
381 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
submit-api/migrations/versions/d8ac6fff4ec6_add_version_column_to_submissions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" Add version column to submissions | ||
Revision ID: d8ac6fff4ec6 | ||
Revises: 3eb2f30b742e | ||
Create Date: 2024-09-24 10:17:56.906370 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'd8ac6fff4ec6' | ||
down_revision = '3eb2f30b742e' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('submissions', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('version', sa.Integer(), nullable=False, server_default='1')) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('submissions', schema=None) as batch_op: | ||
batch_op.drop_column('version') | ||
|
||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Item schema class. | ||
Manages the item schema | ||
""" | ||
|
||
from marshmallow import EXCLUDE, Schema, fields | ||
|
||
|
||
class AccountUserSchema(Schema): | ||
"""item schema.""" | ||
|
||
class Meta: # pylint: disable=too-few-public-methods | ||
"""Exclude unknown fields in the deserialized output.""" | ||
|
||
unknown = EXCLUDE | ||
|
||
id = fields.Int(data_key="id") | ||
account_id = fields.Int(data_key="account_id") | ||
first_name = fields.Str(data_key="first_name") | ||
last_name = fields.Str(data_key="last_name") | ||
full_name = fields.Str(data_key="full_name") | ||
position = fields.Str(data_key="position") | ||
work_email_address = fields.Str(data_key="work_email_address") | ||
work_contact_number = fields.Str(data_key="work_contact_number") | ||
auth_guid = fields.Str(data_key="auth_guid") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Helper for token decoding.""" | ||
from flask import g | ||
|
||
from submit_api.utils.user_context import UserContext, user_context | ||
|
||
|
||
class TokenInfo: | ||
"""Token info.""" | ||
|
||
@staticmethod | ||
@user_context | ||
def get_id(**kwargs): | ||
"""Get the user identifier.""" | ||
try: | ||
user_from_context: UserContext = kwargs['user_context'] | ||
return user_from_context.sub | ||
except AttributeError: | ||
return None | ||
|
||
@staticmethod | ||
def get_user_data(): | ||
"""Get the user data.""" | ||
token_info = g.jwt_oidc_token_info | ||
user_data = { | ||
'external_id': token_info.get('sub', None), | ||
'first_name': token_info.get('given_name', None), | ||
'last_name': token_info.get('family_name', None), | ||
'email_address': token_info.get('email', None), | ||
'username': token_info.get('preferred_username', None), | ||
'identity_provider': token_info.get('identity_provider', ''), | ||
} | ||
return user_data |
Oops, something went wrong.