mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-10-26 14:30:13 +00:00
41be1bf113
* feat(apps): human-facing JSON names the app that wrote an item, comment or version (TASK-3413, SPEC-6 U9c) Items (the creating app), comments and version rows carry via_app (the install id) and via_app_name (the bot's name, else the origin; kept after uninstall) on the web API, the MCP get / list summary / history summary projections, and the TS types, with WorkspaceApp naming the members apps array. ToolSurface 0.65, additive. Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS * fix(apps): attribution on search, /changes, playbook show and restore; chunked lookup (codex r1 on U9c) Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS * fix(apps): attribution on the role board, a comment edit's response and the account export (codex r2 on U9c) Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS * docs: README tool catalog at v0.65 (TASK-3413) Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS
49 lines
2.1 KiB
Go
49 lines
2.1 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Version struct {
|
|
ID string `json:"id"`
|
|
DocumentID string `json:"document_id"`
|
|
Content string `json:"content"`
|
|
ChangeSummary string `json:"change_summary,omitempty"`
|
|
CreatedBy string `json:"created_by"`
|
|
Source string `json:"source"`
|
|
IsDiff bool `json:"is_diff"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
// PLAN-2348 U2 (item versions only). UserID is who wrote the row;
|
|
// ActorName is that user's name, joined on read. Both are empty for rows
|
|
// written before U2 (the column existed, unwritten, since migration 012)
|
|
// and for system rows (recovery).
|
|
UserID string `json:"user_id,omitempty"`
|
|
ActorName string `json:"actor_name,omitempty"`
|
|
// LinesAdded / LinesRemoved count the change this row's WRITE recorded:
|
|
// empty → body for a create row, body → the replacing body for an update
|
|
// row. nil means unknown (every row written before migration 103).
|
|
LinesAdded *int `json:"lines_added,omitempty"`
|
|
LinesRemoved *int `json:"lines_removed,omitempty"`
|
|
// IsCreate marks a row written by item create, which holds the body AS
|
|
// CREATED; an update row holds the body BEFORE its edit.
|
|
IsCreate bool `json:"is_create,omitempty"`
|
|
// Imported marks a row a workspace import wrote (BUG-3379): its
|
|
// created_by and source came from the export, unverified here.
|
|
Imported bool `json:"imported,omitempty"`
|
|
|
|
// ViaApp and ViaAppName name the app whose write made this version,
|
|
// absent for a person's or agent's (SPEC-6 U9c, TASK-3413). The name
|
|
// is the app's bot display name, else its origin, and survives
|
|
// uninstall. The server fills both on read; no scan sets them.
|
|
ViaApp string `json:"via_app,omitempty"`
|
|
ViaAppName string `json:"via_app_name,omitempty"`
|
|
}
|
|
|
|
// ItemVersionDiff is the change one item version row records (PLAN-2348 U2):
|
|
// the bodies before and after the write that made the row, so a History card
|
|
// can show that edit's own diff rather than one against today's body.
|
|
type ItemVersionDiff struct {
|
|
Version Version `json:"version"`
|
|
Before string `json:"before"`
|
|
After string `json:"after"`
|
|
}
|