class Feedback(db.Model): __tablename__ = "T_EVALUATION_FEEDBACK" EvaluationID = db.Column(db.Integer, db.ForeignKey('T_EVALUATION.EvaluationID'), primary_key=True) UserID = db.Column(db.String, db.ForeignKey('T_USER.UserID'), nullable=False) Feedback = db.Column(db.Text, nullable=False) evaluation_r = db.relationship('Evaluation', backref=db.backref('eval_feedback', lazy=True)) user_r = db.relationship('User', backref=db.backref('user_feedback', lazy=True)) def __repr__(self): return '<Feedback %r>' % self.Feedback
class EvaluationEdit(db.Model): __tablename__ = "T_EVALUATION_EDIT" EvaluationEditID = db.Column(db.Integer, primary_key=True) EvaluationID = db.Column(db.Integer, db.ForeignKey('T_EVALUATION.EvaluationID'), nullable=False) UserID = db.Column(db.String, db.ForeignKey('T_USER.UserID'), nullable=False) Date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) evaluation_r = db.relationship('Evaluation', backref=db.backref('evaluation_edits', lazy=True)) user_r = db.relationship('User', backref=db.backref('user_evaluation_edit', lazy=True)) def __repr__(self): return '<EvaluationEdit %r>' % self.EvaluationEditID
class Location(db.Model): # Localisation __tablename__ = "T_LOCATION" LocationID = db.Column(db.Integer, primary_key=True) LocationName = db.Column(db.String, nullable=False) UnitID = db.Column(db.Integer, db.ForeignKey('T_UNIT.UnitID'), nullable=False) LocationTypeID = db.Column(db.Integer, db.ForeignKey('T_LOCATION_TYPE.LocationTypeID'), nullable=False) unit_r = db.relationship('Unit', backref=db.backref('unit_location', lazy=True)) location_type_r = db.relationship('LocationType', backref=db.backref('location_types', lazy=True)) def __repr__(self): return '<Location %r>' % self.LocationName
class Zone(db.Model): __tablename__ = "T_ZONE" ZoneID = db.Column(db.Integer, primary_key=True) UserID = db.Column(db.String, db.ForeignKey('T_USER.UserID'), nullable=False) SiteID = db.Column(db.Integer, db.ForeignKey('T_SITE.SiteID'), nullable=False) ZoneName = db.Column(db.String, nullable=False) user_r = db.relationship('User', backref=db.backref('user_zone', lazy=True)) site_r = db.relationship('Site', backref=db.backref('site_zone', lazy=True)) def __repr__(self): return '<Zone %r>' % self.ZoneName
class Attachment(db.Model): __tablename__ = "T_ATTACHMENT" AttachmentID = db.Column(db.Integer, primary_key=True) EvaluationID = db.Column(db.Integer, db.ForeignKey('T_EVALUATION.EvaluationID'), nullable=False) AttachmentTypeID = db.Column(db.Integer, db.ForeignKey('T_ATTACHMENT_TYPE.AttachmentTypeID'), nullable=False) Path = db.Column(db.String, unique=True, nullable=False) attachment_type_r = db.relationship('AttachmentType', backref=db.backref('attachment_types', lazy=True)) evaluation_r = db.relationship('Evaluation', backref=db.backref('eval_attachment', lazy=True)) def __repr__(self): return '<Attachment %r>' % self.AttachmentID
class Evaluation(db.Model): __tablename__ = "T_EVALUATION" EvaluationID = db.Column(db.Integer, primary_key=True) UserID = db.Column(db.String, db.ForeignKey('T_USER.UserID'), nullable=False) LocationID = db.Column(db.Integer, db.ForeignKey('T_LOCATION.LocationID'), nullable=False) CategoryID = db.Column(db.Integer, db.ForeignKey('T_CATEGORY.CategoryID'), nullable=False) Date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) Validation = db.Column(db.Integer, nullable=False) Comment = db.Column(db.Text, nullable=True) # Remarque user_r = db.relationship('User', backref=db.backref('user_eval', lazy=True)) location_r = db.relationship('Location', backref=db.backref('location_eval', lazy=True)) category_r = db.relationship('Category', backref=db.backref('category_eval', lazy=True)) def __repr__(self): return '<Evaluation %r>' % self.EvaluationID
class Category(db.Model): __tablename__ = "T_CATEGORY" CategoryID = db.Column(db.Integer, primary_key=True) CriteriaID = db.Column(db.String, db.ForeignKey('T_CRITERIA.CriteriaID'), nullable=False) Description = db.Column(db.Text, nullable=False) criteria_r = db.relationship('Criteria', backref=db.backref('criterias', lazy=True)) def __repr__(self): return '<Category %r>' % self.CategoryID
class Unit(db.Model): # Unité __tablename__ = "T_UNIT" UnitID = db.Column(db.Integer, primary_key=True) UnitName = db.Column(db.String, nullable=False) ZoneID = db.Column(db.Integer, db.ForeignKey('T_ZONE.ZoneID'), nullable=False) zone_r = db.relationship('Zone', backref=db.backref('zone_unit', lazy=True)) def __repr__(self): return '<Unit %r>' % self.UnitName