Skip to content

Feature/apply schema #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/apply/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .academy import Academy, LearnerAcademy, Period
from .form import Application, FormRepository

__all__ = ["Academy", "Period", "LearnerAcademy", "FormRepository", "Application"]
36 changes: 36 additions & 0 deletions app/models/apply/academy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from sqlalchemy import Boolean, ForeignKey, Integer, String
from sqlalchemy.orm import mapped_column, relationship

from models.base import Base


class Period(Base):
__tablename__ = "period"

id = mapped_column(Integer, primary_key=True, comment="기수ID")
start = mapped_column(Integer, nullable=True, comment="기수 시작일")
end = mapped_column(Integer, nullable=True, comment="기수 종료일")
leaner_open = mapped_column(Integer, nullable=True, comment="러너모집 시작일")
leaner_close = mapped_column(Integer, nullable=True, comment="러너모집 종료일")


class Academy(Base):
__tablename__ = "academy"

id = mapped_column(Integer, primary_key=True, nullable=False, comment="아카데미ID")
user_id = mapped_column(Integer, ForeignKey("user.user_id"), nullable=False, comment="빌더유저ID")
period_id = mapped_column(Integer, ForeignKey("period.id"), nullable=False, comment="기수ID")
application_id = mapped_column(Integer, ForeignKey("application.id"), nullable=False, comment="신청서ID")
academy_name = mapped_column(String(100), nullable=False, comment="아카데미 이름")
description = mapped_column(String(255), nullable=True, comment="아카데미 설명")

# user = relationship("User", back_populates="academie")


class LearnerAcademy(Base):
__tablename__ = "learner_academy"

id = mapped_column(Integer, primary_key=True, nullable=False, comment="러너아카데미ID")
user_id = mapped_column(Integer, ForeignKey("user.user_id"), comment="러너유저ID")
academy_id = mapped_column(Integer, ForeignKey("academy.id"), nullable=False, comment="아카데미ID")
is_completed = mapped_column(Boolean, nullable=False, default=False, comment="수료여부")
25 changes: 25 additions & 0 deletions app/models/apply/form.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from core.db import AsyncSession
from sqlalchemy import JSON, Boolean, DateTime, ForeignKey, Integer, desc, func, select
from sqlalchemy.orm import mapped_column

from models.base import Base


class FormRepository(Base):
__tablename__ = "form_repository"

id = mapped_column(Integer, primary_key=True, comment="신청양식ID")
form_type = mapped_column(Integer, nullable=False, comment="신청양식 구분 (1: builder, 2: learner)")
form_content = mapped_column(JSON, nullable=False, comment="신청양식 내용")
created_at = mapped_column(Integer, nullable=False, comment="입력 날짜")
updated_at = mapped_column(Integer, comment="수정 날짜")


class Application(Base):
__tablename__ = "application"

id = mapped_column(Integer, primary_key=True, comment="신청서ID")
user_id = mapped_column(Integer, ForeignKey("user.user_id"), nullable=False, comment="유저ID")
form_type = mapped_column(Integer, nullable=False, comment="신청양식 구분 (1: builder, 2: learner)")
form_content = mapped_column(JSON, nullable=False, comment="신청양식 내용")
is_selected = mapped_column(Boolean, nullable=False, comment="선정 여부", default=False)