service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService struct {
	Context   context.Context
	Config    *config.Configuration
	Logger    *logrus.Logger
	AuthRepo  repository.IAuthRepository
	GConfig   *oauth2.Config
	GOAuthReq requester.IOAuthGoogle
}

AuthService is an app auth struct that consists of all the dependencies needed for auth service

func (*AuthService) Create

func (as *AuthService) Create(user model.CreateUserRequest) error

Create service layer for handling create a user

func (*AuthService) GoogleLoginCallbackSvc

func (as *AuthService) GoogleLoginCallbackSvc(state string, code string) (*model.SuccessLoginResponse, error)

GoogleLoginCallbackSvc service layer for handling googles login services callback

func (*AuthService) GoogleLoginSvc

func (as *AuthService) GoogleLoginSvc() (string, error)

GoogleLoginSvc service layer for handling googles login services

func (*AuthService) LoginSvc

LoginSvc service layer for handling user login (author,superadmin)

type BlogService

type BlogService struct {
	Context     context.Context
	Config      *config.Configuration
	Logger      *logrus.Logger
	BlogRepo    repository.IBlogRepository
	CommentRepo repository.ICommentRepository
	LikeRepo    repository.ILikeRepository
	UserRepo    repository.IUserRepository
	Mutex       *sync.RWMutex
}

BlogRepository is an app blog struct that consists of all the dependencies needed for blog service

func (*BlogService) CreateBlogSvc

func (bs *BlogService) CreateBlogSvc(req model.CreateBlogRequest, createdBy string) error

CreateBlogSvc service layer for handling creating a blog

func (*BlogService) CreateCommentSvc

func (bs *BlogService) CreateCommentSvc(blogID int, req model.CommentRequest, createdBy string) error

CreateCommentSvc service layer for handling creating comments

func (*BlogService) CreateLikeSvc

func (bs *BlogService) CreateLikeSvc(blogID int, req model.LikeRequest, createdBy string) error

CreateLikeSvc service layer for handling creating likes

func (*BlogService) DeleteBlogSvc

func (bs *BlogService) DeleteBlogSvc(id int, userID int) error

DeleteBlogSvc service layer for handling deleting a blog by ID

func (*BlogService) DeleteCommentSvc

func (bs *BlogService) DeleteCommentSvc(blogID int, commentID int, userID int) error

DeleteCommentSvc service layer for handling deleting comment with id

func (*BlogService) DeleteLikeSvc

func (bs *BlogService) DeleteLikeSvc(blogID int, likeID int, userID int) error

DeleteLikeSvc service layer for handling deleting like with id

func (*BlogService) GetAllBlogSvc

func (bs *BlogService) GetAllBlogSvc(page int, size int, order string, field string, search string, filter model.FilterBlogRequest) ([]model.BlogResponse, *model.Metadata, error)

GetAllBlogSvc service layer for handling list/filter/search a blog

func (*BlogService) GetBlogBySlugSvc

func (bs *BlogService) GetBlogBySlugSvc(slug string) (*model.BlogResponse, error)

GetBlogBySlugSvc service layer for handling getting detail a blog by slugs

func (*BlogService) GetCommentsByBlogSvc

func (bs *BlogService) GetCommentsByBlogSvc(blogID int, page int, size int, order string, field string) ([]model.ViewCommentResponse, *model.Metadata, error)

GetCommentsByBlogSvc service layer for handling getting comments with filter

func (*BlogService) UpdateBlogSvc

func (bs *BlogService) UpdateBlogSvc(id int, req model.UpdateBlogRequest, updatedBy string) error

UpdateBlogSvc service layer for handling updating a blog by ID

func (*BlogService) UpdateCommentSvc

func (bs *BlogService) UpdateCommentSvc(id int, req model.CommentRequest, updatedBy string) error

UpdateCommentSvc service layer for handling updating comment by id

type HealthCheckService

type HealthCheckService struct {
	Context         context.Context
	Config          *config.Configuration
	Logger          *logrus.Logger
	HealthCheckRepo repository.IHealthCheckRepository
}

HealthCheckService is an app health check struct that consists of all the dependencies needed for health check service

func (*HealthCheckService) HealthCheck

func (hcs *HealthCheckService) HealthCheck() (bool, error)

HealthCheck service layer to checking database is ok or not

type IAuthService

type IAuthService interface {
	Create(user model.CreateUserRequest) error
	GoogleLoginSvc() (string, error)
	GoogleLoginCallbackSvc(state string, code string) (*model.SuccessLoginResponse, error)
	LoginSvc(user model.LoginRequest) (*model.SuccessLoginResponse, error)
}

