Skip to content

Store actions

All mutations live in src/lib/store.ts. They map roughly 1:1 to the API endpoints the backend will need.

Area Action Signature (simplified)
Types createType (input) → ObjectType
updateType (id, patch)
deleteType (id, reason?) → boolean. Fails if the type has items.
renameCategory (from, to)
Items createItems (input) → Item[]. Bulk; reserves consecutive codes.
updateItem (id, { name?, labels?, location? })
setStatus (id, status)
assign (childId, parentId | null, slotId?) → boolean. Rejects cycles.
setCustodian (id, userId?). Admin direct assignment.
toggleWatch (id)
deleteItem (id, reason?)
reportProblem ({ itemId, status, note, photo? }). Field view.
Custody offerHandover (itemId, toId, note?) → Handover | null
requestCustody (itemId, note?) → Handover | 'taken' | null
respondHandover (id, { accept, note?, checked?, missing?, condition? })
cancelHandover (id)
Documents addDoc / removeDoc
Comments addComment (target, body, { via?, replyTo? }) → Comment
deleteComment (id, reason?). Removes replies too.
Audit restore (auditId) → RestoreError | null
Users inviteUser, updateUser, removeUser
Settings updateSettings (patch)

RestoreError is one of gone, codeTaken, prefixTaken, typeMissing, targetMissing, emailTaken.