permission_model#140
Conversation
… a polymorphic One-to-Many relationship to the Permission table.
| ) | ||
| start_date: Mapped[Date] = mapped_column(Date, nullable=True) | ||
| end_date: Mapped[Date] = mapped_column(Date, nullable=True) | ||
| notes: Mapped[str] = mapped_column(Text, nullable=True) |
There was a problem hiding this comment.
Would this relate back to the polymorphic notes table? rather than have a notes field
There was a problem hiding this comment.
I like the idea of a polymorphic notes table, but thought it might be easier to implement single note fields in individual tables to start. Later we could go back and implement the polymorphic notes table, but I'm open to discussion. If we have the time I think it could be worth implementing now. We could still retain NMAquifer notes in nma_notes fields where appropriate.
| _thing_target: Mapped["Thing"] = relationship( | ||
| "Thing", | ||
| primaryjoin=and_( | ||
| foreign(permissible_id) == Thing.thing_id, permissible_type == "Thing" | ||
| ), | ||
| viewonly=True, | ||
| ) | ||
| _location_target: Mapped["Location"] = relationship( | ||
| "Location", | ||
| primaryjoin=and_( | ||
| foreign(permissible_id) == Location.location_id, | ||
| permissible_type == "Location", | ||
| ), | ||
| viewonly=True, | ||
| ) |
There was a problem hiding this comment.
For this to work do the thing and location tables need to inherit from the permission mixin?
There was a problem hiding this comment.
Wait! That's been noted in your notes. Should it be present in this PR? Or wait to implement that so that it can be implemented elsewhere, too, like services and tests?
There was a problem hiding this comment.
Right. The idea with this PR is to just create the table. Then a separate PR for Thing and Location updates, where they would inherit these new tables. It seemed simpler to break down the PRs into their individual component tasks and focus on one thing at a time. Personal opinion of course, open to discussion re: best practices for PRs.
Codecov Report❌ Patch coverage is
|
…since time is not important to capture here.
Why
This PR addresses the following problem / context:
How
Implementation summary - the following was changed / added / removed:
Permission table.
Notes
Any special considerations, workarounds, or follow-up work to note?