Skip to content

Commit 1d72c32

Browse files
committed
fix(be): delete schedule
1 parent 7ca8da1 commit 1d72c32

File tree

4 files changed

+47
-18
lines changed

4 files changed

+47
-18
lines changed

.dredd/hooks/capabilities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// STATE
13-
// Runtime created objects we needs to reference in test setups
13+
// Runtime created objects we need to reference in test setups
1414
var testRunnerUser *db.User
1515
var userPathTestUser *db.User
1616
var userProject *db.Project

.dredd/hooks/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ func main() {
105105
h.Before("project > /api/project/{project_id}/tasks/{task_id} > Deletes task (including output) > 204 > application/json", capabilityWrapper("task"))
106106
h.Before("project > /api/project/{project_id}/tasks/{task_id}/output > Get task output > 200 > application/json", capabilityWrapper("task"))
107107

108+
h.Before("schedule > /api/project/{project_id}/schedules/{schedule_id} > Get schedule > 200 > application/json", capabilityWrapper("schedule"))
109+
h.Before("schedule > /api/project/{project_id}/schedules/{schedule_id} > Updates schedule > 204 > application/json", capabilityWrapper("schedule"))
110+
h.Before("schedule > /api/project/{project_id}/schedules/{schedule_id} > Deletes schedule > 204 > application/json", capabilityWrapper("schedule"))
111+
108112
//Add these last as they normalize the requests and path values after hook processing
109113
h.BeforeAll(func(transactions []*trans.Transaction) {
110114
for _, t := range transactions {

api-docs.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,13 @@ parameters:
470470
type: integer
471471
required: true
472472
x-example: 8
473+
schedule_id:
474+
name: schedule_id
475+
description: schedule ID
476+
in: path
477+
type: integer
478+
required: true
479+
x-example: 9
473480
paths:
474481
/ping:
475482
get:
@@ -509,22 +516,6 @@ paths:
509516
schema:
510517
$ref: "#/definitions/InfoType"
511518

512-
# /upgrade:
513-
# get:
514-
# summary: Check if new updates available and fetch /info
515-
# responses:
516-
# 204:
517-
# description: no update
518-
# 200:
519-
# description: ok
520-
# schema:
521-
# $ref: "#/definitions/InfoType"
522-
# post:
523-
# summary: Upgrade the server
524-
# responses:
525-
# 200:
526-
# description: Server binary was replaced by new version, server has shut down.
527-
528519
# Authentication
529520
/auth/login:
530521
post:
@@ -1228,6 +1219,40 @@ paths:
12281219

12291220

12301221
# project schedules
1222+
/project/{project_id}/schedules/{schedule_id}:
1223+
parameters:
1224+
- $ref: "#/parameters/project_id"
1225+
- $ref: "#/parameters/schedule_id"
1226+
get:
1227+
tags:
1228+
- schedule
1229+
summary: Get schedule
1230+
responses:
1231+
200:
1232+
description: Schedule
1233+
schema:
1234+
$ref: "#/definitions/Schedule"
1235+
delete:
1236+
tags:
1237+
- schedule
1238+
summary: Deletes schedule
1239+
responses:
1240+
204:
1241+
description: schedule deleted
1242+
put:
1243+
tags:
1244+
- schedule
1245+
summary: Updates schedule
1246+
parameters:
1247+
- name: schedule
1248+
in: body
1249+
required: true
1250+
schema:
1251+
$ref: "#/definitions/ScheduleRequest"
1252+
responses:
1253+
204:
1254+
description: schedule updated
1255+
12311256
/project/{project_id}/schedules:
12321257
parameters:
12331258
- $ref: "#/parameters/project_id"

db/sql/schedule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (d *SqlDb) GetSchedule(projectID int, scheduleID int) (template db.Schedule
4848
}
4949

5050
func (d *SqlDb) DeleteSchedule(projectID int, scheduleID int) error {
51-
_, err := d.exec("delete project__schedule where project_id=? and id=?", projectID, scheduleID)
51+
_, err := d.exec("delete from project__schedule where project_id=? and id=?", projectID, scheduleID)
5252
return err
5353
}
5454

0 commit comments

Comments
 (0)