Skip to content

Commit

Permalink
autopep8
Browse files Browse the repository at this point in the history
  • Loading branch information
DRIESASTER authored and xerbalind committed Mar 11, 2024
1 parent 6cee923 commit 7a37a92
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 58 deletions.
59 changes: 31 additions & 28 deletions backend/alembic/versions/eb472f05f70e_recreate_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,42 @@
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('subject',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('website_user',
sa.Column('uid', sa.String(), nullable=False),
sa.Column('given_name', sa.String(), nullable=False),
sa.Column('mail', sa.String(), nullable=False),
sa.Column('is_admin', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('uid')
)
sa.Column('uid', sa.String(), nullable=False),
sa.Column('given_name', sa.String(), nullable=False),
sa.Column('mail', sa.String(), nullable=False),
sa.Column('is_admin', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('uid')
)
op.create_table('project',
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
sa.Column('deadline', sa.Date(), nullable=False, check_constraint='deadline >= CURRENT_DATE'),
sa.Column('name', sa.String(), nullable=False),
sa.Column('subjectId', sa.String(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['subjectId'], ['subject.id'], ondelete='SET NULL'),
sa.PrimaryKeyConstraint('id')
)
sa.Column('id', sa.BigInteger(),
autoincrement=True, nullable=False),
sa.Column('deadline', sa.Date(), nullable=False,
check_constraint='deadline >= CURRENT_DATE'),
sa.Column('name', sa.String(), nullable=False),
sa.Column('subjectId', sa.String(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.ForeignKeyConstraint(
['subjectId'], ['subject.id'], ondelete='SET NULL'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_project_id'), 'project', ['id'], unique=False)
op.create_table('student_subject',
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
op.create_table('teacher_subject',
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
# ### end Alembic commands ###


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,42 @@
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('subject',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('website_user',
sa.Column('uid', sa.String(), nullable=False),
sa.Column('given_name', sa.String(), nullable=False),
sa.Column('mail', sa.String(), nullable=False),
sa.Column('is_admin', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('uid')
)
sa.Column('uid', sa.String(), nullable=False),
sa.Column('given_name', sa.String(), nullable=False),
sa.Column('mail', sa.String(), nullable=False),
sa.Column('is_admin', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('uid')
)
op.create_table('project',
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
sa.Column('deadline', sa.Date(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('subject_id', sa.BigInteger(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.CheckConstraint('deadline >= CURRENT_DATE', name='deadline_check'),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ondelete='SET NULL'),
sa.PrimaryKeyConstraint('id')
)
sa.Column('id', sa.BigInteger(),
autoincrement=True, nullable=False),
sa.Column('deadline', sa.Date(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('subject_id', sa.BigInteger(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.CheckConstraint('deadline >= CURRENT_DATE',
name='deadline_check'),
sa.ForeignKeyConstraint(
['subject_id'], ['subject.id'], ondelete='SET NULL'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('student_subject',
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
op.create_table('teacher_subject',
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
sa.Column('uid', sa.String(), nullable=True),
sa.Column('subject_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
sa.ForeignKeyConstraint(['uid'], ['website_user.uid'], )
)
# ### end Alembic commands ###


Expand Down
1 change: 1 addition & 0 deletions backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
app.include_router(project_router)



@app.get("/api")
async def root():
return {"message": "Hello World"}
3 changes: 2 additions & 1 deletion backend/src/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class Project(Base):
id = Column(BigInteger, primary_key=True, autoincrement=True)
deadline = Column(Date, nullable=False)
name = Column(String, nullable=False)
subject_id = Column(BigInteger, ForeignKey('subject.id', ondelete="SET NULL"), nullable=True) # Adjusted to BigInteger
subject_id = Column(BigInteger, ForeignKey(
'subject.id', ondelete="SET NULL"), nullable=True) # Adjusted to BigInteger
description = Column(String, nullable=True)
enroll_deadline = Column(Date, nullable=True)

Expand Down

0 comments on commit 7a37a92

Please sign in to comment.