Ajout de fonctionnalités:
Ajout de notes personnels et de notes d'équipe avec historique. Ajout de prise de rendez-vous avec un coach selon ses disponibilités
This commit is contained in:
@@ -665,4 +665,128 @@ class Contract(db.Model):
|
||||
bool: True if user is the player associated with the contract.
|
||||
"""
|
||||
# Only the player can upload their signed contract
|
||||
return user.id == self.player_id
|
||||
return user.id == self.player_id
|
||||
|
||||
|
||||
class CoachAvailability(db.Model):
|
||||
"""Coach availability in 30-minute time blocks for One on One sessions.
|
||||
|
||||
Allows coaches to specify when they're available for individual coaching sessions.
|
||||
|
||||
Attributes:
|
||||
id: Unique identifier.
|
||||
coach_id: Foreign key to the coach.
|
||||
day_of_week: Day of week (0=Monday, 6=Sunday).
|
||||
start_time: Start time of availability block.
|
||||
end_time: End time of availability block (always 30 min after start).
|
||||
created_at: Timestamp of creation.
|
||||
updated_at: Timestamp of last update.
|
||||
"""
|
||||
__tablename__ = 'coach_availabilities'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
coach_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
|
||||
day_of_week = db.Column(db.Integer, nullable=False) # 0=Monday, 6=Sunday
|
||||
start_time = db.Column(db.Time, nullable=False)
|
||||
end_time = db.Column(db.Time, nullable=False) # Always 30 minutes after start_time
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
coach = db.relationship('User', backref='coach_availabilities')
|
||||
|
||||
|
||||
class TeamNote(db.Model):
|
||||
"""Team improvement notes from coach.
|
||||
|
||||
Contains coaching notes and suggestions for team improvement.
|
||||
|
||||
Attributes:
|
||||
id: Unique identifier.
|
||||
org_team_id: Foreign key to the organization team.
|
||||
coach_id: Foreign key to the coach who wrote the notes.
|
||||
content: The note content.
|
||||
created_at: Timestamp of creation.
|
||||
updated_at: Timestamp of last update.
|
||||
"""
|
||||
__tablename__ = 'team_notes'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
org_team_id = db.Column(db.Integer, db.ForeignKey('org_teams.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=datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
team = db.relationship('OrgTeam', backref='team_notes')
|
||||
coach = db.relationship('User', foreign_keys=[coach_id])
|
||||
|
||||
|
||||
class PersonalNote(db.Model):
|
||||
"""Personal notes from coach to individual player.
|
||||
|
||||
Contains individual feedback and coaching tips for players.
|
||||
Can be linked to specific contexts: match, team, or tryout.
|
||||
|
||||
Attributes:
|
||||
id: Unique identifier.
|
||||
player_id: Foreign key to the player.
|
||||
coach_id: Foreign key to the coach who wrote the notes.
|
||||
content: The note content.
|
||||
created_at: Timestamp of creation.
|
||||
updated_at: Timestamp of last update.
|
||||
match_id: Optional foreign key to the match context.
|
||||
team_id: Optional foreign key to the team context.
|
||||
tryout_id: Optional foreign key to the tryout context.
|
||||
"""
|
||||
__tablename__ = 'personal_notes'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
player_id = db.Column(db.Integer, db.ForeignKey('users.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=datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
# Optional context linking
|
||||
match_id = db.Column(db.Integer, db.ForeignKey('matches.id'), nullable=True)
|
||||
team_id = db.Column(db.Integer, db.ForeignKey('teams.id'), nullable=True)
|
||||
tryout_id = db.Column(db.Integer, db.ForeignKey('tryouts.id'), nullable=True)
|
||||
|
||||
player = db.relationship('User', foreign_keys=[player_id], backref='personal_notes')
|
||||
coach = db.relationship('User', foreign_keys=[coach_id])
|
||||
match = db.relationship('Match', foreign_keys=[match_id])
|
||||
team = db.relationship('Team', foreign_keys=[team_id])
|
||||
tryout = db.relationship('Tryout', foreign_keys=[tryout_id])
|
||||
|
||||
|
||||
class OneOnOneRequest(db.Model):
|
||||
"""Request from player to coach for a One on One session.
|
||||
|
||||
Tracks requests for individual coaching sessions with time slot selection.
|
||||
|
||||
Attributes:
|
||||
id: Unique identifier.
|
||||
player_id: Foreign key to the player requesting.
|
||||
coach_id: Foreign key to the coach.
|
||||
org_team_id: Foreign key to the player's team.
|
||||
date: Requested date for the session.
|
||||
start_time: Requested start time.
|
||||
end_time: Requested end time.
|
||||
points: What the player wants to discuss.
|
||||
status: Request status (pending, approved, rejected, scheduled).
|
||||
created_at: Timestamp of creation.
|
||||
responded_at: Timestamp when coach responded.
|
||||
"""
|
||||
__tablename__ = 'one_on_one_requests'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
player_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
|
||||
coach_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
|
||||
org_team_id = db.Column(db.Integer, db.ForeignKey('org_teams.id'), nullable=True)
|
||||
date = db.Column(db.Date, nullable=False)
|
||||
start_time = db.Column(db.Time, nullable=False)
|
||||
end_time = db.Column(db.Time, nullable=False)
|
||||
points = db.Column(db.Text, nullable=True)
|
||||
status = db.Column(db.String(20), default='pending') # pending, approved, rejected, scheduled
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
responded_at = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
player = db.relationship('User', foreign_keys=[player_id], backref='one_on_one_requests')
|
||||
coach = db.relationship('User', foreign_keys=[coach_id])
|
||||
team = db.relationship('OrgTeam', foreign_keys=[org_team_id])
|
||||
|
||||
Reference in New Issue
Block a user