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

533 filing status prototype #540

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

guffee23
Copy link
Contributor

@guffee23 guffee23 commented Jan 2, 2025

Closes #533

Copy link

github-actions bot commented Jan 2, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/sbl_filing_api
  config.py
  src/sbl_filing_api/entities/models
  dao.py
  dto.py
  model_enums.py
  src/sbl_filing_api/entities/repos
  submission_repo.py
  src/sbl_filing_api/routers
  filing.py
  src/sbl_filing_api/services/validators
  filing_validators.py
Project Total  

This report was generated by python-coverage-comment-action

@@ -139,6 +139,7 @@ async def sign_filing(request: Request, lei: str, period_code: str):
sig_timestamp = int(sig.timestamp.timestamp())
filing.confirmation_id = lei + "-" + period_code + "-" + str(latest_sub.counter) + "-" + str(sig_timestamp)
filing.signatures.append(sig)
filing.state = FilingState.CLOSED
Copy link
Contributor

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 ?

Copy link
Contributor Author

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?

Copy link
Contributor

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?

That's what I am thinking, yeah.

Copy link
Contributor Author

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.

)
@requires("authenticated")
async def reopen_filing(request: Request, lei: str, period_code: str):
await repo.add_user_action(
Copy link
Contributor

Choose a reason for hiding this comment

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

The user action needs to be added to the Filing object as a relationship (like signature, submitter is added to the Submission, etc). Otherwise there's not relationship to tell who reopened a filing. You just have a user action created in the table but nothing that it refers back to.

@lchen-2101
Copy link
Collaborator

Not entirely related to this PR, but I'm wondering if we should look into a different approach to user actions than what we are currently doing. At the moment it seems that a new relational mapping table is added everytime a new type is introduced. What I thought of is user actions table being basically a changelog; it would only be related to the filing, so the filing would have a list of actions showing how it got to the state it is in at this moment.

Copy link
Contributor

@jcadam14 jcadam14 left a comment

Choose a reason for hiding this comment

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

I think this looks good now. Just need to demo it for the frontend and discuss. But code looks good so once we get buy in we can merge.

I think we'll want a helm values update for this to set the sign and submit validators to NOT have valid_filing_open just yet, so that when/if this is deployed we don't keep people from resigning in beta.

@guffee23
Copy link
Contributor Author

@lchen-2101 Maybe not an endpoint per se, but have something that returns all user actions for a given filing?

@jcadam14
Copy link
Contributor

jcadam14 commented Jan 13, 2025

Not entirely related to this PR, but I'm wondering if we should look into a different approach to user actions than what we are currently doing. At the moment it seems that a new relational mapping table is added everytime a new type is introduced. What I thought of is user actions table being basically a changelog; it would only be related to the filing, so the filing would have a list of actions showing how it got to the state it is in at this moment.

Depends on the type really. Since a filing can be opened/reopened multiple times we have to keep a list of reopeners so we have to have that mapping table. If it was just a single maintained action it's a straight relationship. Unfortunately since user actions don't have any indicator of the filing or submission they're associated with, the mapping table is needed. Now we could add some indicator to the user action and make it easier to determine what filing or submission an action was associated with.

@lchen-2101
Copy link
Collaborator

@lchen-2101 Maybe not an endpoint per se, but have something that returns all user actions for a given filing?

Further discussion needed on my proposal, shouldn't hold up what you are currently doing; but it would be a list of actions on the filing object.

@lchen-2101
Copy link
Collaborator

Not entirely related to this PR, but I'm wondering if we should look into a different approach to user actions than what we are currently doing. At the moment it seems that a new relational mapping table is added everytime a new type is introduced. What I thought of is user actions table being basically a changelog; it would only be related to the filing, so the filing would have a list of actions showing how it got to the state it is in at this moment.

Depends on the type really. Since a filing can be opened/reopened multiple times we have to keep a list of reopeners so we have to have that mapping table. If it was just a single maintained action it's a straight relationship. Unfortunately since user actions don't have any indicator of the filing of submission they're associated with, the mapping table is needed. Now we could add some indicator to the user action and make it easier to determine what filing or submission an action was associated with.

Yeap, what I was thinking is the actions table would have a fk pointing to the filing id; and a nullable index pointing to the submission id; since those are the only 2 objects actionable by a user.

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.

Prototype new Filing status
3 participants