model

package
v0.0.0-...-ea178e4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNotStarted = "not_started"
	StatusInProgress = "in_progress"
	StatusFinished   = "finished"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	AnswerType AnswerType `json:"answer_type"`
	Answer     string     `json:"answer"`
}

type AnswerContent

type AnswerContent []string

func (*AnswerContent) Scan

func (a *AnswerContent) Scan(value interface{}) error

Scan Make the Attrs struct implement the sql.Scanner interface. This method simply decodes a JSON-encoded Value into the struct fields.

func (*AnswerContent) Value

func (a *AnswerContent) Value() (driver.Value, error)

Value Make the Attrs struct implement the driver.Valuer interface. This method simply returns the JSON-encoded representation of the struct.

type AnswerType

type AnswerType string
const (
	AnswerText AnswerType = "text"
)

type Assignment

type Assignment struct {
	QuestId     string `json:"quest_id" db:"quest_id"`
	Email       string `json:"email" db:"email"`
	Name        string `json:"name" db:"name"`
	Status      Status `json:"status" db:"status"`
	CurrentStep int    `json:"current_step" db:"current_step"`
}

type Email

type Email string

type LinkedList

type LinkedList struct {
	Head *Node
	// contains filtered or unexported fields
}

LinkedList represents a linked list

func (*LinkedList) Insert

func (l *LinkedList) Insert(val Question)

Insert inserts new node at the end of from linked list

func (*LinkedList) MarshalJSON

func (l *LinkedList) MarshalJSON() ([]byte, error)

type Meta

type Meta struct {
	TotalCount int `json:"total_count,omitempty" db:"total_count"`
}

type Node

type Node struct {
	Value Question
	// contains filtered or unexported fields
}

Node represents a node of linked list

type Owner

type Owner struct {
	ID       string `json:"id,omitempty" db:"id"`
	FullName string `json:"name,omitempty" db:"name"`
}

type Quest

type Quest struct {
	ID           *string     `json:"id" db:"id"`
	Name         *string     `json:"name" db:"name"`
	Description  *string     `json:"description" db:"description"`
	Owner        *string     `json:"owner" db:"owner"`
	Theme        *Theme      `json:"theme" db:"theme"`
	Recipients   []Recipient `json:"recipients"`
	FinalMessage *string     `json:"final_message" db:"final_message"`
	Rewards      *Rewards    `json:"rewards" db:"rewards"`

	CreatedAt *time.Time `json:"created_at" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
}

Quest represents a quest

type QuestAvailable

type QuestAvailable struct {
	QuestId          string `json:"quest_id" db:"quest_id"`
	QuestName        string `json:"quest_name" db:"quest_name"`
	QuestDescription string `json:"quest_description" db:"quest_description"`
	QuestTheme       string `json:"quest_theme" db:"quest_theme"`
	Status           Status `json:"status" db:"status"`
	CurrentStep      int    `json:"steps_current" db:"steps_current"`
	StepsCount       int    `json:"steps_count" db:"steps_count"`
	Owner            *Owner `json:"owner"`
}

type QuestLine

type QuestLine struct {
	QuestId          string `json:"quest_id"`
	QuestName        string `json:"quest_name"`
	QuestDescription string `json:"quest_description"`
	QuestTheme       Theme  `json:"quest_theme"`
	QuestStatus      Status `json:"quest_status"`
	QuestionCount    int    `json:"question_count"`

	IsQuestionAnswerCorrect *bool `json:"success,omitempty"`

	List              *LinkedList `json:"current"`
	PreviousQuestions []Question  `json:"previous"`

	FinalMessage *string  `json:"final_message,omitempty"`
	Rewards      *Rewards `json:"rewards,omitempty"`
}

func (*QuestLine) CheckIfAnswerCorrect

func (ql *QuestLine) CheckIfAnswerCorrect(answer Answer) bool

func (*QuestLine) CurrentStep

func (ql *QuestLine) CurrentStep() int

func (*QuestLine) IsLastStep

func (ql *QuestLine) IsLastStep() bool

func (*QuestLine) Next

func (ql *QuestLine) Next()

type QuestWithSteps

type QuestWithSteps struct {
	Quest
	Steps []Step `json:"steps"`
}

QuestWithSteps represents a quest

func (QuestWithSteps) NewQuestLine

func (q QuestWithSteps) NewQuestLine(currentStep *int, status Status) *QuestLine

type Question

type Question struct {
	ID              *string        `json:"id,omitempty"`
	QuestId         *string        `json:"quest_id"`
	Sort            *int           `json:"sort,omitempty" `
	Description     *string        `json:"description,omitempty"`
	QuestionType    *QuestionType  `json:"question_type"`
	QuestionContent *string        `json:"question_content"`
	AnswerType      *AnswerType    `json:"answer_type"`
	AnswerContent   *AnswerContent `json:"-"`
}

type QuestionType

type QuestionType string
const (
	QuestionText  QuestionType = "text"
	QuestionQR    QuestionType = "qr"
	QuestionSound QuestionType = "sound"
	QuestionImage QuestionType = "image"
)

type Recipient

type Recipient struct {
	QuestId     string `json:"-" db:"quest_id"`
	Email       string `json:"email" db:"email"`
	Name        string `json:"name" db:"name"`
	Status      string `json:"status" db:"status"`
	CurrentStep int    `json:"current_step" db:"current_step"`
}

type Rewards

type Rewards string

func (*Rewards) MarshalJSON

func (r *Rewards) MarshalJSON() ([]byte, error)

func (*Rewards) UnmarshalJSON

func (r *Rewards) UnmarshalJSON(data []byte) error

type SendQuestRequest

type SendQuestRequest struct {
	QuestId string `json:"quest_id" db:"quest_id"`
	Email   string `json:"email" db:"email"`
	Name    string `json:"name" db:"name"`
}

type Status

type Status string

type Step

type Step struct {
	ID              *string        `json:"id,omitempty" db:"id"`
	QuestId         *string        `json:"quest_id" db:"quest_id"`
	Sort            *int           `json:"sort,omitempty" db:"sort"`
	Description     *string        `json:"description,omitempty" db:"description"`
	QuestionType    *QuestionType  `json:"question_type" db:"question_type"`
	QuestionContent *string        `json:"question_content" db:"question_content"`
	AnswerType      *AnswerType    `json:"answer_type" db:"answer_type"`
	AnswerContent   *AnswerContent `json:"answer_content" db:"answer_content"`

	CreatedAt *time.Time `json:"created_at" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
}

type Theme

type Theme string
const (
	ThemeValentain Theme = "valentain"
	ThemeChristmas Theme = "christmas"
	ThemeBirthday  Theme = "birthday"
	ThemeHalloween Theme = "halloween"
	ThemeCommon    Theme = "common"
)

Jump to

Keyboard shortcuts

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