service

package
v0.0.0-...-389710c Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCAL_URL          = "http://localhost:3000"
	VERIFY_EMAIL_ROUTE = "register/verify_email"
)

Variables

This section is empty.

Functions

func SafeRollback

func SafeRollback(tx *gorm.DB)

Types

type BeritaService

type BeritaService interface {
	Create(ctx context.Context, req dto.BeritaCreateRequest) (dto.BeritaResponse, error)
	GetByID(ctx context.Context, id string) (dto.BeritaResponse, error)
	GetByKategori(ctx context.Context, kategoriID string, req dto.PaginationRequest) (dto.BeritaPaginationResponse, error)
	GetAllWithPagination(ctx context.Context, req dto.PaginationRequest) (dto.BeritaPaginationResponse, error)
	Update(ctx context.Context, req dto.BeritaUpdateRequest, id string) (dto.BeritaResponse, error)
	Delete(ctx context.Context, id string) error
}

func NewBeritaService

func NewBeritaService(
	beritaRepo repository.BeritaRepository,
	kategoriBeritaRepo repository.KategoriBeritaRepository,
	db *gorm.DB,
) BeritaService

type JWTService

type JWTService interface {
	GenerateAccessToken(userId string, role string) string
	GenerateRefreshToken() (string, time.Time)
	ValidateToken(token string) (*jwt.Token, error)
	GetUserIDByToken(token string) (string, error)
}

func NewJWTService

func NewJWTService() JWTService

type MakananService

type MakananService interface {
	Create(ctx context.Context, req dto.MakananCreateRequest) (dto.MakananResponse, error)
	GetByID(ctx context.Context, id string) (dto.MakananResponse, error)
	GetByNama(ctx context.Context, nama string) (dto.MakananResponse, error)
	GetAllWithPagination(ctx context.Context, req dto.PaginationRequest) (dto.MakananPaginationResponse, error)
	GetByBahanMakanan(ctx context.Context, bahanID string, req dto.PaginationRequest) (dto.MakananPaginationResponse, error)
	Update(ctx context.Context, req dto.MakananUpdateRequest, id string) (dto.MakananResponse, error)
	Delete(ctx context.Context, id string) error
}

func NewMakananService

func NewMakananService(
	makananRepo repository.MakananRepository,
	bahanMakananRepo repository.BahanMakananRepository,
	db *gorm.DB,
) MakananService

type StuntingService

func NewStuntingService

func NewStuntingService(stuntingRepo repository.StuntingRepository, db *gorm.DB, mlApiUrl string) StuntingService

type UserService

type UserService interface {
	Register(ctx context.Context, req dto.UserCreateRequest) (dto.UserResponse, error)
	GetAllUserWithPagination(ctx context.Context, req dto.PaginationRequest) (dto.UserPaginationResponse, error)
	GetUserById(ctx context.Context, userId string) (dto.UserResponse, error)
	GetUserByEmail(ctx context.Context, email string) (dto.UserResponse, error)
	SendVerificationEmail(ctx context.Context, req dto.SendVerificationEmailRequest) error
	VerifyEmail(ctx context.Context, req dto.VerifyEmailRequest) (dto.VerifyEmailResponse, error)
	Update(ctx context.Context, req dto.UserUpdateRequest, userId string) (dto.UserUpdateResponse, error)
	UpdatePassword(ctx context.Context, req dto.UserUpdatePasswordRequest, userId string) error
	Delete(ctx context.Context, userId string) error
	Verify(ctx context.Context, req dto.UserLoginRequest) (dto.TokenResponse, error)
	RefreshToken(ctx context.Context, req dto.RefreshTokenRequest) (dto.TokenResponse, error)
	RevokeRefreshToken(ctx context.Context, userID string) error
}

func NewUserService

func NewUserService(
	userRepo repository.UserRepository,
	refreshTokenRepo repository.RefreshTokenRepository,
	jwtService JWTService,
	db *gorm.DB,
) UserService

Jump to

Keyboard shortcuts

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