Add new scheme application
This commit is contained in:
2
db.py
2
db.py
@@ -96,6 +96,7 @@ class IncomeBranch(Base):
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'))
|
||||
scheme: Mapped[str]
|
||||
branch: Mapped[str]
|
||||
local_scheme: Mapped[str]
|
||||
|
||||
user: Mapped['User'] = relationship(back_populates='income_branches')
|
||||
|
||||
@@ -104,6 +105,7 @@ class IncomeBranch(Base):
|
||||
'id': self.id,
|
||||
'scheme': self.scheme,
|
||||
'branch': self.branch,
|
||||
'local_scheme': self.local_scheme,
|
||||
}
|
||||
|
||||
|
||||
|
||||
8
main.py
8
main.py
@@ -67,8 +67,8 @@ def get_branch(bndname: str, scheme: str):
|
||||
with Session(conn) as session:
|
||||
item = session.query(db.IncomeBranch).filter_by(scheme=scheme).join(db.User).filter_by(bndname=bndname).one_or_none()
|
||||
if item:
|
||||
return item.branch
|
||||
return None
|
||||
return item.branch,item.local_scheme
|
||||
return None, None
|
||||
|
||||
|
||||
def run_tasks():
|
||||
@@ -570,7 +570,9 @@ def apply_commits(params, files, url):
|
||||
repl = req.find('replication')
|
||||
scheme = repl.get('scheme')
|
||||
commit = repl.get('id')
|
||||
branch = get_branch(params['from'].replace('tcp://', ''), scheme)
|
||||
branch, new_scheme = get_branch(params['from'].replace('tcp://', ''), scheme)
|
||||
if new_scheme:
|
||||
scheme = new_scheme
|
||||
if branch:
|
||||
logging.warning(branch)
|
||||
con = OOConnectionParams(scheme, Config.oodb_host, Config.oodb_port, Config.oodb_dbname,
|
||||
|
||||
Reference in New Issue
Block a user