Add new fields to config and cleardata

This commit is contained in:
Ivan Vazhenin
2023-11-10 22:08:31 +07:00
parent 45b04a635b
commit df96273efb
2 changed files with 7 additions and 0 deletions

5
db.py
View File

@@ -70,6 +70,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]
upstream: Mapped[bool]
json: Mapped[str]
user: Mapped['User'] = relationship(back_populates='profiles')
@@ -77,6 +79,9 @@ class Profile(Base):
def to_dict(self) -> dict:
return {
'id': self.id,
'scheme': self.scheme,
'branch': self.branch,
'upstream': self.upstream,
'json': self.json,
}

View File

@@ -539,6 +539,7 @@ def put_object(params, files, url):
ws.transaction()
res = ws.save()
ws.commit(f'Putobject from {params["to"]}')
ws.clearData(True)
def apply_commits(params, files, url):
@@ -569,6 +570,7 @@ def apply_commits(params, files, url):
files_data = json.load(f)
for file_data in files_data:
upload_file(os.path.join(dir.name, file_data['key']), file_data['key'], file_data['bucket'])
ws.clearData(True)
def run_task(query_type, params, files, url):