56 lines
3.0 KiB
Go
56 lines
3.0 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
// ExamPrepCatalogCourse stores the makeup academy catalog under the legacy exam_prep schema.
|
|
type ExamPrepCatalogCourse struct {
|
|
Price float64 `json:"price"`
|
|
Currency string `json:"currency"`
|
|
IsArchived bool `json:"is_archived"`
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Description *string `json:"description,omitempty"`
|
|
Category string `json:"-"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
SortOrder int `json:"sort_order"`
|
|
PublishStatus ContentPublishStatus `json:"publish_status"`
|
|
AccessTier ContentAccessTier `json:"access_tier"`
|
|
EffectiveAccessTier ContentAccessTier `json:"effective_access_tier,omitempty"`
|
|
UnitsCount *int64 `json:"chapters_count,omitempty"`
|
|
ModulesCount *int64 `json:"-"`
|
|
LessonsCount *int64 `json:"lessons_count,omitempty"`
|
|
HasPractice bool `json:"has_practice"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
|
}
|
|
|
|
// VisibleToLearners is true when the catalog course appears in student/learner exam-prep APIs.
|
|
func (c ExamPrepCatalogCourse) VisibleToLearners() bool {
|
|
return !c.IsArchived && c.PublishStatus == ContentPublishPublished
|
|
}
|
|
|
|
type CreateExamPrepCatalogCourseInput struct {
|
|
Price float64 `json:"price" validate:"min=0,max=9999999999.99"`
|
|
Currency string `json:"currency" validate:"omitempty,len=3,alpha,uppercase"`
|
|
Name string `json:"name" validate:"required"`
|
|
Description *string `json:"description,omitempty"`
|
|
Category string `json:"-"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
// Omit or empty defaults to DRAFT; set PUBLISHED to make visible to learners immediately.
|
|
PublishStatus *string `json:"publish_status,omitempty" validate:"omitempty,oneof=DRAFT draft PUBLISHED published"`
|
|
AccessTier *string `json:"access_tier,omitempty" validate:"omitempty,oneof=FREE free PREMIUM premium"`
|
|
}
|
|
|
|
type UpdateExamPrepCatalogCourseInput struct {
|
|
Price *float64 `json:"price,omitempty" validate:"omitempty,min=0,max=9999999999.99"`
|
|
Currency *string `json:"currency,omitempty" validate:"omitempty,len=3,alpha,uppercase"`
|
|
Name *string `json:"name,omitempty"`
|
|
Description *string `json:"description,omitempty"`
|
|
Category *string `json:"-"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
SortOrder *int `json:"sort_order,omitempty"`
|
|
PublishStatus *string `json:"publish_status,omitempty" validate:"omitempty,oneof=DRAFT draft PUBLISHED published"`
|
|
AccessTier *string `json:"access_tier,omitempty" validate:"omitempty,oneof=FREE free PREMIUM premium"`
|
|
}
|