The legal practice: clients, lawyers, contracts, papers, the journal
CI / secret scan (push) Successful in 7s
CI / fmt, clippy, tests (push) Successful in 45s
CI / release (push) Skipped

Lanna Desk's larger work is contracts, general ones and artists', for
clients who are Thai or foreign, people or organizations, with several
lawyers in the team. The back office gets a Legal section (phase 9 in
docs/PLAN.md):

- Lawyers: license number, contact, the login of one who uses the app
  (then "My contracts"), in the team or left.
- Clients, as record cards: person or organization, names in English and
  Thai, stage name or brand, a Thai ID number (checked), a passport or a
  registration number, the lawyer in charge.
- Contracts: code LD-<year>-<n>, the general kinds and the artist kinds
  (recording, management, publishing, performance, license,
  merchandise), other party, status, lawyer, dates and value; a contract
  in force shows its notice day and its end ahead. Filters: general or
  artists, a lawyer, mine, those over.
- Versions: a text kept here, a file (PDF or scan, encrypted as the
  client's document) or both. They never change: the database refuses
  UPDATE and DELETE, a version's file cannot be deleted and no document's
  checksum can change. Any version reads against the one before as a
  line diff.
- Paper copies: the id <code>-P<n> to write on the paper or print as a
  90 x 50 mm label with a QR code; where it lies, its state and holder,
  each move journaled; found again by its id.
- The journal: every change in words, in the change's transaction, each
  entry chained to the one before by SHA-256. The database refuses to
  change, delete or truncate it; /journal checks the chain and every
  version's text and fingerprints against its entry, shows the last hash
  and exports CSV.

The sidebar groups its sections: Legal, Visas and stays, Office. Demo data
(seed-demo) adds three lawyers, six clients and seven contracts with
versions, papers and moves. Documents take a third owner, the client
(migration 0009).

Checks: fmt, clippy, 115 unit and 62 integration tests (new: versions and
the journal, the database refusing changes, a change around the app
breaking the chain, paper ids and moves, the demo checking whole);
screenshots of the new pages in light, dark and on a phone.
This commit is contained in:
grabowski committed 2026-11-21 23:20:20 +07:00
1 parent 424f212b23
commit 16e4cdc73d
32 files changed
+4758 -45

No files matched your search

+51 -1
View File
@@ -17,7 +17,9 @@
> too. Later that day lannadesk.com became Lanna Desk's own static website
> (B4L/lannadesk-web, Astro), and the app moved to https://app.lannadesk.com;
> its `/` now leads to the back office, and the texts clients read name Lanna
> Desk rather than B4L. **Resume here: phase 8, reminders.**
> Desk rather than B4L. Phase 9, the legal practice
> (clients, lawyers, contracts with versions, paper copies, the journal),
> followed that night. **Resume here: phase 8, reminders.**
Lanna Desk keeps the immigration records of the foreigners that it
looks after: their passports, addresses in Thailand, arrivals with the Thailand
@@ -241,6 +243,7 @@ dark at desktop and phone width, a commit and a push.
| 6 | The Non-B extension pack: B4L's company documents, the checklist, one PDF to print | built Nov 20, 2026 |
| 7 | The client link: a client fills in their own record on a phone, the MRZ read from a photo, and signs Lanna Desk's agreements | built Nov 20, 2026 |
| 8 | Reminders by Matrix room message and by email | |
| 9 | The legal practice: lawyers, clients (Thai and foreign, people and organizations), general and artist contracts with versions that never change, paper copies with ids and places, the journal as a hash-chained ledger | built Nov 21, 2026 |
| later | Thai user interface, agency cases and fees, other visa categories' packs | |
### Phase 1: app, login, people
@@ -531,6 +534,53 @@ Planned on November 20, 2026, from Alex's answers (decisions table).
next link; the person's page says who has signed which version. An
agreement switched off is no longer asked for.
### Phase 9: the legal practice
Lanna Desk does more than visas: its larger work is contracts, general ones
and artists', for clients who are Thai or foreign, people or organizations
(Alex, Nov 21, 2026). Several lawyers work in the team.
- **Lawyers** (`/lawyers`): name, Thai name, license number of the Lawyers
Council of Thailand, contact, the id.cnx.network login of one who uses
the app (then "My contracts" shows theirs), in the team or left.
- **Clients** (`/clients`, record cards): a person or an organization; the
name in English and Thai, a stage name or brand, nationality, a Thai ID
number (checked), a passport number or a registration number, a contact
person, the lawyer in charge, current or former.
- **Contracts** (`/contracts`): code `LD-<year>-<number>` from a sequence,
title, kind (service, employment, lease, sale, loan, NDA, partnership,
sponsorship; the artist kinds recording, management, publishing,
performance, license, merchandise), client, other party, status (draft,
in negotiation, signed, in force, ended, terminated, not concluded), the
lawyer in charge, the dates (signed, in force, ends, notice by) and the
value. A contract in force shows its notice day 45 days ahead and its end
60 days ahead. Filters: general or artists, a lawyer, mine, those over.
- **Versions**: each a text kept in the app, a file (PDF or scan, encrypted
as the client's document of kind `contract`) or both, with a note of what
it is. Numbered per contract, never changed (a trigger refuses UPDATE and
DELETE, and a version's file cannot be deleted or its checksum changed).
A text equal to the last is not kept again. Any version reads against the
one before as a line diff.
- **Paper copies**: the paper of a version gets the id `<code>-P<n>`, to
write on it or to print as a 90 x 50 mm label with a QR code to its page
(`/papers/<id>`); its place, state (filed, out, handed over, destroyed)
and holder change, every move into the journal; id, contract, version
and description never change. Contracts has a box to find a paper by id.
- **Journal** (`/journal`): every change to the above, in words (what was
added; each field from what to what) in the transaction of the change.
Entries chain: each holds the SHA-256 of the one before and its own over
its number, time, actor, client, contract, event, detail and the hash
before. The database refuses UPDATE, DELETE and TRUNCATE. The page checks
the whole chain and every version's text and fingerprints against its
entry, and shows the last hash; the CSV export is a copy to keep outside.
Someone with the database's own rights could still rewrite the chain from
the start; a last hash written down or kept elsewhere shows that.
Open: anchoring the last hash outside the server each day (a Matrix
message, the backup); contract templates; signing contracts on the client
link; reminders of notice days and ends (phase 8); links between a client
and their visa record.
## Open questions
1. B4L's BOI application: once B4L is promoted, its staff extend their stay