1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-09-16 08:56:19 +02:00

Boards as persisted category (#3877)

* WIP

* WIP

* Removed unused webapp util

* Added server tests

* Lint fix

* Updating existing tests

* Updating existing tests

* Updating existing tests

* Fixing existing tests

* Fixing existing tests

* Fixing existing tests

* Added category type and tests

* updated tests

* Fixed integration test

* type fix

* removed seconds from boards name

* wip

* debugging cy test

* Fixed a bug preventing users from collapsing boards category

* Debugging cypress test

* CI

* debugging cy test

* Testing a fix

* reverting test fix

* Handled personal server

* Fixed a case for personal server

* fixed a test
This commit is contained in:
Harshil Sharma
2022-10-26 16:38:03 +05:30
committed by GitHub
parent ba792191cd
commit 8d17dd820e
27 changed files with 746 additions and 304 deletions

View File

@@ -2,12 +2,18 @@ package model
import (
"encoding/json"
"fmt"
"io"
"strings"
"github.com/mattermost/focalboard/server/utils"
)
const (
CategoryTypeSystem = "system"
CategoryTypeCustom = "custom"
)
// Category is a board category
// swagger:model
type Category struct {
@@ -42,12 +48,19 @@ type Category struct {
// Category's state in client side
// required: true
Collapsed bool `json:"collapsed"`
// Category's type
// required: true
Type string `json:"type"`
}
func (c *Category) Hydrate() {
c.ID = utils.NewID(utils.IDTypeNone)
c.CreateAt = utils.GetMillis()
c.UpdateAt = c.CreateAt
if c.Type == "" {
c.Type = CategoryTypeCustom
}
}
func (c *Category) IsValid() error {
@@ -67,6 +80,10 @@ func (c *Category) IsValid() error {
return NewErrInvalidCategory("category team id ID cannot be empty")
}
if c.Type != CategoryTypeCustom && c.Type != CategoryTypeSystem {
return NewErrInvalidCategory(fmt.Sprintf("category type is invalid. Allowed types: %s and %s", CategoryTypeSystem, CategoryTypeCustom))
}
return nil
}