Documentation ¶
Index ¶
- type ImageService
- type ImageServiceInterface
- type MailService
- type MailServiceInterface
- type MockMailService
- type PostService
- func (service *PostService) CreatePost(req *models.PostCreateRequestDTO, file *multipart.FileHeader, username string) (*models.PostResponseDTO, *customerrors.CustomError, int)
- func (service *PostService) DeletePost(postId string, username string) (*customerrors.CustomError, int)
- func (service *PostService) GetPostsByHashtag(hashtag string, lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int)
- func (service *PostService) GetPostsByUsername(username string, offset, limit int) (*models.UserFeedDTO, *customerrors.CustomError, int)
- func (service *PostService) GetPostsGlobalFeed(lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int)
- func (service *PostService) GetPostsPersonalFeed(username string, lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int)
- type PostServiceInterface
- type SubscriptionService
- func (service *SubscriptionService) DeleteSubscription(subscriptionId string, currentUsername string) (*customerrors.CustomError, int)
- func (service *SubscriptionService) GetSubscriptions(ftype string, limit int, offset int, username string, currentUsername string) (*models.SubscriptionResponseDTO, *customerrors.CustomError, int)
- func (service *SubscriptionService) PostSubscription(req *models.SubscriptionPostRequestDTO, currentUsername string) (*models.SubscriptionPostResponseDTO, *customerrors.CustomError, int)
- type SubscriptionServiceInterface
- type UserService
- func (service *UserService) ActivateUser(username string, token string) (*models.UserLoginResponseDTO, *customerrors.CustomError, int)
- func (service *UserService) ChangeUserPassword(req *models.ChangePasswordDTO, currentUsername string) (*customerrors.CustomError, int)
- func (service *UserService) CreateUser(req models.UserCreateRequestDTO) (*models.UserResponseDTO, *customerrors.CustomError, int)
- func (service *UserService) GetUserProfile(username string, currentUser string) (*models.UserProfileResponseDTO, *customerrors.CustomError, int)
- func (service *UserService) LoginUser(req models.UserLoginRequestDTO) (*models.UserLoginResponseDTO, *customerrors.CustomError, int)
- func (service *UserService) RefreshToken(req *models.UserRefreshTokenRequestDTO) (*models.UserLoginResponseDTO, *customerrors.CustomError, int)
- func (service *UserService) ResendActivationToken(username string) (*customerrors.CustomError, int)
- func (service *UserService) SearchUser(username string, limit int, offset int, currentUsername string) (*models.UserSearchResponseDTO, *customerrors.CustomError, int)
- func (service *UserService) UpdateUserInformation(req *models.UserInformationUpdateDTO, currentUsername string) (*models.UserInformationUpdateDTO, *customerrors.CustomError, int)
- type UserServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImageService ¶
type ImageService struct {
// contains filtered or unexported fields
}
func NewImageService ¶
func NewImageService(fileSystem repositories.FileSystemInterface, validator utils.ValidatorInterface) *ImageService
NewImageService can be used as a constructor to create a ImageService "object"
func (*ImageService) DeleteImage ¶
func (service *ImageService) DeleteImage(filename string) (*customerrors.CustomError, int)
DeleteImage can be used in other services to delete an image from the file system
func (*ImageService) GetImage ¶
func (service *ImageService) GetImage(filename string) ([]byte, *customerrors.CustomError, int)
GetImage can be used in image controller to return an image from the file system
func (*ImageService) SaveImage ¶
func (service *ImageService) SaveImage(fileHeader multipart.FileHeader) (string, *customerrors.CustomError, int)
SaveImage can be used in other services to save an image to the file system and return the image url
type ImageServiceInterface ¶
type ImageServiceInterface interface { SaveImage(fileHeader multipart.FileHeader) (string, *customerrors.CustomError, int) GetImage(filename string) ([]byte, *customerrors.CustomError, int) DeleteImage(filename string) (*customerrors.CustomError, int) }
type MailService ¶
type MailService struct { }
func NewMailService ¶
func NewMailService() *MailService
NewMailService can be used as a constructor to generate a new MailService "object"
type MailServiceInterface ¶
type MockMailService ¶
type MockMailService struct { mock.Mock MailServiceInterface }
MockMailService is a mock implementation of the MailServiceInterface
type PostService ¶
type PostService struct {
// contains filtered or unexported fields
}
func NewPostService ¶
func NewPostService(postRepo repositories.PostRepositoryInterface, userRepo repositories.UserRepositoryInterface, hashtagRepo repositories.HashtagRepositoryInterface, imageService ImageServiceInterface, validator utils.ValidatorInterface, locationRepo repositories.LocationRepositoryInterface) *PostService
NewPostService can be used as a constructor to create a PostService "object"
func (*PostService) CreatePost ¶
func (service *PostService) CreatePost(req *models.PostCreateRequestDTO, file *multipart.FileHeader, username string) (*models.PostResponseDTO, *customerrors.CustomError, int)
func (*PostService) DeletePost ¶
func (service *PostService) DeletePost(postId string, username string) (*customerrors.CustomError, int)
DeletePost deletes a post by id and returns an error if the post does not exist or the requesting user is not the author
func (*PostService) GetPostsByHashtag ¶
func (service *PostService) GetPostsByHashtag(hashtag string, lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int)
GetPostsByHashtag returns a pagination object with the posts in the personal feed using pagination parameters
func (*PostService) GetPostsByUsername ¶
func (service *PostService) GetPostsByUsername(username string, offset, limit int) (*models.UserFeedDTO, *customerrors.CustomError, int)
func (*PostService) GetPostsGlobalFeed ¶
func (service *PostService) GetPostsGlobalFeed(lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int)
GetPostsGlobalFeed returns a pagination object with the posts in the global feed using pagination parameters
func (*PostService) GetPostsPersonalFeed ¶
func (service *PostService) GetPostsPersonalFeed(username string, lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int)
GetPostsPersonalFeed returns a pagination object with the posts in the personal feed using pagination parameters
type PostServiceInterface ¶
type PostServiceInterface interface { CreatePost(req *models.PostCreateRequestDTO, file *multipart.FileHeader, username string) (*models.PostResponseDTO, *customerrors.CustomError, int) GetPostsByUsername(username string, offset, limit int) (*models.UserFeedDTO, *customerrors.CustomError, int) GetPostsGlobalFeed(lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int) GetPostsPersonalFeed(username string, lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int) DeletePost(postId string, username string) (*customerrors.CustomError, int) GetPostsByHashtag(hashtag string, lastPostId string, limit int) (*models.GeneralFeedDTO, *customerrors.CustomError, int) }
type SubscriptionService ¶
type SubscriptionService struct {
// contains filtered or unexported fields
}
func NewSubscriptionService ¶
func NewSubscriptionService( subscriptionRepo repositories.SubscriptionRepositoryInterface, userRepo repositories.UserRepositoryInterface) *SubscriptionService
func (*SubscriptionService) DeleteSubscription ¶
func (service *SubscriptionService) DeleteSubscription(subscriptionId string, currentUsername string) (*customerrors.CustomError, int)
func (*SubscriptionService) GetSubscriptions ¶
func (service *SubscriptionService) GetSubscriptions(ftype string, limit int, offset int, username string, currentUsername string) (*models.SubscriptionResponseDTO, *customerrors.CustomError, int)
func (*SubscriptionService) PostSubscription ¶
func (service *SubscriptionService) PostSubscription(req *models.SubscriptionPostRequestDTO, currentUsername string) (*models.SubscriptionPostResponseDTO, *customerrors.CustomError, int)
type SubscriptionServiceInterface ¶
type SubscriptionServiceInterface interface { PostSubscription(req *models.SubscriptionPostRequestDTO, currentUsername string) (*models.SubscriptionPostResponseDTO, *customerrors.CustomError, int) DeleteSubscription(subscriptionId string, currentUsername string) (*customerrors.CustomError, int) GetSubscriptions(ftype string, limit int, offset int, username string, currentUsername string) (*models.SubscriptionResponseDTO, *customerrors.CustomError, int) }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService( userRepo repositories.UserRepositoryInterface, activationTokenRepo repositories.ActivationTokenRepositoryInterface, mailService MailServiceInterface, validator utils.ValidatorInterface, postRepo repositories.PostRepositoryInterface, subscriptionRepo repositories.SubscriptionRepositoryInterface) *UserService
NewUserService can be used as a constructor to generate a new UserService "object"
func (*UserService) ActivateUser ¶
func (service *UserService) ActivateUser(username string, token string) (*models.UserLoginResponseDTO, *customerrors.CustomError, int)
ActivateUser can be called from the controller to verify email using token and returns response, error and status code
func (*UserService) ChangeUserPassword ¶
func (service *UserService) ChangeUserPassword(req *models.ChangePasswordDTO, currentUsername string) (*customerrors.CustomError, int)
ChangeUserPassword can be called from the controller to update a user's password
func (*UserService) CreateUser ¶
func (service *UserService) CreateUser(req models.UserCreateRequestDTO) (*models.UserResponseDTO, *customerrors.CustomError, int)
CreateUser can be called from the controller and saves the user to the db and returns response, error and status code
func (*UserService) GetUserProfile ¶
func (service *UserService) GetUserProfile(username string, currentUser string) (*models.UserProfileResponseDTO, *customerrors.CustomError, int)
GetUserProfile returns information about the user
func (*UserService) LoginUser ¶
func (service *UserService) LoginUser(req models.UserLoginRequestDTO) (*models.UserLoginResponseDTO, *customerrors.CustomError, int)
LoginUser can be called from the controller and verifies password and returns response, error and status code
func (*UserService) RefreshToken ¶
func (service *UserService) RefreshToken(req *models.UserRefreshTokenRequestDTO) (*models.UserLoginResponseDTO, *customerrors.CustomError, int)
RefreshToken can be called from the controller with refresh token to return a new access token
func (*UserService) ResendActivationToken ¶
func (service *UserService) ResendActivationToken(username string) (*customerrors.CustomError, int)
ResendActivationToken can be sent from controller to resend a six digit code via mail
func (*UserService) SearchUser ¶
func (service *UserService) SearchUser(username string, limit int, offset int, currentUsername string) (*models.UserSearchResponseDTO, *customerrors.CustomError, int)
SearchUser can be called from the controller to search for users and returns response, error and status code
func (*UserService) UpdateUserInformation ¶
func (service *UserService) UpdateUserInformation(req *models.UserInformationUpdateDTO, currentUsername string) (*models.UserInformationUpdateDTO, *customerrors.CustomError, int)
UpdateUserInformation can be called from the controller to update a user's nickname and status
type UserServiceInterface ¶
type UserServiceInterface interface { CreateUser(req models.UserCreateRequestDTO) (*models.UserResponseDTO, *customerrors.CustomError, int) LoginUser(req models.UserLoginRequestDTO) (*models.UserLoginResponseDTO, *customerrors.CustomError, int) ActivateUser(username string, token string) (*models.UserLoginResponseDTO, *customerrors.CustomError, int) ResendActivationToken(username string) (*customerrors.CustomError, int) RefreshToken(req *models.UserRefreshTokenRequestDTO) (*models.UserLoginResponseDTO, *customerrors.CustomError, int) SearchUser(username string, limit int, offset int, currentUsername string) (*models.UserSearchResponseDTO, *customerrors.CustomError, int) UpdateUserInformation(req *models.UserInformationUpdateDTO, currentUsername string) (*models.UserInformationUpdateDTO, *customerrors.CustomError, int) ChangeUserPassword(req *models.ChangePasswordDTO, currentUsername string) (*customerrors.CustomError, int) GetUserProfile(username string, currentUser string) (*models.UserProfileResponseDTO, *customerrors.CustomError, int) // contains filtered or unexported methods }