IAuthService is an interface that has all the function to be implemented inside auth service

type IBlogService

type IBlogService interface {
	CreateBlogSvc(req model.CreateBlogRequest, createdBy string) error
	GetAllBlogSvc(page int, size int, order string, field string, search string, filter model.FilterBlogRequest) ([]model.BlogResponse, *model.Metadata, error)
	GetBlogBySlugSvc(slug string) (*model.BlogResponse, error)
	UpdateBlogSvc(id int, req model.UpdateBlogRequest, updatedBy string) error
	DeleteBlogSvc(id int, userID int) error

	CreateCommentSvc(blogID int, req model.CommentRequest, createdBy string) error
	UpdateCommentSvc(id int, req model.CommentRequest, updatedBy string) error
	GetCommentsByBlogSvc(blogID int, page int, size int, order string, field string) ([]model.ViewCommentResponse, *model.Metadata, error)
	DeleteCommentSvc(blogID int, commentID int, userID int) error

	CreateLikeSvc(blogID int, req model.LikeRequest, createdBy string) error
	DeleteLikeSvc(blogID int, likeID int, userID int) error
}

IBlogService is an interface that has all the function to be implemented inside blog service

type IHealthCheckService

type IHealthCheckService interface {
	HealthCheck() (bool, error)
}

IHealthCheckService is an interface that has all the function to be implemented inside health check service

type ITagService

type ITagService interface {
	CreateTagSvc(req model.CreateTagRequest, createdBy string) error
	GetAllTagSvc(page int, size int, order string, field string, search string) ([]model.ViewTagResponse, *model.Metadata, error)
	UpdateTagSvc(id int, req model.UpdateTagRequest, updatedBy string) error
	DeleteTagSvc(id int) error
}

IHealthCheckService is an interface that has all the function to be implemented inside tag service

type IUserService

type IUserService interface {
	GetAllUserSvc(page int, size int, order string, field string, search string) ([]model.ViewUserResponse, *model.Metadata, error)
	GetUserByIDSvc(id int) (*model.ViewUserResponse, error)
	UpdateUserByIDSvc(id int, req model.UpdateUserRequest, updatedBy string) error
	DeleteUserByIDSvc(id int) error
}

IUserService is an interface that has all the function to be implemented inside user service

type TagService

type TagService struct {
	Context context.Context
	Config  *config.Configuration
	Logger  *logrus.Logger
	TagRepo repository.ITagRepository
}

TagService is an app tag struct that consists of all the dependencies needed for tag service

func (*TagService) CreateTagSvc

func (ts *TagService) CreateTagSvc(req model.CreateTagRequest, createdBy string) error

CreateTagSvc service layer for creating a tag

func (*TagService) DeleteTagSvc

func (ts *TagService) DeleteTagSvc(id int) error

DeleteTagSvc service layer for deleting a tag by id

func (*TagService) GetAllTagSvc

func (ts *TagService) GetAllTagSvc(page int, size int, order string, field string, search string) ([]model.ViewTagResponse, *model.Metadata, error)

GetAllTagSvc service layer for getting all tag

func (*TagService) UpdateTagSvc

func (ts *TagService) UpdateTagSvc(id int, req model.UpdateTagRequest, updatedBy string) error

UpdateTagSvc service layer for updating a tag by id

type UserService

type UserService struct {
	Context  context.Context
	Config   *config.Configuration
	Logger   *logrus.Logger
	UserRepo repository.IUserRepository
}

UserService is an app user check struct that consists of all the dependencies needed for user service

func (*UserService) DeleteUserByIDSvc

func (us *UserService) DeleteUserByIDSvc(id int) error

DeleteUserByIDSvc service layer for delete user by id

func (*UserService) GetAllUserSvc

func (us *UserService) GetAllUserSvc(page int, size int, order string, field string, search string) ([]model.ViewUserResponse, *model.Metadata, error)

GetAllUserSvc service layer for getting all user

func (*UserService) GetUserByIDSvc

func (us *UserService) GetUserByIDSvc(id int) (*model.ViewUserResponse, error)

GetUserByIDSvc service layer for get a user by id

func (*UserService) UpdateUserByIDSvc

func (us *UserService) UpdateUserByIDSvc(id int, req model.UpdateUserRequest, updatedBy string) error

UpdateUserByIDSvc service layer for update user by id

Jump to

Keyboard shortcuts

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