Preserve append-after-max ordering when omitting sort_order and keep global uniqueness enforced by DB. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.2 KiB
Go
31 lines
1.2 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
// Program is the top-level container in the LMS hierarchy (e.g. tracks like Beginner / Intermediate / Advanced).
|
|
type Program struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Description *string `json:"description,omitempty"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
SortOrder int `json:"sort_order"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
}
|
|
|
|
type CreateProgramInput struct {
|
|
Name string `json:"name" validate:"required"`
|
|
Description *string `json:"description,omitempty"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
// SortOrder inserts at this global program order when set; omit to append after current max (sort_order uniqueness is enforced).
|
|
SortOrder *int `json:"sort_order,omitempty" validate:"omitempty,min=0"`
|
|
}
|
|
|
|
type UpdateProgramInput struct {
|
|
Name *string `json:"name,omitempty"`
|
|
Description *string `json:"description,omitempty"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
SortOrder *int `json:"sort_order,omitempty"`
|
|
}
|