-
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.
Feature/443 user audit fields (#603)
* Add user audit fields. * fix broken test. * display N/a when modify values are null or empty.
- Loading branch information
1 parent
63b9f3b
commit c86b281
Showing
12 changed files
with
185 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""user-audit-fields | ||
Revision ID: 291331bea272 | ||
Revises: a5fbdcd0e719 | ||
Create Date: 2024-07-19 09:06:27.754024 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '291331bea272' | ||
down_revision = 'a5fbdcd0e719' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column('users', sa.Column('created_on', sa.DateTime, nullable=False, server_default=sa.func.current_timestamp())) | ||
op.add_column('users', sa.Column('created_by', sa.String(), nullable=False, server_default='Migrated')) | ||
op.alter_column('users', 'created_by', server_default=None) | ||
op.add_column('users', sa.Column('modified_on', sa.DateTime, nullable=True)) | ||
op.add_column('users', sa.Column('modified_by', sa.String(), nullable=True)) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column('users', 'created_on') | ||
op.drop_column('users', 'created_by') | ||
op.drop_column('users', 'modified_on') | ||
op.drop_column('users', 'modified_by') |
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 |
---|---|---|
|
@@ -966,7 +966,6 @@ AOPSs: | |
email: [email protected] | ||
agency: Native American Tribal Governments | ||
bureau: Sierra Tribal Consortium, INC. | ||
bureau: null | ||
reporting_agencies: | ||
- report_agency: Native American Tribal Governments | ||
report_bureau: Sierra Tribal Consortium, INC. | ||
|
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 |
---|---|---|
|
@@ -48,7 +48,7 @@ def fake_user_repo(): | |
@pytest.fixture | ||
def user_complete(): | ||
return {"name": "Stephen Dedalus", "email": "[email protected]", "agency_id": 3, "agency": {"name": 'test name', "id": 3, "bureau": None}, "roles": [], | ||
"report_agencies": []} | ||
"report_agencies": [], "created_on": "2024-07-19T13:46:23.004418", "created_by": "Stephen Dedalus"} | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -61,7 +61,9 @@ def authorized_complete(): | |
agency_id=3, | ||
agency=Agency(id=3, name='test name', bureau="test"), | ||
roles=[Role(id=1, name='Wizard')], | ||
report_agencies=[] | ||
report_agencies=[], | ||
created_on="2024-07-19T13:46:23.004418", | ||
created_by="Stephen Dedalus" | ||
) | ||
|
||
|
||
|
Oops, something went wrong.