Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions backend/checklists.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"

plugin "github.com/Paca-AI/plugin-sdk-go"
"github.com/google/uuid"
)

// ── Domain types ──────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -142,17 +141,20 @@ func (p *checklistPlugin) createChecklist(req *plugin.Request, res *plugin.Respo
nextPos = sc.intVal("next_pos")
}

id := uuid.New().String()
now := nowStr()
_, err = p.db.Exec(
`INSERT INTO task_checklists (id, task_id, title, position, created_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7)`,
id, taskID, b.Title, nextPos, req.Caller.CallerID, now, now,
inserted, err := p.db.Query(
`INSERT INTO task_checklists (task_id, title, position, created_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id`,
taskID, b.Title, nextPos, req.Caller.CallerID, now, now,
)
if err != nil {
p.log.Error("createChecklist insert: " + err.Error())
if err != nil || len(inserted.Rows) == 0 {
if err != nil {
p.log.Error("createChecklist insert: " + err.Error())
}
res.Error(500, "failed to create checklist")
return
}
idSC := newRowScanner(inserted.Columns, inserted.Rows[0])
id := idSC.str("id")
cl := checklist{
ID: id,
TaskID: taskID,
Expand Down
2 changes: 0 additions & 2 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ module github.com/Paca-AI/first-party/checklist
go 1.24

require github.com/Paca-AI/plugin-sdk-go v0.2.0

require github.com/google/uuid v1.6.0
2 changes: 0 additions & 2 deletions backend/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
github.com/Paca-AI/plugin-sdk-go v0.2.0 h1:Fur6p+OQoC5imq7qmvaQtJnZ3SRVRskx8KcT/rqFHj4=
github.com/Paca-AI/plugin-sdk-go v0.2.0/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
16 changes: 9 additions & 7 deletions backend/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
plugin "github.com/Paca-AI/plugin-sdk-go"
"github.com/google/uuid"
)

// ── Item route handlers ───────────────────────────────────────────────────────
Expand Down Expand Up @@ -46,17 +45,20 @@ func (p *checklistPlugin) createItem(req *plugin.Request, res *plugin.Response)
nextPos = sc.intVal("next_pos")
}

id := uuid.New().String()
now := nowStr()
_, err = p.db.Exec(
`INSERT INTO task_checklist_items (id, checklist_id, title, is_checked, assignee_id, position, created_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)`,
id, checklistID, b.Title, false, nil, nextPos, req.Caller.CallerID, now, now,
inserted, err := p.db.Query(
`INSERT INTO task_checklist_items (checklist_id, title, is_checked, assignee_id, position, created_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id`,
checklistID, b.Title, false, nil, nextPos, req.Caller.CallerID, now, now,
)
if err != nil {
p.log.Error("createItem insert: " + err.Error())
if err != nil || len(inserted.Rows) == 0 {
if err != nil {
p.log.Error("createItem insert: " + err.Error())
}
res.Error(500, "failed to create item")
return
}
idSC := newRowScanner(inserted.Columns, inserted.Rows[0])
id := idSC.str("id")
item := checklistItem{
ID: id,
ChecklistID: checklistID,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ChecklistsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function ChecklistsSectionInner({
checklist={cl}
canEdit={canEdit}
onRename={(id, title) =>
api.pluginPatch(PLUGIN_ID, `/tasks/${taskId}/checklists/${id}`, { title }).then(invalidate)
api.pluginPatch(PLUGIN_ID, `/projects/${projectId}/tasks/${taskId}/checklists/${id}`, { title }).then(invalidate)
}
onDelete={(id) => deleteChecklist.mutate(id)}
onCreateItem={(checklistId, title) =>
Expand Down
Loading