presentation

package
v0.0.0-...-9b60b69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoRole  Role = "NO_ROLE"
	Admin        = "ADMIN"
	Teacher      = "TEACHER"
	Student      = "STUDENT"
	Machine      = "MACHINE"
)

Variables

This section is empty.

Functions

func Errorf

func Errorf(status int, format string, a ...interface{}) error

func GetCodeFromError

func GetCodeFromError(err error) (int, bool)

Types

type ApiController

type ApiController struct {
	// contains filtered or unexported fields
}

func NewApiController

func NewApiController(
	authService *domain.AuthService,
	classService *domain.ClassService,
	quizService *domain.QuizService,
	userService *domain.UserService,
	healthService *domain.HealthService,
	maintenanceService *domain.MaintenanceService) ApiController

func (*ApiController) Serve

func (c *ApiController) Serve()

func (*ApiController) SetReady

func (c *ApiController) SetReady()

type Class

type Class struct {
	Id   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

type ClassRequestBody

type ClassRequestBody struct {
	Name string `json:"name" binding:"required"`
}

type HttpStatusError

type HttpStatusError struct {
	// contains filtered or unexported fields
}

func (*HttpStatusError) Error

func (e *HttpStatusError) Error() string

func (*HttpStatusError) HTTPStatus

func (e *HttpStatusError) HTTPStatus() int

type Quiz

type Quiz struct {
	Sha1      string         `json:"sha1"`
	Filename  string         `json:"filename"`
	Name      string         `json:"name"`
	Version   int            `json:"version"`
	CreatedAt string         `json:"createdAt"`
	Duration  int            `json:"duration"`
	Active    bool           `json:"active"`
	Questions []QuizQuestion `json:"questions,omitempty"`
	Classes   []Class        `json:"classes,omitempty"`
}

type QuizInfos

type QuizInfos interface {
	// contains filtered or unexported methods
}

type QuizQuestion

type QuizQuestion struct {
	Sha1         string               `json:"sha1"`
	Position     int                  `json:"position"`
	Content      string               `json:"content"`
	Code         string               `json:"code,omitempty"`
	CodeLanguage string               `json:"codeLanguage,omitempty"`
	Answers      []QuizQuestionAnswer `json:"answers,omitempty"`
}

type QuizQuestionAnswer

type QuizQuestionAnswer struct {
	Sha1    string `json:"sha1"`
	Content string `json:"content"`
	Checked bool   `json:"checked"`
	Valid   bool   `json:"valid,omitempty"`
}

type QuizSession

type QuizSession struct {
	QuizSha1     string         `json:"quizSha1"`
	Name         string         `json:"name"`
	Duration     int            `json:"duration"`
	Filename     string         `json:"filename,omitempty"`
	Version      int            `json:"version,omitempty"`
	CreatedAt    string         `json:"createdAt,omitempty"`
	SessionId    *uuid.UUID     `json:"sessionId,omitempty"`
	UserId       string         `json:"userId,omitempty"`
	UserName     string         `json:"userName,omitempty"`
	RemainingSec int            `json:"remainingSec,omitempty"`
	Result       *SessionResult `json:"result,omitempty"`
	UserSessions []*UserSession `json:"userSessions,omitempty"`
}

type QuizSessionDetail

type QuizSessionDetail struct {
	SessionId    uuid.UUID      `json:"sessionId"`
	UserId       string         `json:"userId"`
	RemainingSec int            `json:"remainingSec"`
	Result       *SessionResult `json:"result,omitempty"`
	QuizSha1     string         `json:"quizSha1"`
	Name         string         `json:"name"`
	QuizDuration int            `json:"quizDuration"`
	Questions    []QuizQuestion `json:"questions"`
}

type Role

type Role string

type Session

type Session struct {
	Id           uuid.UUID      `json:"id"`
	QuizSha1     string         `json:"quizSha1,omitempty"`
	QuizName     string         `json:"quizName,omitempty"`
	QuizActive   bool           `json:"quizActive,omitempty"`
	UserId       string         `json:"userId,omitempty"`
	UserName     string         `json:"userName,omitempty"`
	RemainingSec int            `json:"remainingSec,omitempty"`
	Result       *SessionResult `json:"result,omitempty"`
}

type SessionAnswerRequestBody

type SessionAnswerRequestBody struct {
	QuestionSha1 string `json:"questionSha1" binding:"required"`
	AnswerSha1   string `json:"answerSha1" binding:"required"`
	Checked      bool   `json:"checked"`
}

type SessionResult

type SessionResult struct {
	GoodAnswer  int `json:"goodAnswer,omitempty"`
	TotalAnswer int `json:"totalAnswer,omitempty"`
}

type User

type User struct {
	Id      string `json:"id"`
	Login   string `json:"login"`
	Name    string `json:"name"`
	Picture string `json:"picture"`
	Active  bool   `json:"active"`
	Role    Role   `json:"role"`
	Class   *Class `json:"class"`
}

type UserSession

type UserSession struct {
	SessionId    *uuid.UUID     `json:"sessionId"`
	UserId       string         `json:"userId"`
	UserName     string         `json:"userName"`
	Picture      string         `json:"picture"`
	ClassName    string         `json:"className"`
	RemainingSec int            `json:"remainingSec,omitempty"`
	Result       *SessionResult `json:"result,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL