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
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/bdd
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=
19 changes: 11 additions & 8 deletions backend/scenarios.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 @@ -88,18 +87,22 @@ func (p *bddPlugin) createScenario(req *plugin.Request, res *plugin.Response) {
return
}

id := uuid.New().String()
now := nowStr()
_, err = p.db.Exec(
`INSERT INTO bdd_scenarios (id, task_id, title, given_text, when_text, then_text, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`,
id, taskID, b.Title, b.Given, b.When, b.Then, now, now,
inserted, err := p.db.Query(
`INSERT INTO bdd_scenarios (task_id, title, given_text, when_text, then_text, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7)
RETURNING id`,
taskID, b.Title, b.Given, b.When, b.Then, now, now,
)
if err != nil {
p.log.Error("createScenario insert: " + err.Error())
if err != nil || len(inserted.Rows) == 0 {
if err != nil {
p.log.Error("createScenario insert: " + err.Error())
}
res.Error(500, "failed to create bdd scenario")
return
}
idSC := newRowScanner(inserted.Columns, inserted.Rows[0])
id := idSC.str("id")
scenario := bddScenario{
ID: id,
TaskID: taskID,
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
"method": "PATCH",
"path": "/projects/:projectId/projects/:projectId/tasks/:taskId/bdd-scenarios/:scenarioId",
"path": "/projects/:projectId/tasks/:taskId/bdd-scenarios/:scenarioId",
"middlewares": [
{ "name": "optionalAuthn" },
{ "name": "requireFreshPassword" },
Expand Down
Loading