From 595f2761edd3bee06dc7aca8672403cbabafac01 Mon Sep 17 00:00:00 2001 From: Kushal Dotel Date: Sat, 11 Jan 2025 18:24:04 +0545 Subject: [PATCH] update field position --- backend/blueprints/profile/__init__.py | 30 +++++++++++++------------- backend/db/model.py | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/backend/blueprints/profile/__init__.py b/backend/blueprints/profile/__init__.py index 642e917..03b503e 100644 --- a/backend/blueprints/profile/__init__.py +++ b/backend/blueprints/profile/__init__.py @@ -150,20 +150,20 @@ def login(): except Exception as e: db.session.rollback() return jsonify({"error": "Login failed, please try again later."}), 500 - + #Implement laters -@profile.route('/update', methhods=['UPDATE', 'DELETE']) -def update(): - if request.method == 'DELETE': - pass - if request.method == 'UPDATE': - pass - -@profile.route('/me') -def my_profile(): - pass - -@profile.route('/info/') -def profile_info(user_uuid): - return user_uuid +# @profile.route('/update', methhods=['UPDATE', 'DELETE']) +# def update(): +# if request.method == 'DELETE': +# pass +# if request.method == 'UPDATE': +# pass + +# @profile.route('/me') +# def my_profile(): +# pass + +# @profile.route('/info/') +# def profile_info(user_uuid): +# return user_uuid diff --git a/backend/db/model.py b/backend/db/model.py index be44ffe..40edac3 100644 --- a/backend/db/model.py +++ b/backend/db/model.py @@ -70,14 +70,14 @@ class Course(db.Model): enrollments: Mapped[List["Enrollment"]] = relationship(back_populates="course", cascade="all, delete-orphan") quizzes: Mapped[List['Quiz']] = relationship(back_populates="course", cascade="all, delete-orphan") chats: Mapped[List["Chat"]] = relationship(back_populates="course", cascade="all, delete-orphan") + authorID: Mapped[uuid.UUID] = mapped_column(ForeignKey("user.id")) + author: Mapped["User"] = relationship(back_populates="publications") description: Mapped[str] = mapped_column(String(1024), nullable=False, default='') isActive: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True) publishedStatus: Mapped[int] = mapped_column(SmallInteger, nullable=False, default=PublishedStatus.DRAFT) creationDate: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now()) coverImage: Mapped[str] = mapped_column(String(256), nullable=False, default=DEFAULT_COURSE_COVER) serverFilename: Mapped[str] = mapped_column(String(256), nullable=False, default='') - authorID: Mapped[uuid.UUID] = mapped_column(ForeignKey("user.id")) - author: Mapped["User"] = relationship(back_populates="publications") class Enrollment(db.Model):