Files
team-tryouts/app/models/objective_comment.py
T
cedrick2711 f468217745
CI - Security, Lint & Tests / validate (push) Failing after 1m13s
progression 50% pour evolution des joueurs
2026-09-05 11:30:13 -04:00

36 lines
1.3 KiB
Python

"""Coach comments on a specific objective."""
from app.extensions import db
from app.time_utils import utc_now_naive
class ObjectiveComment(db.Model):
"""A coach's comment on a player-evolution objective.
This is a separate table from PersonalNote — no existing schema
is altered. The objective-form page also *reads* PersonalNote and
TeamNote for context, but never writes to those tables.
"""
__tablename__ = 'objective_comments'
id = db.Column(db.Integer, primary_key=True)
objective_id = db.Column(
db.Integer,
db.ForeignKey('objectives.id'),
nullable=False,
)
coach_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
content = db.Column(db.Text, nullable=False)
created_at = db.Column(db.DateTime, default=utc_now_naive)
updated_at = db.Column(db.DateTime, default=utc_now_naive, onupdate=utc_now_naive)
# -----------------------------------------------------------------------
# Relationships
# -----------------------------------------------------------------------
objective = db.relationship(
'Objective',
backref=db.backref('comments', lazy='dynamic', order_by='ObjectiveComment.created_at'),
)
coach = db.relationship('User', foreign_keys=[coach_id])