feat: add code-based meetings router with participant/attend support
- New dedicated meetings.py router with full CRUD (list/get/create/update/delete)
- All endpoints accept meeting_code or numeric id
- MeetingParticipant model for tracking meeting attendance
- POST /meetings/{id}/attend adds current user to participant list
- Serialization includes participants list, project_code, milestone_code
- Creator auto-added as participant on meeting creation
- Registered in main.py alongside existing routers
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, Enum
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, Enum, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.config import Base
|
||||
@@ -35,3 +35,19 @@ class Meeting(Base):
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
participants = relationship("MeetingParticipant", back_populates="meeting", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class MeetingParticipant(Base):
|
||||
__tablename__ = "meeting_participants"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("meeting_id", "user_id", name="uq_meeting_participant"),
|
||||
)
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
meeting_id = Column(Integer, ForeignKey("meetings.id", ondelete="CASCADE"), nullable=False)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
joined_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
meeting = relationship("Meeting", back_populates="participants")
|
||||
|
||||
Reference in New Issue
Block a user