Neue Verwaltung der Gruppenzuordnung 1:n
This commit is contained in:
1 parent
fa02a7ade0
commit
02c017d53d
34 files changed
+1306
-251
No files matched your search
@@ -48,6 +48,13 @@ class AccountModel:
|
||||
'UPDATE accounts SET role = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ? AND tenant_id = ?',
|
||||
(role, account_id, tenant_id)
|
||||
)
|
||||
# Ein Account, der nicht mehr die Rolle "Gruppe" hat, darf keine
|
||||
# Gruppenzuordnung behalten.
|
||||
if role != 'Gruppe':
|
||||
db.execute(
|
||||
'DELETE FROM group_accounts WHERE tenant_id = ? AND account_id = ?',
|
||||
(tenant_id, account_id)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
@staticmethod
|
||||
@@ -62,5 +69,9 @@ class AccountModel:
|
||||
@staticmethod
|
||||
def delete(account_id, tenant_id):
|
||||
db = get_db()
|
||||
db.execute(
|
||||
'DELETE FROM group_accounts WHERE tenant_id = ? AND account_id = ?',
|
||||
(tenant_id, account_id)
|
||||
)
|
||||
db.execute('DELETE FROM accounts WHERE id = ? AND tenant_id = ?', (account_id, tenant_id))
|
||||
db.commit()
|
||||
Reference in new issue
Block a user