diff --git a/accounts.py b/accounts.py index 0d59673..458aeaa 100644 --- a/accounts.py +++ b/accounts.py @@ -44,9 +44,7 @@ async def list_directory_users( username=account.username, email=account.email, wallets=[ - DirectoryWallet( - id=w.id, name=w.name, balance_msat=w.balance_msat - ) + DirectoryWallet(id=w.id, name=w.name, balance_msat=w.balance_msat) for w in wallets ], ) diff --git a/migrations.py b/migrations.py index 547b587..2967f47 100644 --- a/migrations.py +++ b/migrations.py @@ -16,8 +16,7 @@ schema. async def m001_initial(db): """Payroll contracts — the standing "pay X this much, this often" rows.""" - await db.execute( - f""" + await db.execute(f""" CREATE TABLE payroll.contracts ( id TEXT PRIMARY KEY, employee_id TEXT NOT NULL, @@ -37,16 +36,13 @@ async def m001_initial(db): created_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}, updated_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now} ); - """ - ) + """) # The scheduler's hot path is "every contract still eligible to pay". # NOTE: the schema qualifier goes on the INDEX name, not the table — # SQLite attaches the extension DB as schema `payroll`, and # `CREATE INDEX ON schema.table` is a syntax error there. - await db.execute( - "CREATE INDEX payroll.idx_contracts_status ON contracts (status);" - ) + await db.execute("CREATE INDEX payroll.idx_contracts_status ON contracts (status);") # Employee-facing lookups ("show me my payroll lines") filter by account. await db.execute( "CREATE INDEX payroll.idx_contracts_employee ON contracts (employee_id);" diff --git a/models.py b/models.py index 782eaf9..c877200 100644 --- a/models.py +++ b/models.py @@ -56,8 +56,8 @@ class Frequency(str, Enum): class ContractStatus(str, Enum): - active = "active" # eligible for payout on every scheduler tick - paused = "paused" # keeps its schedule position, pays nothing + active = "active" # eligible for payout on every scheduler tick + paused = "paused" # keeps its schedule position, pays nothing completed = "completed" # ran out of periods; terminal cancelled = "cancelled" # stopped by the operator; terminal @@ -93,7 +93,7 @@ class CreateContract(BaseModel): total_periods: int | None = None label: str = "" # display name for the line, e.g. "Alice — dev retainer" - memo: str = "" # payment memo the employee sees; falls back to `label` + memo: str = "" # payment memo the employee sees; falls back to `label` # Periods whose payday already passed before the contract existed. Off by # default: creating a contract with a back-dated start is normally an diff --git a/views_api.py b/views_api.py index bd8afef..76d87c1 100644 --- a/views_api.py +++ b/views_api.py @@ -149,9 +149,7 @@ async def api_update_contract(contract_id: str, data: UpdateContract) -> Contrac return await crud.update_contract(contract) -@payroll_api_router.delete( - "/api/v1/contracts/{contract_id}", status_code=HTTPStatus.OK -) +@payroll_api_router.delete("/api/v1/contracts/{contract_id}", status_code=HTTPStatus.OK) async def api_delete_contract(contract_id: str) -> None: """Hard-delete a contract row.