Documentation
¶
Index ¶
- func GenerateOTP(maxDigits uint32) string
- type AuthService
- func (as *AuthService) DeleteAccount(email string, otp string) error
- func (as *AuthService) ForgotPasswordRequest(email string) error
- func (as *AuthService) LoginUser(email, password string) (string, models.User, error)
- func (as *AuthService) RegisterUser(email, name, profileImage, password string) (models.User, error)
- func (as *AuthService) RequestDeletion(user models.User) error
- func (as *AuthService) RequestVerificationAgain(email string) error
- func (as *AuthService) ResetPassword(user models.User, oldPassword string, newPassword string) error
- func (as *AuthService) SetNewPassword(email string, otp string, newPassword string) error
- func (as *AuthService) VerifyEmail(email string, otp string) error
- type AuthServiceInterface
- type EmailAddress
- type EmailService
- func (es *EmailService) GenericSendMail(subject string, content string, toEmail string, userName string) error
- func (es EmailService) SendDeletionMail(toEmail string, userName string) error
- func (es *EmailService) SendForgotPasswordMail(toEmail string, userName string) error
- func (es *EmailService) SendRegistrationMail(subject string, content string, toEmail string, userName string, newUser bool) error
- type EmailServiceInterface
- type GenericEmail
- type MoodService
- func (ms *MoodService) CreateMoodEntry(moodType models.MoodType, notes string, userID uint, attributes []string) (models.MoodResponse, error)
- func (ms *MoodService) CreateNewAttribute(attribute string, userID uint) error
- func (ms *MoodService) DeleteMoodEntry(userID, moodID uint) error
- func (ms *MoodService) GetGenericAttributes(userID uint) ([]models.Attribute, error)
- func (ms *MoodService) GetSingleUserMoodEntry(userID, moodID uint) (models.MoodResponse, error)
- func (ms *MoodService) GetUserMoodEntries(userID uint, moodType *models.MoodType, startDate, endDate *string) ([]models.MoodResponse, error)
- func (ms *MoodService) UpdateUserMoodEntry(moodID uint, moodType models.MoodType, notes string, attributes []string) error
- type MoodServiceInterface
- type ResourceService
- func (rs *ResourceService) AddReview(resourceID, userID uint, content string, rating models.Rating) error
- func (rs *ResourceService) CreateResourceEntry(userID uint, title, content, url string, external, adminPost bool) (models.ResourceResponse, error)
- func (rs *ResourceService) DeleteResource(userID, resourceID uint) error
- func (rs *ResourceService) GetAdminResources() ([]models.ResourceResponse, error)
- func (rs *ResourceService) GetAllResources() ([]models.ResourceResponse, error)
- func (rs *ResourceService) GetResourceByID(resourceID uint) (models.ResourceResponse, error)
- func (rs *ResourceService) UpdateResource(resourceID uint, userID uint, title, content, url string, ...) (models.ResourceResponse, error)
- type ResourceServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateOTP ¶
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService handles the business logic for authentication
func NewAuthService ¶
func NewAuthService( authProviderRepo repository.AuthProviderRepositoryInterface, verificationRepo repository.VerificationRepositoryInterface, forgotRepo repository.ForgotPasswordRepositoryInterface, deletionRepo repository.DeletionConfirmationRepositoryInterface, passwordAuthRepo repository.PasswordAuthRepositoryInterface, userRepo repository.UserRepositoryInterface, emailService EmailServiceInterface, moodRepo repository.MoodRepositoryInterface, ) *AuthService
NewAuthService returns a new AuthService
func (*AuthService) DeleteAccount ¶
func (as *AuthService) DeleteAccount(email string, otp string) error
func (*AuthService) ForgotPasswordRequest ¶
func (as *AuthService) ForgotPasswordRequest(email string) error
func (*AuthService) RegisterUser ¶
func (as *AuthService) RegisterUser(email, name, profileImage, password string) (models.User, error)
func (*AuthService) RequestDeletion ¶
func (as *AuthService) RequestDeletion(user models.User) error
func (*AuthService) RequestVerificationAgain ¶
func (as *AuthService) RequestVerificationAgain(email string) error
RequestVerificationAgain handles resending verification email.
func (*AuthService) ResetPassword ¶
func (*AuthService) SetNewPassword ¶
func (as *AuthService) SetNewPassword(email string, otp string, newPassword string) error
func (*AuthService) VerifyEmail ¶
func (as *AuthService) VerifyEmail(email string, otp string) error
type AuthServiceInterface ¶
type AuthServiceInterface interface { RegisterUser(email, name, profileImage, password string) (models.User, error) LoginUser(email, password string) (string, models.User, error) RequestVerificationAgain(email string) error VerifyEmail(email, otp string) error ForgotPasswordRequest(email string) error SetNewPassword(email string, otp string, newPassword string) error ResetPassword(user models.User, oldPassword string, newPassword string) error RequestDeletion(user models.User) error DeleteAccount(email string, otp string) error }
type EmailAddress ¶
type EmailService ¶
type EmailService struct { }
EmailService handles sending email notifications.
func NewEmailService ¶
func NewEmailService(userRepo repository.UserRepositoryInterface) *EmailService
NewEmailService creates a new EmailService.
func (*EmailService) GenericSendMail ¶
func (es *EmailService) GenericSendMail(subject string, content string, toEmail string, userName string) error
GenericSendMail sends a generic email.
func (EmailService) SendDeletionMail ¶
func (es EmailService) SendDeletionMail(toEmail string, userName string) error
func (*EmailService) SendForgotPasswordMail ¶
func (es *EmailService) SendForgotPasswordMail(toEmail string, userName string) error
func (*EmailService) SendRegistrationMail ¶
type EmailServiceInterface ¶
type EmailServiceInterface interface { GenericSendMail(subject string, content string, toEmail string, userName string) error SendRegistrationMail(subject string, content string, toEmail string, userName string, newUser bool) error SendForgotPasswordMail(toEmail string, userName string) error SendDeletionMail(toEmail string, userName string) error }
type GenericEmail ¶
type GenericEmail struct { Subject string `json:"subject"` From EmailAddress `json:"from"` To []EmailAddress `json:"to"` Category string `json:"category"` Text string `json:"text"` }
type MoodService ¶
type MoodService struct {
// contains filtered or unexported fields
}
func NewMoodService ¶
func NewMoodService(moodRepo repository.MoodRepositoryInterface) *MoodService
func (*MoodService) CreateMoodEntry ¶
func (ms *MoodService) CreateMoodEntry(moodType models.MoodType, notes string, userID uint, attributes []string) (models.MoodResponse, error)
CreateMoodEntry creates a new mood entry in the database.
func (*MoodService) CreateNewAttribute ¶
func (ms *MoodService) CreateNewAttribute(attribute string, userID uint) error
CreateNewAttribute creates a new attribute in the database which can now be associated with mood entries.
func (*MoodService) DeleteMoodEntry ¶
func (ms *MoodService) DeleteMoodEntry(userID, moodID uint) error
DeleteMoodEntry deletes a single mood entry for a specific user, as well as all associated mood attributes.
func (*MoodService) GetGenericAttributes ¶
func (ms *MoodService) GetGenericAttributes(userID uint) ([]models.Attribute, error)
GetGenericAttributes gets all the generic attributes that can be associated with mood entries.
func (*MoodService) GetSingleUserMoodEntry ¶
func (ms *MoodService) GetSingleUserMoodEntry(userID, moodID uint) (models.MoodResponse, error)
GetSingleUserMoodEntry gets a single mood entry for a specific user.
func (*MoodService) GetUserMoodEntries ¶
func (ms *MoodService) GetUserMoodEntries(userID uint, moodType *models.MoodType, startDate, endDate *string) ([]models.MoodResponse, error)
GetUsersMoodEntries gets all the mood entries for a specific user. Filters by mood type and date range if provided.
func (*MoodService) UpdateUserMoodEntry ¶
func (ms *MoodService) UpdateUserMoodEntry(moodID uint, moodType models.MoodType, notes string, attributes []string) error
UpdateUserMoodEntry updates a single mood entry for a specific user, as well as all associated mood attributes.
type MoodServiceInterface ¶
type MoodServiceInterface interface { CreateMoodEntry(moodType models.MoodType, notes string, userID uint, attributes []string) (models.MoodResponse, error) GetUserMoodEntries(userID uint, moodType *models.MoodType, startDate, endDate *string) ([]models.MoodResponse, error) GetSingleUserMoodEntry(userID, moodID uint) (models.MoodResponse, error) DeleteMoodEntry(userID, moodID uint) error CreateNewAttribute(attribute string, userID uint) error UpdateUserMoodEntry(moodID uint, moodType models.MoodType, notes string, attributes []string) error GetGenericAttributes(userID uint) ([]models.Attribute, error) }
type ResourceService ¶
type ResourceService struct {
// contains filtered or unexported fields
}
func NewResourceService ¶
func NewResourceService(resourceRepo repository.ResourceRepositoryInterface, userRepo repository.UserRepositoryInterface) *ResourceService
func (*ResourceService) AddReview ¶
func (rs *ResourceService) AddReview(resourceID, userID uint, content string, rating models.Rating) error
AddReview adds a review to a resource.
func (*ResourceService) CreateResourceEntry ¶
func (rs *ResourceService) CreateResourceEntry(userID uint, title, content, url string, external, adminPost bool) (models.ResourceResponse, error)
CreateResourceEntry creates a new resource entry in the database.
func (*ResourceService) DeleteResource ¶
func (rs *ResourceService) DeleteResource(userID, resourceID uint) error
DeleteResource deletes a resource by its ID.
func (*ResourceService) GetAdminResources ¶
func (rs *ResourceService) GetAdminResources() ([]models.ResourceResponse, error)
GetAdminResources gets all the resources for an admin.
func (*ResourceService) GetAllResources ¶
func (rs *ResourceService) GetAllResources() ([]models.ResourceResponse, error)
GetAllResources gets all the resources in the database.
func (*ResourceService) GetResourceByID ¶
func (rs *ResourceService) GetResourceByID(resourceID uint) (models.ResourceResponse, error)
GetResourceByID gets a resource by its ID.
func (*ResourceService) UpdateResource ¶
func (rs *ResourceService) UpdateResource(resourceID uint, userID uint, title, content, url string, external, adminPost bool) (models.ResourceResponse, error)
UpdateResource updates a resource in the database.
type ResourceServiceInterface ¶
type ResourceServiceInterface interface { CreateResourceEntry(userID uint, title, content, url string, external, adminPost bool) (models.ResourceResponse, error) GetAllResources() ([]models.ResourceResponse, error) GetResourceByID(resourceID uint) (models.ResourceResponse, error) DeleteResource(userID, resourceID uint) error UpdateResource(resourceID uint, userID uint, title, content, url string, external, adminPost bool) (models.ResourceResponse, error) GetAdminResources() ([]models.ResourceResponse, error) AddReview(resourceID, userID uint, content string, rating models.Rating) error }