password

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UseCase

type UseCase interface {
	// IndexPassword retrieve all passwords information but omit password from
	// response.
	IndexPassword(ctx context.Context, req pw.Request) (*pw.IndexResponse[pw.Response], error)
	// SavePassword create new password from given request including to make
	// sure given category id in request does really exist.
	SavePassword(ctx context.Context, req pw.Request) (*pw.Response, error)
	// UpdatePassword update existing Password that match given id.
	UpdatePassword(ctx context.Context, id uint, req pw.Request) error
	// DeletePassword delete existing Password that match given id. Make sure
	// that the given id does really exist in data source first.
	DeletePassword(ctx context.Context, id uint) error
	// IndexCategory retrieve all category information including the url to
	// both image and icon.
	IndexCategory(ctx context.Context, req pw.RequestCategory) (*pw.IndexResponse[pw.ResponseCategory], error)
	// SaveCategory create new category from given request including the binary
	// files for both image and icon fields.
	SaveCategory(ctx context.Context, req pw.RequestCategory) (*pw.ResponseCategory, error)
	// UpdateCategory update existing Category that match given id. Optionally
	// replace either or both Image & Icon fields if provided.
	UpdateCategory(ctx context.Context, id uint, req pw.RequestCategory) error
	// DeleteCategory delete existing Category that match given id. Make sure
	// that no Password that's still has relation to given Category. Finally
	// remove all attached Image & Icon.
	DeleteCategory(ctx context.Context, id uint) error
	// SaveFile store given multipart to storage.Port then return filename of
	// the stored file that's ready to be saved. Optionally append given
	// prefix path too.
	SaveFile(f *multipart.FileHeader, prefix ...string) (string, error)
	// RemoveFile remove given filename using storage.Port and just log if
	// there is any error.
	RemoveFile(fn string)
}

UseCase signature that's used in password domain for use case layer.

func NewUseCase

func NewUseCase(conf *viper.Viper, log *zap.Logger, st storage.Port, repo pw.Repository) UseCase

NewUseCase return concrete implementation of UseCase in password domain.

Jump to

Keyboard shortcuts

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