2023-05-06 12:49:40 +01:00
|
|
|
package board
|
|
|
|
|
|
|
|
// Card represents a card on a Kanban board.
|
|
|
|
type Card struct {
|
2024-01-14 13:46:42 +00:00
|
|
|
ID int
|
|
|
|
Title string
|
2024-01-10 12:12:54 +00:00
|
|
|
Description string
|
2024-01-14 13:46:42 +00:00
|
|
|
Created string
|
2023-05-06 12:49:40 +01:00
|
|
|
}
|
|
|
|
|
2024-01-21 15:39:51 +00:00
|
|
|
// SetID updates the ID of the Card value only if
|
|
|
|
// the ID is < 1 (i.e. unset).
|
|
|
|
func (c *Card) SetID(id int) error {
|
|
|
|
if id < 1 {
|
|
|
|
return InvalidIDError{id}
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.ID > 0 {
|
|
|
|
return IDAlreadySetError{}
|
|
|
|
}
|
|
|
|
|
2023-05-06 12:49:40 +01:00
|
|
|
c.ID = id
|
2024-01-21 15:39:51 +00:00
|
|
|
|
|
|
|
return nil
|
2023-05-06 12:49:40 +01:00
|
|
|
}
|
|
|
|
|
2024-01-21 15:39:51 +00:00
|
|
|
// GetID returns the ID of the Card value.
|
|
|
|
func (c *Card) GetID() int {
|
2023-05-06 12:49:40 +01:00
|
|
|
return c.ID
|
|
|
|
}
|