Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit d659c46

Browse files
committed
Add DELETE endpoint for sketches (to be tested)
1 parent 0b32027 commit d659c46

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

handlers.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,16 @@ func applyAction(sketch *SketchStatus, action string, status *Status) error {
547547
sketch.PID = 0
548548
sketch.Status = "STOPPED"
549549
break
550+
case "DELETE":
551+
applyAction(sketch, "STOP", status)
552+
fmt.Println("delete called")
553+
sketchFolder, err := GetSketchFolder()
554+
err = os.Remove(filepath.Join(sketchFolder, sketch.Name))
555+
if err != nil {
556+
fmt.Println("error deleting sketch")
557+
}
558+
status.Sketches[sketch.ID] = nil
559+
break
550560
case "PAUSE":
551561
err = process.Signal(syscall.SIGTSTP)
552562
sketch.Status = "PAUSED"

0 commit comments

Comments
 (0)