создал новые таблицы
This commit is contained in:
parent
0a4f3920a9
commit
bd265c17fe
@ -19,3 +19,5 @@ class Course(Base):
|
|||||||
|
|
||||||
students = relationship('CourseStudent', back_populates='course')
|
students = relationship('CourseStudent', back_populates='course')
|
||||||
notifications = relationship('Notification', back_populates='course')
|
notifications = relationship('Notification', back_populates='course')
|
||||||
|
|
||||||
|
lessons = relationship('Lesson', back_populates='course')
|
||||||
|
|||||||
17
API/app/infrastructure/database/models/lectures.py
Normal file
17
API/app/infrastructure/database/models/lectures.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class Lectures(Base):
|
||||||
|
__tablename__ = 'lectures'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
text = Column(String, nullable=False)
|
||||||
|
image = Column(String)
|
||||||
|
number = Column(Integer, nullable=False)
|
||||||
|
|
||||||
|
step_id = Column(Integer, ForeignKey('steps.id'), nullable=False)
|
||||||
|
|
||||||
|
step = relationship('Step', back_populates='lectures')
|
||||||
18
API/app/infrastructure/database/models/lessons.py
Normal file
18
API/app/infrastructure/database/models/lessons.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey, VARCHAR
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class Lesson(Base):
|
||||||
|
__tablename__ = 'lessons'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
title = Column(VARCHAR(200), nullable=False)
|
||||||
|
description = Column(String, nullable=False)
|
||||||
|
|
||||||
|
course_id = Column(Integer, ForeignKey('courses.id'), nullable=False)
|
||||||
|
|
||||||
|
course = relationship('Course', back_populates='lessons')
|
||||||
|
|
||||||
|
steps = relationship('Step', back_populates='lesson')
|
||||||
19
API/app/infrastructure/database/models/step_tasks.py
Normal file
19
API/app/infrastructure/database/models/step_tasks.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class StepTask(Base):
|
||||||
|
__tablename__ = 'step_tasks'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
text = Column(String, nullable=False)
|
||||||
|
|
||||||
|
step_id = Column(Integer, ForeignKey('steps.id'), nullable=False)
|
||||||
|
type_id = Column(Integer, ForeignKey('task_types.id'), nullable=False)
|
||||||
|
|
||||||
|
step = relationship('Step', back_populates='tasks')
|
||||||
|
type = relationship('TaskType', back_populates='tasks')
|
||||||
|
|
||||||
|
files = relationship('TaskFile', back_populates='task')
|
||||||
14
API/app/infrastructure/database/models/step_types.py
Normal file
14
API/app/infrastructure/database/models/step_types.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from sqlalchemy import Column, Integer, String, VARCHAR
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class StepType(Base):
|
||||||
|
__tablename__ = 'step_types'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
title = Column(VARCHAR(200), nullable=False)
|
||||||
|
description = Column(String, nullable=False)
|
||||||
|
|
||||||
|
steps = relationship('Step', back_populates='type')
|
||||||
20
API/app/infrastructure/database/models/steps.py
Normal file
20
API/app/infrastructure/database/models/steps.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
from sqlalchemy import Column, Integer, ForeignKey, VARCHAR
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class Step(Base):
|
||||||
|
__tablename__ = 'steps'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
title = Column(VARCHAR(200))
|
||||||
|
|
||||||
|
lesson_id = Column(Integer, ForeignKey('lessons.id'), nullable=False)
|
||||||
|
type_id = Column(Integer, ForeignKey('step_types.id'), nullable=False)
|
||||||
|
|
||||||
|
lesson = relationship('Lesson', back_populates='steps')
|
||||||
|
type = relationship('StepType', back_populates='steps')
|
||||||
|
|
||||||
|
lectures = relationship('Lectures', back_populates='step')
|
||||||
|
tasks = relationship('StepTask', back_populates='step')
|
||||||
16
API/app/infrastructure/database/models/task_files.py
Normal file
16
API/app/infrastructure/database/models/task_files.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class TaskFile(Base):
|
||||||
|
__tablename__ = 'task_files'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
file_path = Column(String, nullable=False)
|
||||||
|
file_title = Column(String, nullable=False)
|
||||||
|
|
||||||
|
task_id = Column(Integer, ForeignKey('step_tasks.id'), nullable=False)
|
||||||
|
|
||||||
|
task = relationship('StepTask', back_populates='files')
|
||||||
14
API/app/infrastructure/database/models/task_types.py
Normal file
14
API/app/infrastructure/database/models/task_types.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from sqlalchemy import Column, Integer, String, VARCHAR
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.infrastructure.database.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class TaskType(Base):
|
||||||
|
__tablename__ = 'task_types'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
title = Column(VARCHAR(200), nullable=False)
|
||||||
|
description = Column(String, nullable=False)
|
||||||
|
|
||||||
|
tasks = relationship('StepTask', back_populates='type')
|
||||||
Loading…
x
Reference in New Issue
Block a user