lms-backend/modules/structs/lessons.go

109 lines
2.3 KiB
Go

package structs
import "time"
const (
LessonStateActive = 1
LessonStateDraft = 2
)
type Lesson struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
OrganizationId string `gorm:"type:varchar(36)"`
State uint8 `gorm:"type:tinyint(1)"`
Title string `gorm:"type:varchar(255)"`
ThumbnailUrl string `gorm:"type:varchar(255)"`
CreatorUserId string `gorm:"type:varchar(36)"`
CreatedAt time.Time
UpdatedAt time.Time
}
type LessonContent struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
LessonId string `gorm:"type:varchar(36)"`
Page uint16 `gorm:"type:smallint(5)"` // Page number
Position uint16 `gorm:"type:smallint(5)"` // Position on the page
Type uint8 // Type of content, like text, image, video, etc
Data string `gorm:"type:text"`
CreatedAt time.Time
UpdatedAt time.Time
}
// swagger:model LessonResponse
type LessonResponse struct {
Id string
State uint8
Title string
ThumbnailUrl string
CreatorUserId string
CreatedAt time.Time
}
// swagger:model CreateLessonResponse
type CreateLessonResponse struct {
Id string
}
// swagger:model LessonSettings
type LessonSettings struct {
Title string
ThumbnailUrl string
State uint8
}
// swagger:model UpdateLessonPreviewTitleRequest
type UpdateLessonPreviewTitleRequest struct {
Title string
}
// swagger:model UpdateLessonStateRequest
type UpdateLessonStateRequest struct {
State uint8
}
// swagger:model AddLessonContentRequest
type AddLessonContentRequest struct {
Type uint8
Data string
}
// swagger:model AddLessonContentResponse
type AddLessonContentResponse struct {
Id string
}
// swagger:model UpdateLessonContentRequest
type UpdateLessonContentRequest struct {
Type uint8
Data string
}
// swagger:model UpdateLessonContentResponse
type LessonIdParam struct {
LessonId string
}
type LessonIdAndContentIdParam struct {
LessonId string
ContentId string
}
// swagger:model GetLessonContentsResponse
type GetLessonContentsResponse struct {
Id string
Page uint16
Position uint16
Type uint8
Data string
}
type UpdateLessonContentPositionRequest struct {
Position uint16
}
type UploadLessonContentFileParam struct {
LessonId string
ContentId string
Type string
}