Let the same choice open notes and drafts
The picker in the bell now governs both lists, so note_subscriptions is renamed to colleague_subscriptions -- a name that only mentions notes would mislead the next reader. Reading and writing a draft now reach differently far. hire_drafts_owner (for all) is split into four policies: select lets in your own drafts and those of the people you added, while insert/update/delete stay with the owner. A draft is unfinished work with no lock and no history; two people writing into the same row would overwrite each other silently. That split forces a change in the actions: a policy does not reject a write, it lets it hit no rows. saveHireDraft and deleteHireDraft now read the row count instead of reporting success over a row that never changed. The card shows a foreign draft with its author and without Fortsetzen or Loeschen -- offering a button that reliably ends in a database error is a promise without cover. check-schema-types.mjs learns `alter table ... rename to`; without it the drift check reports one rename as two errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ export type ShellData = {
|
||||
*
|
||||
* `sichtbar` ist der Stand des Hakens: gesetzt, wenn die Person
|
||||
* hinzugewählt ist. Die eigene Person steht nicht in der Liste — die
|
||||
* eigenen Notizen sind immer dabei.
|
||||
* eigenen Notizen und Entwürfe sind immer dabei.
|
||||
*/
|
||||
kollegen: { id: string; name: string; sichtbar: boolean }[];
|
||||
};
|
||||
@@ -75,7 +75,7 @@ export async function loadShellData(tx: Tx, userId: string): Promise<ShellErgebn
|
||||
jsonArrayFrom(offeneStellenAbfrage(eb, asOf)).as("open"),
|
||||
jsonArrayFrom(offeneNotizenAbfrage(eb, userId)).as("notes"),
|
||||
// Alle freigeschalteten HR-Personen ausser der eigenen, dazu die
|
||||
// eigenen Ausnahmen. Beides in derselben Rundreise wie der Rest der
|
||||
// eigene Auswahl. Beides in derselben Rundreise wie der Rest der
|
||||
// Hülle — die Einstellung steckt in der Glocke, also muss sie beim
|
||||
// ersten Aufschlagen da sein.
|
||||
jsonArrayFrom(
|
||||
@@ -88,13 +88,19 @@ export async function loadShellData(tx: Tx, userId: string): Promise<ShellErgebn
|
||||
.orderBy("full_name")
|
||||
).as("hrLeute"),
|
||||
jsonArrayFrom(
|
||||
eb.selectFrom("note_subscriptions").select("author_user_id").where("user_id", "=", userId)
|
||||
eb.selectFrom("colleague_subscriptions").select("author_user_id").where("user_id", "=", userId)
|
||||
).as("abos"),
|
||||
jsonArrayFrom(
|
||||
eb
|
||||
.selectFrom("hire_drafts")
|
||||
.select(["id", "step", "payload"])
|
||||
.select((x) => zeitstempel(x.ref("updated_at")).as("updated_at"))
|
||||
// Hier bewusst **nur** die eigenen, obwohl die Übersicht seit
|
||||
// September 2026 auch fremde zeigt: diese Liste füttert den
|
||||
// Einstellungsassistenten (HireWizardProvider), und was er darin
|
||||
// findet, lässt sich fortsetzen. Ein fremder Entwurf gehört nicht
|
||||
// hinein — die Regel hire_drafts_update wiese das Speichern ab,
|
||||
// und die Person hätte den Assistenten umsonst durchlaufen.
|
||||
.where("created_by", "=", userId)
|
||||
.orderBy("updated_at", "desc")
|
||||
).as("drafts"),
|
||||
|
||||
Reference in New Issue
Block a user