feat: implement backend core with repricing logic, case management, and multi-service architecture

This commit is contained in:
2026-05-13 00:28:13 +03:00
parent 38f3199c33
commit d9aae5b85e
15 changed files with 596 additions and 90 deletions

View File

@@ -98,8 +98,22 @@ def login():
if not user or not bcrypt.checkpw(password.encode('utf-8'), user[1].encode('utf-8')):
return jsonify({"error": "Invalid credentials"}), 401
# Get more user info for team support
conn = get_db_connection()
cur = conn.cursor()
cur.execute("SELECT id, role, parent_id FROM users WHERE username = %s", (username,))
user_info = cur.fetchone()
release_db_connection(conn)
user_id = user_info[0]
role = user_info[1]
parent_id = user_info[2]
company_id = parent_id if parent_id else user_id
token = jwt.encode({
'user_id': user[0],
'user_id': user_id,
'company_id': company_id,
'role': role,
'exp': datetime.utcnow() + timedelta(days=7)
}, SECRET_KEY, algorithm="HS256")