From 5868b4dfdf6649c337c6a3a9dc9040275a649774 Mon Sep 17 00:00:00 2001 From: pikann22 Date: Wed, 17 Jun 2026 06:46:24 +0000 Subject: [PATCH] fix: remove unused uuid dependency and update scenario creation logic --- backend/go.mod | 2 -- backend/go.sum | 2 -- backend/scenarios.go | 19 +++++++++++-------- plugin.json | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index 965fab9..2cf1f69 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -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 diff --git a/backend/go.sum b/backend/go.sum index bede9ea..8389b8f 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -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= diff --git a/backend/scenarios.go b/backend/scenarios.go index 98b4a51..24fb583 100644 --- a/backend/scenarios.go +++ b/backend/scenarios.go @@ -4,7 +4,6 @@ import ( "fmt" plugin "github.com/Paca-AI/plugin-sdk-go" - "github.com/google/uuid" ) // ── Domain types ────────────────────────────────────────────────────────────── @@ -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, diff --git a/plugin.json b/plugin.json index 67b4a93..6641880 100644 --- a/plugin.json +++ b/plugin.json @@ -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" },