Add HarvestUser.person association

importer does not set this; you must do so manually
This commit is contained in:
Lance Edgar 2022-01-30 17:40:19 -06:00
parent 3883a8551f
commit ec78f8c9c4
6 changed files with 210 additions and 8 deletions

View file

@ -39,6 +39,7 @@ class HarvestUser(model.Base):
"""
__tablename__ = 'harvest_user'
__table_args__ = (
sa.ForeignKeyConstraint(['person_uuid'], ['person.uuid'], name='harvest_user_fk_person'),
sa.UniqueConstraint('id', name='harvest_user_uq_id'),
)
__versioned__ = {}
@ -90,6 +91,19 @@ class HarvestUser(model.Base):
updated_at = sa.Column(sa.DateTime(), nullable=True)
person_uuid = sa.Column(sa.String(length=32), nullable=True)
person = orm.relationship(
model.Person,
doc="""
Reference to the person associated with this Harvest user.
""",
backref=orm.backref(
'harvest_users',
doc="""
List of all Harvest user accounts for the person.
""")
)
def __str__(self):
return normalize_full_name(self.first_name, self.last_name)