1
0

feat(views): sort tasks by their position relative to the view they're in

This commit is contained in:
kolaente
2024-03-14 22:55:18 +01:00
parent 2502776460
commit d1d07f462c
6 changed files with 53 additions and 6 deletions

View File

@ -18,8 +18,9 @@ package models
type (
sortParam struct {
sortBy string
orderBy sortOrder // asc or desc
sortBy string
orderBy sortOrder // asc or desc
projectViewID int64
}
sortOrder string
@ -72,5 +73,10 @@ func (sp *sortParam) validate() error {
if sp.orderBy != orderDescending && sp.orderBy != orderAscending {
return ErrInvalidSortOrder{OrderBy: sp.orderBy}
}
if sp.sortBy == taskPropertyPosition && sp.projectViewID == 0 {
return ErrMustHaveProjectViewToSortByPosition{}
}
return validateTaskField(sp.sortBy)
}