generated from cfpb/open-source-project-template
-
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
533 filing status prototype #540
Open
guffee23
wants to merge
9
commits into
main
Choose a base branch
from
533_filing_status_prototype
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bba5e5e
Added reopen endpoint with validation and table update
guffee23 77a6362
Set filing state when creating and signing filing
guffee23 b192c02
Added unit tests and some config changes
guffee23 4684694
Added filing reopen table and added open filing validation to sign en…
guffee23 09d35db
Added tests. Separated table migrations into different files. Linting
guffee23 7588b68
Appended reopens to reopen table. Updated config files
guffee23 46fb9c7
Fixed test
guffee23 0988c40
Merge branch 'main' into 533_filing_status_prototype
guffee23 fe8666c
Merge branch 'main' into 533_filing_status_prototype
guffee23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
db_revisions/versions/7fe49d38726b_add_filing_state_and_create_filing_reopen.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,51 @@ | ||
"""Add filing state | ||
|
||
Revision ID: 7fe49d38726b | ||
Revises: 6ec12afa5b37 | ||
Create Date: 2024-12-30 13:05:01.303998 | ||
|
||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
from alembic import op, context | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "7fe49d38726b" | ||
down_revision: Union[str, None] = "6ec12afa5b37" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
filing_state_enum = postgresql.ENUM( | ||
"OPEN", | ||
"CLOSED", | ||
name="filingstate", | ||
create_type=False, | ||
) | ||
|
||
|
||
def upgrade() -> None: | ||
filing_state_enum.create(op.get_bind(), checkfirst=True) | ||
op.add_column( | ||
"filing", | ||
sa.Column("state", filing_state_enum), | ||
) | ||
|
||
op.create_table( | ||
"filing_reopen", | ||
sa.Column("user_action", sa.INTEGER, primary_key=True, unique=True, nullable=False), | ||
sa.Column("filing", sa.Integer, nullable=False), | ||
sa.PrimaryKeyConstraint("user_action", name="filing_reopen_pkey"), | ||
sa.ForeignKeyConstraint(["user_action"], ["user_action.id"], name="filing_reopen_user_action_fkey"), | ||
sa.ForeignKeyConstraint(["filing"], ["filing.id"], name="filing_reopen_filing_fkey"), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("filing", "state") | ||
op.drop_table("filing_reopen") | ||
|
||
if "sqlite" not in context.get_context().dialect.name: | ||
op.execute(sa.DDL("DROP TYPE filingstate")) |
58 changes: 58 additions & 0 deletions
58
db_revisions/versions/a655265a6c59_add_reopen_to_user_action.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,58 @@ | ||
"""Add REOPEN to user action | ||
|
||
Revision ID: a655265a6c59 | ||
Revises: 7fe49d38726b | ||
Create Date: 2025-01-08 13:59:33.098890 | ||
|
||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
from alembic import op, context | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "a655265a6c59" | ||
down_revision: Union[str, None] = "7fe49d38726b" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
old_user_action = postgresql.ENUM( | ||
"SUBMIT", | ||
"ACCEPT", | ||
"SIGN", | ||
"CREATE", | ||
name="useractiontype", | ||
create_type=False, | ||
) | ||
|
||
new_user_action = postgresql.ENUM( | ||
"SUBMIT", | ||
"ACCEPT", | ||
"SIGN", | ||
"CREATE", | ||
"REOPEN", | ||
name="useractiontype", | ||
create_type=False, | ||
) | ||
|
||
|
||
def upgrade() -> None: | ||
if "sqlite" not in context.get_context().dialect.name: | ||
op.execute("ALTER TYPE useractiontype RENAME TO useractiontype_old") | ||
new_user_action.create(op.get_bind(), checkfirst=True) | ||
op.execute( | ||
"ALTER TABLE user_action ALTER COLUMN action_type TYPE useractiontype USING user_action::text::useractiontype" | ||
) | ||
op.execute("DROP TYPE useractiontype_old") | ||
|
||
|
||
def downgrade() -> None: | ||
if "sqlite" not in context.get_context().dialect.name: | ||
op.execute("ALTER TYPE useractiontype RENAME TO useractiontype_old") | ||
old_user_action.create(op.get_bind(), checkfirst=True) | ||
op.execute( | ||
"ALTER TABLE user_action ALTER COLUMN action_type TYPE useractiontype USING user_action::text::useractiontype" | ||
) | ||
op.execute("DROP TYPE useractiontype_old") |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wondering if we should add a check to ensure the Filing is in an OPEN state on signing. @lchen-2101 ?
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.
Should we prevent signing altogether if the state is not set to open?
And add a validator check to look at the state before proceeding?
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.
That's what I am thinking, yeah.
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 validation has been added.