mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): add task prompt modification endpoint (#20811)
This PR adds the backend implementation for modifying task prompts. Part of https://github.com/coder/internal/issues/1084 ## Changes - New `UpdateTaskPrompt` database query to update task prompts - New PATCH `/api/v2/tasks/{task}/prompt` endpoint ## Notes This is part 1 of a 2-part PR stack. The frontend UI will be added in a follow-up PR based on this branch (https://github.com/coder/coder/pull/20812). --- 🤖 PR was written by Claude Sonnet 4.5 Thinking using [Coder Mux](https://github.com/coder/cmux) and reviewed by a human 👩
This commit is contained in:
@@ -132,11 +132,28 @@ func (w ConnectionLog) RBACObject() rbac.Object {
|
||||
return obj
|
||||
}
|
||||
|
||||
// TaskTable converts a Task to it's reduced version.
|
||||
// A more generalized solution is to use json marshaling to
|
||||
// consistently keep these two structs in sync.
|
||||
// That would be a lot of overhead, and a more costly unit test is
|
||||
// written to make sure these match up.
|
||||
func (t Task) TaskTable() TaskTable {
|
||||
return TaskTable{
|
||||
ID: t.ID,
|
||||
OrganizationID: t.OrganizationID,
|
||||
OwnerID: t.OwnerID,
|
||||
Name: t.Name,
|
||||
WorkspaceID: t.WorkspaceID,
|
||||
TemplateVersionID: t.TemplateVersionID,
|
||||
TemplateParameters: t.TemplateParameters,
|
||||
Prompt: t.Prompt,
|
||||
CreatedAt: t.CreatedAt,
|
||||
DeletedAt: t.DeletedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func (t Task) RBACObject() rbac.Object {
|
||||
return rbac.ResourceTask.
|
||||
WithID(t.ID).
|
||||
WithOwner(t.OwnerID.String()).
|
||||
InOrg(t.OrganizationID)
|
||||
return t.TaskTable().RBACObject()
|
||||
}
|
||||
|
||||
func (t TaskTable) RBACObject() rbac.Object {
|
||||
|
||||
Reference in New Issue
Block a user