service

package
v0.0.0-...-4468c4e Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module exports service module.

Functions

This section is empty.

Types

type AbstractService

type AbstractService struct{}

AbstractService data structure.

type HTTPService

type HTTPService struct {
	// contains filtered or unexported fields
}

HTTPService data type.

func NewHTTPService

func NewHTTPService(userService UserService) HTTPService

NewHTTPService creates a new HTTPService.

func (HTTPService) CurrentUser

func (s HTTPService) CurrentUser(ctx *gin.Context) (user model.User, err error)

CurrentUser returns the current user.

func (HTTPService) CurrentUserID

func (s HTTPService) CurrentUserID(ctx *gin.Context) uuid.UUID

CurrentUserID returns the current user's ID.

func (HTTPService) HTTPError

func (s HTTPService) HTTPError(c *gin.Context, code int, message interface{})

HTTPError sends HTTP error response.

func (HTTPService) HTTPPaginatedResponse

func (s HTTPService) HTTPPaginatedResponse(c *gin.Context, code int, data interface{}, pagination helper.Pagination)

HTTPPaginatedResponse sends HTTP response with pagination.

func (HTTPService) HTTPResponse

func (s HTTPService) HTTPResponse(c *gin.Context, code int, data interface{})

HTTPResponse sends HTTP response.

func (HTTPService) HTTPValidationError

func (s HTTPService) HTTPValidationError(c *gin.Context, err error)

HTTPValidationError sends HTTP validation response.

func (HTTPService) NormalizeHTTPValidationError

func (s HTTPService) NormalizeHTTPValidationError(err error) []string

NormalizeHTTPValidationError Normalizes the HTTP validation error.

func (HTTPService) Paginate

func (s HTTPService) Paginate(ctx *gin.Context) *helper.Pagination

Paginate returns pagination object from the request.

type JWTAuthService

type JWTAuthService struct {
	// contains filtered or unexported fields
}

JWTAuthService data structure.

func NewJWTAuthService

func NewJWTAuthService(config lib.Config, userService UserService, logger lib.Logger) JWTAuthService

NewJWTAuthService creates a new JWTAuthService.

func (JWTAuthService) Authorize

func (s JWTAuthService) Authorize(tokenString string) (user model.User, err error)

Authorize authorizes the generated token.

func (JWTAuthService) GenerateToken

func (s JWTAuthService) GenerateToken(user *model.User) (response dto.OAuthResponse, err error)

GenerateToken creates jwt auth token.

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService data structure.

func NewUserService

func NewUserService(repository repository.UserRepository) UserService

NewUserService creates a new UserService.

func (UserService) Create

func (s UserService) Create(user *model.User) error

Create creates the user.

func (UserService) Get

func (s UserService) Get(id uuid.UUID) (user model.User, err error)

Get gets one user.

func (UserService) GetByUsernameOrEmail

func (s UserService) GetByUsernameOrEmail(username string) (user model.User, err error)

GetByUsernameOrEmail loads the user by username or email.

type WebsiteService

type WebsiteService struct {
	AbstractService
	// contains filtered or unexported fields
}

WebsiteService data structure.

func NewWebsiteService

func NewWebsiteService(repository repository.WebsiteRepository) WebsiteService

NewWebsiteService creates a new WebsiteService.

func (WebsiteService) Create

func (s WebsiteService) Create(website *model.Website, encryptionKey string) (err error)

Create creates new website.

func (WebsiteService) GetAll

func (s WebsiteService) GetAll(pagination *helper.Pagination) (websites []model.Website, err error)

GetAll gets all websites.

func (WebsiteService) GetByUser

func (s WebsiteService) GetByUser(
	userID uuid.UUID,
	pagination *helper.Pagination,
) (websites []model.Website, err error)

GetByUser gets all websites for given user.

Jump to

Keyboard shortcuts

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