answerer/model/model.go

134 lines
4.7 KiB
Go

package model
import "time"
const TypeText = "text"
type Quiz struct {
Id uint64 `json:"id"`
Qid string `json:"qid"` // uuid for secure data get and post
AccountId string `json:"accountid"` // account that created the quiz
Deleted bool `json:"deleted"` // fake delete field
Archived bool `json:"archived"` // field for archiving quiz
Fingerprinting bool `json:"fingerprinting"` // field that need for storing device id
Repeatable bool `json:"repeatable"` // make it true for allow more than one quiz checkouting
NotePrevented bool `json:"note_prevented"` // note answers even if the quiz was aborted
MailNotifications bool `json:"mail_notifications"` // set true if you want get an email with every quiz passing
UniqueAnswers bool `json:"unique_answers"` // set true if we you mention only last quiz passing
Name string `json:"name"`
Description string `json:"description"`
Config string `json:"config"` // serialize json with config for page rules
Status string `json:"status"` // status of quiz as enum. see Status const higher
Limit uint64 `json:"limit"` // max count of quiz passing
DueTo uint64 `json:"due_to"` // time when quiz is end
TimeOfPassing uint64 `json:"time_of_passing"` // amount of seconds for give all appropriate answers for quiz
Pausable bool `json:"pausable"` // true allows to pause the quiz taking
Version int `json:"version"`
VersionComment string `json:"version_comment"`
ParentIds []int32 `json:"parent_ids"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
QuestionsCount uint64 `json:"questions_count"`
SessionCount uint64 `json:"session_count"`
PassedCount uint64 `json:"passed_count"`
AverageTime uint64 `json:"average_time"`
Super bool `json:"super"`
GroupId uint64 `json:"group_id"`
GigaChat bool `json:"giga_chat"`
}
type Question struct {
Id uint64 `json:"id"`
QuizId uint64 `json:"quiz_id"` // relation to quiz table
Title string `json:"title"` // title of question
Description string `json:"description"` // html\text representation of question and question description for answerer
Type string `json:"type"` // type field. enum with constants from consts higher
Required bool `json:"required"` // answerer must answer this question
Deleted bool `json:"deleted"` // fake deleting field
Page int `json:"page"` // set page number for question
//serialized json. caption for button type, array of key-value pairs for checkbox and select types,
// placeholder and input title for text and file types
Content string `json:"content"`
Version int `json:"version"`
//todo check the best choice: question duplication and no statistics about the most unstable question or
//low performance of high complexity join-on-array query
ParentIds []int32 `json:"parent_ids"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Session string `json:"session"`
Auditory int64 `json:"auditory"`
}
type Answer struct {
Id uint64
Content string `json:"content"` //serialized json. empty for buttons
QuestionId uint64 `json:"question_id"` // relation for quiz
QuizId uint64 // relation for quiz
Fingerprint string // device Id
Session string // xid of session
Result bool
CreatedAt time.Time
New bool `json:"new"`
Deleted bool
Email string
DeviceType string
Device string
Browser string
IP string
OS string
Start bool
Utm UTMSavingMap
Version int32
}
type UTMSavingMap map[string]string
type ResultContent struct {
Text string `json:"text"`
Name string `json:"name"`
Email string `json:"email"`
Phone string `json:"phone"`
Address string `json:"address"`
Telegram string `json:"telegram"`
Wechat string `json:"wechat"`
Viber string `json:"viber"`
Vk string `json:"vk"`
Skype string `json:"skype"`
Whatsup string `json:"whatsup"`
Messenger string `json:"messenger"`
Custom map[string]string `json:"customs"`
Start bool `json:"start"`
//IMGContent ImageContent `json:"imagecontent"`
}
type QuizConfig struct {
Mailing ResultInfo `json:"resultInfo"`
}
type ResultInfo struct {
When string `json:"when"` // before|after|email
Theme string `json:"theme"` // тема письма
Reply string `json:"reply"` // email для ответов, указывается в создании письма
ReplName string `json:"repl_name"` // имя отправителя
}