fix layout

This commit is contained in:
Alejandro Vazquez
2026-04-17 18:14:59 -03:00
parent ffb383554a
commit ec977bf90b
7 changed files with 45 additions and 29 deletions
+14 -5
View File
@@ -5,18 +5,27 @@ class Classroom(db.Model):
__tablename__ = 'classrooms'
id = db.Column(db.Integer, primary_key=True)
# campus_id = db.Column(db.Integer, db.ForeignKey('campuses.id'), nullable=False)
campus_id = db.Column(db.Integer, nullable=True) # Maps to campus_id in DB
building = db.Column(db.String(100), nullable=False)
code = db.Column(db.String(50), nullable=False) # Changed from room_number
name = db.Column(db.String(100), nullable=False)
code = db.Column('room_number', db.String(50), nullable=False) # Maps to room_number column in DB
floor = db.Column(db.Integer, nullable=False)
capacity = db.Column(db.Integer, nullable=False)
description = db.Column(db.Text)
campus_location = db.Column(db.String(100))
is_active = db.Column(db.Boolean, default=True, nullable=False)
is_active = db.Column('active', db.Boolean, default=True, nullable=False) # Maps to active column in DB
created_at = db.Column(db.DateTime, default=datetime.utcnow)
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
# Virtual properties for compatibility
@property
def name(self):
"""Generate name from building and code"""
return f"{self.building}-{self.code}"
@property
def campus_location(self):
"""Placeholder for campus location - can be expanded when campus model is implemented"""
return None
# Virtual field for compatibility - combines building and code
@property
def room_number(self):