telegram/models/models.v
2024-08-18 11:37:44 +03:00

53 lines
1.6 KiB
V
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module models
// структуры объявляются в принципе как в гошке, заисключением того что видимо взято из С происходит деление на публичные и приватные
// поэтому для того чтобы реализовать инкапсуляцию, если указать ключевое слово pub - будет все доступно
pub struct Button {
pub mut:
text string @[json: 'Text']
state string @[json: 'State']
}
pub struct Question {
pub mut:
title string @[json: 'Title']
description string @[json: 'Description']
buttons []Button @[json: 'Buttons']
}
@[table: 'question']
pub struct QuizQuestion {
pub mut:
id i64 @[primary; sql: serial]
quiz_id i64 @[sql: 'quiz_id']
title string @[sql: 'title']
description string @[sql: 'description']
question_type string @[sql: 'questiontype']
content string @[sql: 'content']
required bool @[sql: 'required']
deleted bool @[sql: 'deleted']
}
@[table: 'telegram_integration']
pub struct TelegramIntegration {
pub mut:
id i64 @[primary; sql: serial]
account_id string @[sql: 'accountid']
quiz_id i64 @[sql: 'quizid']
bot_token string @[sql: 'bot_token']
repeatable bool @[sql: 'repeatable']
bot_name string @[sql: 'bot_name']
deleted bool @[sql: 'deleted']
}
@[table: 'respondent_state']
pub struct RespondentState {
pub mut:
id i64 @[primary; sql: serial]
telegram_id i64 @[sql: 'telegram_id']
quiz_id i64 @[sql: 'quizid']
state string @[sql: 'state']
lang string @[sql: 'lang']
contact string @[sql: 'contact']
finish bool @[sql: 'finish']
}