added people to file in the ORM

This commit is contained in:
2021-01-22 21:15:23 +11:00
parent c976858c27
commit 2dc0e921ef

View File

@@ -21,6 +21,7 @@ import time
################################################################################ ################################################################################
from settings import Settings from settings import Settings
from job import Job, Joblog, NewJob from job import Job, Joblog, NewJob
from person import Person
################################################################################ ################################################################################
# Class describing File in the database, and via sqlalchemy, connected to the DB as well # Class describing File in the database, and via sqlalchemy, connected to the DB as well
@@ -61,6 +62,7 @@ class File(db.Model):
size_mb = db.Column(db.Integer, unique=False, nullable=False) size_mb = db.Column(db.Integer, unique=False, nullable=False)
hash = db.Column(db.Integer, unique=True, nullable=True) hash = db.Column(db.Integer, unique=True, nullable=True)
thumbnail = db.Column(db.String, unique=False, nullable=True) thumbnail = db.Column(db.String, unique=False, nullable=True)
people = db.relationship("Person", secondary="file_person_link" )
def __repr__(self): def __repr__(self):
return "<eid: {}, size_mb={}, hash={}>".format(self.eid, self.size_mb, self.hash ) return "<eid: {}, size_mb={}, hash={}>".format(self.eid, self.size_mb, self.hash )