model

package
v0.0.0-...-a167b32 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthDataSourceTypeUser         = AuthDataSourceType("user")         // User
	AuthDataSourceTypeNutritionist = AuthDataSourceType("nutritionist") // Nutritionist
)

AuthDataSourceType values

View Source
const (
	ChatBotDialogStatusInitial    = ChatBotDialogStatus(1) // Initial
	ChatBotDialogStatusInProgress = ChatBotDialogStatus(2) // InProgress
	ChatBotDialogStatusCanceled   = ChatBotDialogStatus(3) // Canceled
	ChatBotDialogStatusCompleted  = ChatBotDialogStatus(4) // Completed
)

ChatBotDialogStatus values

View Source
const (
	NutritionistCreatedByChatbot = NutritionistCreatedBy("chatbot") // Chatbot
	NutritionistCreatedByAPI     = NutritionistCreatedBy("api")     // API
)

NutritionistCreatedBy values

View Source
const (
	GenderMale   = Gender(1) // Male
	GenderFemale = Gender(2) // Female
)

Gender values

View Source
const (
	PhysicalActivityLevelLow    = PhysicalActivityLevel(1) // Low
	PhysicalActivityLevelMedium = PhysicalActivityLevel(2) // Medium
	PhysicalActivityLevelHigh   = PhysicalActivityLevel(3) // High
)

PhysicalActivityLevel values

View Source
const (
	UserCreatedByChatbot = UserCreatedBy("chatbot") // Chatbot
	UserCreatedByAPI     = UserCreatedBy("api")     // API
)

UserCreatedBy values

View Source
const (
	AIAPILogsSourceTypeChatbotDialog = AIAPILogsSourceType("chatbot_dialog") // ChatbotDialog
)

AIAPILogsSourceType values

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(hash, password string) bool

func HashPassword

func HashPassword(password string) (string, error)

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

func (AIAPILog) DbTable

func (AIAPILog) DbTable() string

DbTable returns DB table name

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

func (AuthData) DbTable

func (AuthData) DbTable() string

DbTable returns DB table name

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

func (ChatBotDialog) DbTable

func (ChatBotDialog) DbTable() string

DbTable returns DB table name

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

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

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 Gender

type Gender int32

Gender is type for person gender

func (Gender) DescriptionRu

func (g Gender) DescriptionRu() string

func (Gender) String

func (i Gender) 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 MealsAndSnacksNumber struct {
	MealsNumberPerDay  int `json:"meals"`
	SnacksNumberPerDay int `json:"snacks"`
}

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

func (Nutritionist) DbTable

func (Nutritionist) DbTable() string

DbTable returns DB table name

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) DbTable

func (User) DbTable() string

DbTable returns DB table name

func (User) IsFilledForGetDiet

func (u User) IsFilledForGetDiet() bool

IsFilledForGetDiet returns true if data is filled for diet

type UserCreatedBy

type UserCreatedBy string

UserCreatedBy is type for User CreatedBy field

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

Jump to

Keyboard shortcuts

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