Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Temmmmmo committed Nov 10, 2024
1 parent 1c7c378 commit 7bc64ca
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
24 changes: 24 additions & 0 deletions migrations/versions/7388a2c219d2_add_user_id_to_lecturer_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""add-user-id-to-lecturer-user
Revision ID: 7388a2c219d2
Revises: fee34ac4fcab
Create Date: 2024-11-10 04:07:42.997861
"""

import sqlalchemy as sa
from alembic import op


revision = '7388a2c219d2'
down_revision = 'fee34ac4fcab'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('lecturer_user_comment', sa.Column('user_id', sa.Integer(), nullable=False))


def downgrade():
op.drop_column('lecturer_user_comment', 'user_id')
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"""

from alembic import op
import sqlalchemy as sa
from alembic import op


revision = 'fee34ac4fcab'
Expand Down
1 change: 1 addition & 0 deletions rating_api/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Comment(BaseDbModel):

class LecturerUserComment(BaseDbModel):
id: Mapped[int] = mapped_column(Integer, primary_key=True)
user_id: Mapped[int] = mapped_column(Integer, nullable=False)
lecturer_id: Mapped[int] = mapped_column(Integer, ForeignKey("lecturer.id"))
create_ts: Mapped[datetime.datetime] = mapped_column(DateTime, default=datetime.datetime.utcnow, nullable=False)
update_ts: Mapped[datetime.datetime] = mapped_column(DateTime, default=datetime.datetime.utcnow, nullable=False)
1 change: 1 addition & 0 deletions rating_api/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CommentGet(Base):
lecturer_id: int



class CommentPost(Base):
subject: str
text: str
Expand Down

0 comments on commit 7bc64ca

Please sign in to comment.