-
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
Refactor user actions to link to filing and submission #563
base: main
Are you sure you want to change the base?
Refactor user actions to link to filing and submission #563
Conversation
@computed_field | ||
@property | ||
def signatures(self) -> List[UserActionDTO]: | ||
return [action for action in self.user_actions if action.action_type == UserActionType.SIGN] |
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.
We want to make sure to maintain ordering so that the list is time ordered descending.
SIGN = "SIGN" | ||
CREATE = "CREATE" | ||
class UserActionType(StrEnum): | ||
SUBMIT = ("SUBMIT",) |
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.
What's the purpose of using tuples here instead of straight strings? Seems unnecessary (nor do I see this as being a preferred approach)
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 was a formatting mistake. I had added commas (bad habits, whoops), and black automatically added the parentheses. Unfortunately I missed that when committing, but I'll fix it.
I changed it to StrEnum though, as I believe that is now the recommended approach as to my understanding the handling of (str, Enum) was changed in a minor Python version, and this allows me to use it in an f-string and have it replaced with the string value.
…escending by timestamp. closes cfpb#554
Refactor user actions to link to filing and submission directly.
Remove direct links from FilingDAO and SubmissionDAO. Update DTOs to make existing links to user_action entities be derived. Update API accordingly.
closes #551
Need to do some more testing before calling this good (especially with migrating some of the data, as I didn't have any existing data points for signing for example). I also had a couple TODOs/questions to deal with.
The biggest questions I had were in the sign_filing method. I left the separate commit to create a sign action so that the DB timestamp could be used.