Create dockerfile, changed apply_commits method

This commit is contained in:
Ivan Vazhenin
2023-11-15 10:58:45 +07:00
parent 5e9f427072
commit a25a54eb92
6 changed files with 71 additions and 10 deletions

13
db.py
View File

@@ -54,6 +54,7 @@ class User(Base):
'profiles': [x.to_dict() for x in self.profiles],
'schedule': [x.to_dict() for x in self.schedule],
'queue': [x.to_dict() for x in self.queue],
'income_branches': [x.to_dict() for x in self.income_branches],
}
def is_active_now(self):
@@ -74,8 +75,8 @@ class Profile(Base):
id: Mapped[int] = mapped_column(primary_key=True)
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'))
scheme: Mapped[str]
branch: Mapped[str]
json: Mapped[str]
branch: Mapped[str] = mapped_column(String, nullable=True)
json: Mapped[str] = mapped_column(String, nullable=True)
user: Mapped['User'] = relationship(back_populates='profiles')
@@ -84,7 +85,6 @@ class Profile(Base):
'id': self.id,
'scheme': self.scheme,
'branch': self.branch,
'upstream': self.upstream,
'json': self.json,
}
@@ -99,6 +99,13 @@ class IncomeBranch(Base):
user: Mapped['User'] = relationship(back_populates='income_branches')
def to_dict(self) -> dict:
return {
'id': self.id,
'scheme': self.scheme,
'branch': self.branch,
}
class Schedule(Base):
__tablename__ = 'schedule'