2 Commits
Author SHA1 Message Date
grabowski 684dd27bad PLAN: phase 10 decided with Alex
CI / secret scan (push) Successful in 7s
CI / fmt, clippy, tests (push) Successful in 46s
CI / release (push) Skipped
Visa clients keep the "MUSTERMANN, Erika" form in the client list;
Companies become part of organization clients too (migration 0011 after
the people step); every lawyer sees every client for now, with room left
for finer access later.
2026-11-22 20:11:57 +07:00
grabowski e9066c0445 PLAN: phase 10, one client list (planned, not started)
CI / secret scan (push) Successful in 7s
CI / fmt, clippy, tests (push) Successful in 1m12s
CI / release (push) Skipped
Alex asked whether People should become Clients. The plan: clients are
everyone Lanna Desk works for, and a visa record (people) is part of a
person client, linked by people.client_id, so every visa table, the
forms, the pack, the client link and the audit log keep person_id.
Contact moves to the client, the passport-style name stays on the visa
record, nationality becomes alpha-3 on clients too, archiving is the
client's. Migration 0010 backfills a client per person and needs a test
through the migrations; four steps; three questions for Alex first (the
name format, Companies as organization clients, who sees which clients).
2026-11-22 00:03:47 +07:00
+82 -1
View File
@@ -19,7 +19,8 @@
> its `/` now leads to the back office, and the texts clients read name Lanna
> 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.**
> followed that night, and phase 10, one client list, was planned. **Resume
> here: phase 8, reminders, or phase 10, whose questions are decided.**
Lanna Desk keeps the immigration records of the foreigners that it
looks after: their passports, addresses in Thailand, arrivals with the Thailand
@@ -244,6 +245,7 @@ dark at desktop and phone width, a commit and a push.
| 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 |
| 10 | One client list: a visa record becomes part of a client; People becomes the visa clients | planned Nov 21, 2026 |
| later | Thai user interface, agency cases and fees, other visa categories' packs | |
### Phase 1: app, login, people
@@ -581,6 +583,85 @@ 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.
### Phase 10: one client list (planned)
Since phase 9 there are two lists of the people Lanna Desk works for:
Clients (the legal practice) and People (the visa records), and nothing ties
Erika's visa record to a client. Alex asked on November 21, 2026 whether
People should become Clients; the plan is one list in which a visa record is
part of a client. Not started: build it when Alex says so.
**The model.** `clients` is everyone Lanna Desk works for. `people` stays as
the visa record of a person client, so passports, addresses, stays,
documents, client links, signatures, the deadlines, the forms, the pack and
the audit log keep their `person_id` and work as they do.
- `people.client_id` references `clients`, unique and, once filled, not
null: a client has at most one visa record, every visa record has a client.
- One place for each fact. The passport-style name (surname, first and
middle name, title, sex, date and place of birth) stays on the visa record,
since the forms need it as printed. Phone and email move to the client
(`people.phone` and `people.email` go after the copy); the client link's
Contact page and the forms read them there. A visa client's name on the
client list is taken from the visa record ("Erika Mustermann") and is not
edited on the client form.
- Nationality becomes an ISO alpha-3 code on clients too, with the country
list the person form uses, so both say "Germany" the same way.
- Archiving is the client's: a former client's visa record is archived with
it, and restoring the client restores it.
- The audit log keeps the visa side (views and changes of a person); the
journal keeps the client, contracts and papers, and adds an entry when a
visa record is opened for a client or the client's contact changes.
**Migration 0010** creates a client for every person (kind person, the name,
nationality, phone and email from the person, status from `archived_at`, no
lawyer), sets `client_id`, then the constraint, and writes one journal entry
per client ("client added from the visa record of person N"). It runs by
itself at the first start after cnx01 fetches the release, on the live
records, and a rollback does not undo it, so it needs a test that loads
people through the migrations up to 0009, applies 0010 and checks every
person has its client with the same name and contact.
**The pages.**
- Clients: every client; a chip on the cards of those with a visa record and
their next deadline; tabs All, With contracts, With a visa record.
- A client's page: a "Visa and stay" card with the stay and the next dates,
linking to the visa record's pages, which keep their `/people/{id}/...`
addresses (client links, bookmarks and audit rows point there). A client
without one gets "Open a visa record", which asks for the passport-style
name.
- The visa record's pages show "Clients / name" above the tabs and a link
to the client's contracts.
- The sidebar: under Visas and stays, People becomes "Visa clients", the
same clients filtered to those with a visa record; Deadlines stays the
start page.
- "+ New client" on the visa side opens the client and the visa record in
one step, as `/people/new-client` does now.
**Steps.**
1. Migration 0010, the backfill test, contact read from the client.
2. The client page's visa card, the visa pages' crumb, the list filters and
the sidebar.
3. The client link writes the contact to the client; the journal entries.
4. Docs, screenshots, release; on cnx01, `visa-admin` checks that the
number of people equals the number of clients with a visa record.
**Decided with Alex (November 21, 2026).**
1. A visa client's name reads as on the visa side: "MUSTERMANN, Erika".
2. Companies and organization clients become one list too: the company
record (registration, address, director, the pack's documents) becomes
part of an organization client, as the visa record is part of a person
client. Employees stay linked to the company record, so the forms and the
pack keep working. This adds a step after step 3: migration 0011 creates
an organization client per company, and the company pages move as the
visa pages do.
3. Every lawyer and staff member sees every client for now. The model leaves
room for finer access later (a client's team of lawyers, a role per
section), so no page should assume more than the queries enforce.
## Open questions
1. B4L's BOI application: once B4L is promoted, its staff extend their stay