Documentation ¶
Overview ¶
Package items provides API services for items managing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AskHintRequest ¶
type AskHintRequest struct { TaskToken *token.Task HintToken *token.Hint // contains filtered or unexported fields }
AskHintRequest represents a JSON request body format needed by items.askHint().
func (*AskHintRequest) Bind ¶
func (requestData *AskHintRequest) Bind(_ *http.Request) error
Bind of AskHintRequest checks that the asked hint is present.
func (*AskHintRequest) UnmarshalJSON ¶
func (requestData *AskHintRequest) UnmarshalJSON(raw []byte) error
UnmarshalJSON unmarshals the items/askHint request data from JSON.
type Item ¶
type Item struct { URL *string `json:"url"` Options *string `json:"options" validate:"null|options"` // default: false EntryFrozenTeams bool `json:"entry_frozen_teams"` // default: false NoScore bool `json:"no_score"` // Identifier to reference the task. // Unique TextID *string `json:"text_id"` DisplayDetailsInParent bool `json:"display_details_in_parent"` ReadOnly bool `json:"read_only"` // enum: List,Grid ChildrenLayout string `json:"children_layout"` // enum: forceYes,forceNo,default FullScreen string `json:"full_screen" validate:"oneof=forceYes forceNo default"` HintsAllowed bool `json:"hints_allowed"` FixedRanks bool `json:"fixed_ranks"` // enum: None,All,AllButOne,Categories,One,Manual // default: All ValidationType string `json:"validation_type" validate:"oneof=None All AllButOne Categories One Manual"` // enum: All,Half,One,None // default: None EntryMinAdmittedMembersRatio string `json:"entry_min_admitted_members_ratio" validate:"oneof=All Half One None"` EnteringTimeMin time.Time `json:"entering_time_min"` EnteringTimeMax time.Time `json:"entering_time_max"` EntryMaxTeamSize int32 `json:"entry_max_team_size"` TitleBarVisible bool `json:"title_bar_visible"` AllowsMultipleAttempts bool `json:"allows_multiple_attempts"` // enum: User,Team EntryParticipantType string `json:"entry_participant_type" validate:"oneof=User Team"` // MySQL time (max value is 838:59:59), cannot be set for skills // pattern: ^\d{1,3}:[0-5]?\d:[0-5]?\d$ // example: 838:59:59 Duration *string `json:"duration" validate:"omitempty,duration,cannot_be_set_for_skills,duration_requires_explicit_entry"` // should be true when the duration is not null, cannot be set for skill items RequiresExplicitEntry bool `json:"requires_explicit_entry" validate:"cannot_be_set_for_skills,duration_requires_explicit_entry"` ShowUserInfos bool `json:"show_user_infos"` UsesAPI bool `json:"uses_api"` PromptToJoinGroupByCode bool `json:"prompt_to_join_group_by_code"` }
Item represents input fields that are common to itemCreate & itemUpdate.
type ItemPath ¶
type ItemPath struct { // required:true Path []string `json:"path"` // required:true IsStarted bool `json:"is_started"` }
ItemPath represents a path to an item. swagger:model ItemPath
func FindItemPaths ¶
func FindItemPaths( store *database.DataStore, user *database.User, participantID, itemID int64, pathRootBy PathRootType, limit int, ) []ItemPath
FindItemPaths gets the paths to an item for a participant.
The root items are determined either by participant: PathRootParticipant, or by user PathRootUser. This comes from the initial distinction between `path_from_root`: participant, and `breadcrumbs_from_root`: user.
When {limit}=0, return all the paths.
type ItemWithDefaultLanguageTag ¶
type ItemWithDefaultLanguageTag struct { Item `json:"item,squash"` //nolint:staticcheck SA5008: unknown JSON option "squash" // new `default_language_tag` of the item can only be set to a language // for that an `items_strings` row exists // minLength: 1 // maxLength: 6 DefaultLanguageTag string `json:"default_language_tag" validate:"min=1,max=6"` }
ItemWithDefaultLanguageTag represents common item fields plus 'default_language_tag'.
type ItemWithRequiredType ¶
type ItemWithRequiredType struct { Item `json:"item,squash"` //nolint:staticcheck SA5008: unknown JSON option "squash" // Can be equal to 'Skill' only if the parent's type is 'Skill' // required: true // enum: Chapter,Task,Skill Type string `json:"type" validate:"set,oneof=Chapter Task Skill,type_skill"` }
ItemWithRequiredType represents common item fields plus the required type field.
type NewItemRequest ¶
type NewItemRequest struct { // `default_language_tag` of the item // required: true LanguageTag string `json:"language_tag" validate:"set,language_tag"` Parent itemParent `json:"parent"` AsRootOfGroupID int64 `json:"as_root_of_group_id,string" validate:"as_root_of_group_id"` ItemWithRequiredType `json:"item,squash"` //nolint:staticcheck SA5008: unknown JSON option "squash" Children []itemChild `json:"children" validate:"children,children_allowed,dive,child_type_non_skill"` // contains filtered or unexported fields }
NewItemRequest is the expected input for new created item swagger:model itemCreateRequest
type PathRootType ¶
type PathRootType int
PathRootType is used for FindItemPaths. It allows finding the roots either by participant, or by user.
const ( // PathRootParticipant is used by FindItemPaths() to specify that we want to get root items from groups managed by the participant. PathRootParticipant PathRootType = iota // PathRootUser is used by FindItemPaths() to specify that we want to get root items from groups managed by the user. // The only service using this is itemBreadcrumbsFromRootsByTextIdGet which seems to be a mistake. PathRootUser )
type Permission ¶
type Permission struct { ItemID int64 CanViewGeneratedValue int CanGrantViewGeneratedValue int CanWatchGeneratedValue int CanEditGeneratedValue int }
Permission represents item permissions + ItemID.
type RawCommonItemFields ¶
type RawCommonItemFields struct { // items ID int64 Type string DisplayDetailsInParent bool ValidationType string EntryParticipantType string EnteringTimeMin database.Time EnteringTimeMax database.Time AllowsMultipleAttempts bool Duration *string NoScore bool DefaultLanguageTag string RequiresExplicitEntry bool *database.RawGeneratedPermissionFields }
RawCommonItemFields represents DB data fields that are common for itemView & itemChildrenView.
type RawItemResultFields ¶
type RawItemResultFields struct { // results AttemptID *int64 ScoreComputed float32 Validated bool StartedAt *database.Time LatestActivityAt database.Time EndedAt *database.Time // attempts AttemptAllowsSubmissionsUntil database.Time }
RawItemResultFields represents DB data fields for item results used by itemNavigationView & itemChildrenView.
type RawListItem ¶
type RawListItem struct { *RawCommonItemFields // from items_strings: in the user’s default language or (if not available) default language of the item StringLanguageTag string `sql:"column:language_tag"` StringTitle *string `sql:"column:title"` StringImageURL *string `sql:"column:image_url"` StringSubtitle *string `sql:"column:subtitle"` // items_items Category string Order int32 `sql:"column:child_order"` // max from results of the current participant BestScore float32 *RawItemResultFields *RawWatchedGroupStatFields }
RawListItem contains raw fields common for itemChildrenView & itemParentsView.
type RawWatchedGroupStatFields ¶
type RawWatchedGroupStatFields struct { CanWatchForGroupResults bool WatchedGroupCanView int WatchedGroupAvgScore float32 WatchedGroupAllValidated bool }
RawWatchedGroupStatFields represents DB data fields for watched group stats used by itemNavigationView & itemChildrenView.
Source Files ¶
- apply_dependency.go
- ask_hint.go
- create_attempt.go
- create_dependency.go
- create_item.go
- delete_dependency.go
- delete_item.go
- end_attempt.go
- enter.go
- generate_task_token.go
- get_activity_log.go
- get_breadcrumbs.go
- get_breadcrumbs_from_roots.go
- get_children.go
- get_dependencies.go
- get_entry_state.go
- get_item.go
- get_navigation.go
- get_parents.go
- get_prerequisites.go
- items.go
- list_attempts.go
- list_official_sessions.go
- navigation_data_mapper.go
- path_from_root.go
- publish_result.go
- raw_common_item_fields.go
- raw_item_result_fields.go
- raw_watched_group_stat_fields.go
- save_grade.go
- search_for_items.go
- start_result.go
- start_result_path.go
- update_item.go
- update_item_string.go
- update_result.go