v1.0.155: VM PostgreSQL + modular db/ & services/ — Lucee stays SPA shell only

This commit is contained in:
2026-06-23 16:01:26 +04:00
parent 568758a23c
commit ee374171d8
16 changed files with 814 additions and 494 deletions
+25
View File
@@ -0,0 +1,25 @@
"""Contracts CRUD."""
from .connection import query, execute, execute_returning
def insert(number, client=""):
return execute_returning(
"INSERT INTO contracts (number, client) VALUES (%s, %s) RETURNING *",
(number, client),
)
def get(contract_id):
rows = query("SELECT * FROM contracts WHERE id = %s", (contract_id,))
return rows[0] if rows else None
def delete(contract_id):
return execute("DELETE FROM contracts WHERE id = %s", (contract_id,))
def delete_orphaned():
"""Remove contracts with no supplements."""
execute(
"DELETE FROM contracts WHERE id NOT IN (SELECT DISTINCT contract_id FROM supplements)"
)