2024-10-05 22:02:08 +04:00
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
|
|
|
db = SQLAlchemy()
|
|
|
|
|
|
|
|
class Faculty(db.Model):
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
university_id = db.Column(db.Integer, nullable=False)
|
|
|
|
|
|
|
|
def to_dict(self):
|
|
|
|
return {
|
|
|
|
"id": self.id,
|
|
|
|
"name": self.name,
|
|
|
|
"university_id": self.university_id
|
2024-10-05 23:40:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
class FacultyUniversity(db.Model):
|
|
|
|
faculty_id = db.Column(db.Integer, db.ForeignKey('faculty.id'), primary_key=True)
|
|
|
|
university_id = db.Column(db.Integer, db.ForeignKey('university.id'), primary_key=True)
|