feat(server): 用户管理与变更历史接口;修复 result_revisions.parent_id 从未写入
This commit is contained in:
1 parent
f3813171d3
commit
72462792ec
39 files changed
+10001
-28
No files matched your search
@@ -584,10 +584,16 @@ func recordRevision(ctx context.Context, tx *sql.Tx, eventID int64, action strin
|
||||
if err != nil {
|
||||
return internal(err)
|
||||
}
|
||||
// 父节点 = 该小项最近一次版本,串成一条主线;撤销后再发布会自然从撤销点分出新分支。
|
||||
var parentID sql.NullInt64
|
||||
if err := tx.QueryRowContext(ctx,
|
||||
`SELECT MAX(id) FROM result_revisions WHERE event_id = ?`, eventID).Scan(&parentID); err != nil {
|
||||
return internal(err)
|
||||
}
|
||||
_, err = tx.ExecContext(ctx,
|
||||
`INSERT INTO result_revisions (event_id, action, snapshot_json, ledger_ids, actor_id, message)
|
||||
VALUES (?, ?, ?, '[]', ?, ?)`,
|
||||
eventID, action, string(snapshot), nullID(actorID), message)
|
||||
`INSERT INTO result_revisions (parent_id, event_id, action, snapshot_json, ledger_ids, actor_id, message)
|
||||
VALUES (?, ?, ?, ?, '[]', ?, ?)`,
|
||||
parentID, eventID, action, string(snapshot), nullID(actorID), message)
|
||||
if err != nil {
|
||||
return internal(err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user