start initial backend integration
parent
b7b432e414
commit
1103ecaa6f
|
@ -0,0 +1,10 @@
|
|||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy import String
|
||||
|
||||
from database import Base
|
||||
|
||||
|
||||
class Event(Base):
|
||||
__tablename__ = 'event'
|
||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||||
title: Mapped[str] = mapped_column(String(128), nullable=False)
|
|
@ -0,0 +1,11 @@
|
|||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy import ForeignKey
|
||||
|
||||
from database import Base
|
||||
|
||||
|
||||
class EventTask(Base):
|
||||
__tablename__ = 'event_task'
|
||||
event_id: Mapped[int] = mapped_column(ForeignKey('event.id'), nullable=False, primary_key=True)
|
||||
task_id: Mapped[int] = mapped_column(ForeignKey('task.id'), nullable=False, primary_key=True)
|
||||
is_completed: Mapped[bool] = mapped_column(nullable=False, default=False)
|
|
@ -0,0 +1,14 @@
|
|||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy import ForeignKey, String
|
||||
|
||||
from database import Base
|
||||
|
||||
|
||||
class Notification(Base):
|
||||
__tablename__ = 'notification'
|
||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||||
title: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(String(128))
|
||||
profile_id: Mapped[int] = mapped_column(ForeignKey('profile.id'), nullable=False)
|
||||
is_recited: Mapped[bool] = mapped_column(nullable=False, default=False)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from database import Base
|
||||
|
||||
|
||||
class Profile(Base):
|
||||
__tablename__ = 'profile'
|
||||
id: Mapped[int] = mapped_column(nullable=False, primary_key=True)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy import ForeignKey, String
|
||||
|
||||
from database import Base
|
||||
|
||||
|
||||
class SubTask(Base):
|
||||
__tablename__ = 'subtask'
|
||||
id: Mapped[int] = mapped_column(nullable=False, primary_key=True)
|
||||
task_id: Mapped[int] = mapped_column(ForeignKey('task.id'), nullable=False)
|
||||
title: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(String(128))
|
||||
status: Mapped[str] = mapped_column(String(128), default='active', nullable=False)
|
||||
time_till: Mapped[datetime] = mapped_column(nullable=False, default=lambda _: datetime.utcnow() + timedelta(days=1))
|
||||
time_finished: Mapped[datetime] = mapped_column(nullable=True)
|
||||
lon: Mapped[str | None] = mapped_column(String(128))
|
||||
lat: Mapped[str | None] = mapped_column(String(128))
|
|
@ -0,0 +1,17 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy import ForeignKey, String
|
||||
|
||||
from database import Base
|
||||
|
||||
|
||||
class Task(Base):
|
||||
__tablename__ = 'task'
|
||||
id: Mapped[int] = mapped_column(nullable=False, primary_key=True)
|
||||
title: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(String(128))
|
||||
status: Mapped[str] = mapped_column(String(128), default='active', nullable=False)
|
||||
time_till: Mapped[datetime] = mapped_column(nullable=False, default=lambda _: datetime.utcnow() + timedelta(days=1))
|
||||
time_finished: Mapped[datetime] = mapped_column(nullable=True)
|
||||
profile_id: Mapped[int] = mapped_column(ForeignKey('profile.id'), nullable=False)
|
|
@ -0,0 +1,9 @@
|
|||
services:
|
||||
db:
|
||||
image: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- POSTGRES_DB=transporter
|
Loading…
Reference in New Issue