services

package
v0.0.0-...-f4335ee Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatar

type Avatar struct {
	Id        int
	Username  string
	FromColor string
	ToColor   string
}

type AvatarService

type AvatarService struct {
	Avatar      Avatar
	AvatarStore database.DatabaseStore
}

func NewAvatarService

func NewAvatarService(avatar Avatar, avatarStore database.DatabaseStore) *AvatarService

func (*AvatarService) GenerateGradient

func (as *AvatarService) GenerateGradient(username string) map[string]string

type Chat

type Chat struct {
	Id        int    `json:"id"`
	Message   string `json:"message"`
	Sender    string `json:"sender"`
	CreatedAt string `json:"created_at"`
}

type ChatService

type ChatService struct {
	Client    *genai.Client
	Context   context.Context
	Chat      Chat
	ChatStore database.DatabaseStore
	AI        *genai.ChatSession
}

func NewChatService

func NewChatService(chat Chat, store database.DatabaseStore) (*ChatService, error)

func (*ChatService) GenerateResponse

func (cs *ChatService) GenerateResponse(id int, ud string, profile Profile) error

func (*ChatService) GetAllChatsByUserId

func (cs *ChatService) GetAllChatsByUserId(userid int) ([]Chat, error)

func (*ChatService) NewAIChat

func (cs *ChatService) NewAIChat(userid int, message string) error

func (*ChatService) NewUserChat

func (cs *ChatService) NewUserChat(userid int, message string) error

type Entry

type Entry struct {
	ID        int     `json:"id"`
	CreatedAt string  `json:"created_at"`
	Type      string  `json:"type"`
	Status    string  `json:"status"`
	CreatedBy int     `json:"created_by"`
	Value     float64 `json:"value"`
	Month     int     `json:"month"`
	Year      int     `json:"year"`
	Day       int     `json:"day"`
}

type EntryServices

type EntryServices struct {
	Entry      Entry
	EntryStore database.DatabaseStore
}

func NewEntryService

func NewEntryService(entry Entry, store database.DatabaseStore) *EntryServices

func (*EntryServices) CreateEntry

func (es *EntryServices) CreateEntry(user int, typ string, status string, value float64, month, day, year int) error

func (*EntryServices) DeleteEntry

func (es *EntryServices) DeleteEntry(id int) error

func (*EntryServices) GetAllEntriesByDate

func (es *EntryServices) GetAllEntriesByDate(id int, month, day, year int) ([]Entry, error)

func (*EntryServices) GetAllEntriesByMonth

func (es *EntryServices) GetAllEntriesByMonth(id int, month, year int) ([]Entry, error)

func (*EntryServices) GetAllEntriesByUser

func (es *EntryServices) GetAllEntriesByUser(id int) ([]Entry, error)

func (*EntryServices) GetEntryByID

func (es *EntryServices) GetEntryByID(id int) (Entry, error)

func (*EntryServices) GetFormattedEntriesByUser

func (es *EntryServices) GetFormattedEntriesByUser(userID int) (string, error)

type FormattedEntry

type FormattedEntry struct {
	ID        int     `json:"id"`
	CreatedAt string  `json:"created_at"`
	Status    string  `json:"status"`
	Value     float64 `json:"value"`
	Month     int     `json:"month"`
	Year      int     `json:"year"`
	Day       int     `json:"day"`
}

type Profile

type Profile struct {
	ID             int     `json:"id"`
	Level          int     `json:"level"`
	ProfilePicture string  `json:"profile_picture"`
	Weight         float64 `json:"weight"`
	Height         float64 `json:"height"`
	Birthday       string  `json:"birthday"`
	Streak         int     `json:"streak"`
	Bio            string  `json:"bio"`
	HeightUnit     string  `json:"height_unit"`
	WeightUnit     string  `json:"weight_unit"`
	ProfileOf      int     `json:"profile_of"`
}

type ProfileService

type ProfileService struct {
	Profile      Profile
	ProfileStore database.DatabaseStore
}

func NewProfileService

func NewProfileService(profile Profile, profileStore database.DatabaseStore) *ProfileService

func (*ProfileService) CreateDefaultProfile

func (ps *ProfileService) CreateDefaultProfile(u User) error

func (*ProfileService) GetProfileByUserId

func (ps *ProfileService) GetProfileByUserId(id int) (Profile, error)

func (*ProfileService) UpdateProfile

func (ps *ProfileService) UpdateProfile(userid int, height float64, weight float64, dob string, heightunit string, weightunit string) error

func (*ProfileService) UpdateProfileHeight

func (ps *ProfileService) UpdateProfileHeight(u int, height int) error

func (*ProfileService) UpdateProfilePicture

func (ps *ProfileService) UpdateProfilePicture(u User, pfp string) error

func (*ProfileService) UpdateProfileWeight

func (ps *ProfileService) UpdateProfileWeight(u int, weight int) error

type User

type User struct {
	ID        int    `json:"id"`
	Email     string `json:"email"`
	Password  string `json:"password"`
	Username  string `json:"username"`
	CreatedAt string `json:"created_at"`
	Profile   Profile
}

type UserService

type UserService struct {
	User      User
	UserStore database.DatabaseStore
}

func NewUserService

func NewUserService(user User, userStore database.DatabaseStore) *UserService

func (*UserService) CheckEmail

func (us *UserService) CheckEmail(email string) (User, error)

func (*UserService) CheckID

func (us *UserService) CheckID(usr int) (User, error)

func (*UserService) CheckUsername

func (us *UserService) CheckUsername(usr string) (User, error)

func (*UserService) CreateUser

func (us *UserService) CreateUser(u User) (User, error)

func (*UserService) UpdateEmail

func (us *UserService) UpdateEmail(email string, id int) error

func (*UserService) UpdateUser

func (us *UserService) UpdateUser(email string, username string, id int) error

func (*UserService) UpdateUsername

func (us *UserService) UpdateUsername(username string, id int) error

Jump to

Keyboard shortcuts

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