Documentation ¶
Index ¶
- Constants
- func CheckPasswordHash(hash, password string) bool
- func HashPassword(password string) (string, error)
- type AIAPILog
- type AIAPILogsSourceType
- type AuthData
- type AuthDataSourceType
- type ChatBotDialog
- type ChatBotDialogDataGetDietFromAI
- type ChatBotDialogDataUserRegistration
- type ChatBotDialogKind
- type ChatBotDialogStatus
- type Gender
- type GetDietParams
- type MealsAndSnacksNumber
- type Nutritionist
- type NutritionistCreatedBy
- type PhysicalActivityLevel
- type User
- type UserCreatedBy
- type UserToRegister
- type UserToSignIn
Constants ¶
const ( AuthDataSourceTypeUser = AuthDataSourceType("user") // User AuthDataSourceTypeNutritionist = AuthDataSourceType("nutritionist") // Nutritionist )
AuthDataSourceType values
const ( ChatBotDialogStatusInitial = ChatBotDialogStatus(1) // Initial ChatBotDialogStatusInProgress = ChatBotDialogStatus(2) // InProgress ChatBotDialogStatusCanceled = ChatBotDialogStatus(3) // Canceled ChatBotDialogStatusCompleted = ChatBotDialogStatus(4) // Completed )
ChatBotDialogStatus values
const ( NutritionistCreatedByChatbot = NutritionistCreatedBy("chatbot") // Chatbot NutritionistCreatedByAPI = NutritionistCreatedBy("api") // API )
NutritionistCreatedBy values
const ( GenderMale = Gender(1) // Male GenderFemale = Gender(2) // Female )
Gender values
const ( PhysicalActivityLevelLow = PhysicalActivityLevel(1) // Low PhysicalActivityLevelMedium = PhysicalActivityLevel(2) // Medium PhysicalActivityLevelHigh = PhysicalActivityLevel(3) // High )
PhysicalActivityLevel values
const ( UserCreatedByChatbot = UserCreatedBy("chatbot") // Chatbot UserCreatedByAPI = UserCreatedBy("api") // API )
UserCreatedBy values
const (
AIAPILogsSourceTypeChatbotDialog = AIAPILogsSourceType("chatbot_dialog") // ChatbotDialog
)
AIAPILogsSourceType values
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func HashPassword ¶
Types ¶
type AIAPILog ¶
type AIAPILog struct { ID uuid.UUID `db:"id"` Prompt string `db:"prompt"` Response *string `db:"response"` UserID uuid.UUID `db:"user_id"` SourceID uuid.UUID `db:"source_id"` SourceType AIAPILogsSourceType `db:"source_type"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
AIAPILog is model for AI API Logs
type AIAPILogsSourceType ¶
type AIAPILogsSourceType string
AIAPILogsSourceType is type for AIAPILogs SourceType field
type AuthData ¶
type AuthData struct { SourceID uuid.UUID `db:"source_id"` SourceType AuthDataSourceType `db:"source_type"` Password string `db:"password"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
AuthData is model for authentication data
type AuthDataSourceType ¶
type AuthDataSourceType string
AuthDataSourceType is source type for authentication
type ChatBotDialog ¶
type ChatBotDialog struct { ID uuid.UUID `db:"id"` UserTelegramID int64 `db:"user_telegram_id"` Kind ChatBotDialogKind `db:"kind"` Status ChatBotDialogStatus `db:"status"` DataJSON string `db:"data"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
ChatBotDialog is chatbot dialogs with user
type ChatBotDialogDataGetDietFromAI ¶
type ChatBotDialogDataGetDietFromAI struct { Params GetDietParams `json:"params"` NeedOrder *bool `json:"need_order,omitempty"` }
ChatBotDialogDataGetDietFromAI .
func (*ChatBotDialogDataGetDietFromAI) FromJSON ¶
func (data *ChatBotDialogDataGetDietFromAI) FromJSON(s string) error
FromJSON unmarshals data form JSON string
func (*ChatBotDialogDataGetDietFromAI) ToJSON ¶
func (data *ChatBotDialogDataGetDietFromAI) ToJSON() string
ToJSON marshals data to JSON string
type ChatBotDialogDataUserRegistration ¶
type ChatBotDialogDataUserRegistration struct { Name *string `json:"name,omitempty"` Age *int `json:"age,omitempty"` Weight *int `json:"weight,omitempty"` Height *int `json:"height,omitempty"` Gender *Gender `json:"gender,omitempty"` PhysicalActivity *PhysicalActivityLevel `json:"physical_activity_level,omitempty"` }
ChatBotDialogDataUserRegistration .
func (*ChatBotDialogDataUserRegistration) FromJSON ¶
func (data *ChatBotDialogDataUserRegistration) FromJSON(s string) error
FromJSON unmarshals data form JSON string
func (*ChatBotDialogDataUserRegistration) IsFilled ¶
func (data *ChatBotDialogDataUserRegistration) IsFilled() bool
IsFilled returns true if all fields are filled
func (*ChatBotDialogDataUserRegistration) ToJSON ¶
func (data *ChatBotDialogDataUserRegistration) ToJSON() string
ToJSON marshals data to JSON string
type ChatBotDialogKind ¶
type ChatBotDialogKind string
ChatBotDialogKind is type for ChatBotDialog kind
const ( ChatBotDialogKindUserRegistration ChatBotDialogKind = "UserRegistration" // UserRegistration ChatBotDialogKindGetDietFromAI ChatBotDialogKind = "GetDietFromAI" // GetDietFromAI )
ChatBotDialogKind values
type ChatBotDialogStatus ¶
type ChatBotDialogStatus int32
ChatBotDialogStatus is type for ChatBotDialog status
func (ChatBotDialogStatus) String ¶
func (i ChatBotDialogStatus) String() string
type GetDietParams ¶
type GetDietParams struct { Age int `json:"age"` Weight int `json:"weight"` Height int `json:"height"` Gender Gender `json:"gender"` PhysicalActivity PhysicalActivityLevel `json:"physical_activity"` MealsAndSnacksNumber }
type MealsAndSnacksNumber ¶
type Nutritionist ¶
type Nutritionist struct { ID uuid.UUID `json:"id" db:"id"` Name string `json:"name" db:"name"` Email *string `json:"email" db:"email"` Phone *string `json:"phone" db:"phone"` TelegramID *int64 `json:"telegram_id" db:"telegram_id"` Age *int `json:"age" db:"age"` Gender *Gender `json:"gender" db:"gender"` Info *string `json:"info" db:"info"` CreatedBy NutritionistCreatedBy `json:"created_by" db:"created_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
Nutritionist is model for nutritionist
type NutritionistCreatedBy ¶
type NutritionistCreatedBy string
NutritionistCreatedBy is type for Nutritionist CreatedBy field
type PhysicalActivityLevel ¶
type PhysicalActivityLevel int32
PhysicalActivityLevel is type for person physical activity level
func (PhysicalActivityLevel) DescriptionRu ¶
func (l PhysicalActivityLevel) DescriptionRu() string
func (PhysicalActivityLevel) String ¶
func (i PhysicalActivityLevel) String() string
type User ¶
type User struct { ID uuid.UUID `json:"id" db:"id"` Name string `json:"name" db:"name"` Email *string `json:"email" db:"email"` Phone *string `json:"phone" db:"phone"` TelegramID *int64 `json:"telegram_id" db:"telegram_id"` Age *int `json:"age" db:"age"` Weight *int `json:"weight" db:"weight"` Height *int `json:"height" db:"height"` Gender *Gender `json:"gender" db:"gender"` PhysicalActivity *PhysicalActivityLevel `json:"physical_activity_level" db:"physical_activity_level"` CreatedBy UserCreatedBy `json:"created_by" db:"created_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
User is model for user
func (User) IsFilledForGetDiet ¶
IsFilledForGetDiet returns true if data is filled for diet
type UserToRegister ¶
type UserToRegister struct { Name string `json:"name" binding:"required"` Email string `json:"email" binding:"required"` Phone string `json:"phone"` Age int `json:"age" binding:"required"` Weight int `json:"weight" binding:"required"` Height int `json:"height" binding:"required"` Gender Gender `json:"gender" binding:"required"` Password string `json:"password" binding:"required"` }
UserToRegister is model for registering user
type UserToSignIn ¶
type UserToSignIn struct { Email string `json:"email" binding:"required"` Password string `json:"password" binding:"required"` }
UserToSignIn is model for user sign-in