From f429efc220e66955027be9e778ba80b375be9748 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 15 Apr 2021 16:55:21 +0200 Subject: [PATCH] Add bucket limit validation --- pkg/models/kanban.go | 2 +- pkg/swagger/docs.go | 3 ++- pkg/swagger/swagger.json | 3 ++- pkg/swagger/swagger.yaml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/models/kanban.go b/pkg/models/kanban.go index d9dbd6ef..ad2d8bb2 100644 --- a/pkg/models/kanban.go +++ b/pkg/models/kanban.go @@ -37,7 +37,7 @@ type Bucket struct { Tasks []*Task `xorm:"-" json:"tasks"` // How many tasks can be at the same time on this board max - Limit int64 `xorm:"default 0" json:"limit"` + Limit int64 `xorm:"default 0" json:"limit" minimum:"0" valid:"range(0|9223372036854775807)"` // If this bucket is the "done bucket". All tasks moved into this bucket will automatically marked as done. All tasks marked as done from elsewhere will be moved into this bucket. IsDoneBucket bool `xorm:"BOOL" json:"is_done_bucket"` diff --git a/pkg/swagger/docs.go b/pkg/swagger/docs.go index 81c5871b..64750035 100644 --- a/pkg/swagger/docs.go +++ b/pkg/swagger/docs.go @@ -7204,7 +7204,8 @@ var doc = `{ }, "limit": { "description": "How many tasks can be at the same time on this board max", - "type": "integer" + "type": "integer", + "minimum": 0 }, "list_id": { "description": "The list this bucket belongs to.", diff --git a/pkg/swagger/swagger.json b/pkg/swagger/swagger.json index 45bc56c7..90e4a2ba 100644 --- a/pkg/swagger/swagger.json +++ b/pkg/swagger/swagger.json @@ -7187,7 +7187,8 @@ }, "limit": { "description": "How many tasks can be at the same time on this board max", - "type": "integer" + "type": "integer", + "minimum": 0 }, "list_id": { "description": "The list this bucket belongs to.", diff --git a/pkg/swagger/swagger.yaml b/pkg/swagger/swagger.yaml index 6d186120..c52ad481 100644 --- a/pkg/swagger/swagger.yaml +++ b/pkg/swagger/swagger.yaml @@ -91,6 +91,7 @@ definitions: type: boolean limit: description: How many tasks can be at the same time on this board max + minimum: 0 type: integer list_id: description: The list this bucket belongs to.