service

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseService

type BaseService[T any, K comparable, S any] interface {
	// Create adds a new item.
	// filterContext provides additional context for the operation.
	// item is the item to be created.
	// Returns the created item and an error if any.
	Create(filterContext *S, item *T) (*T, error)

	// CreateMany adds multiple new items.
	// filterContext provides additional context for the operation.
	// items is the list of items to be created.
	// Returns the list of created items and an error if any.
	CreateMany(filterContext *S, items []*T) ([]*T, error)

	// Update modifies an existing item.
	// filterContext provides additional context for the operation.
	// item is the item to be updated.
	// Returns the updated item and an error if any.
	Update(filterContext *S, item *T) (*T, error)

	// UpdateMany modifies multiple existing items.
	// filterContext provides additional context for the operation.
	// items is the list of items to be updated.
	// Returns the list of updated items and an error if any.
	UpdateMany(filterContext *S, items []*T) ([]*T, error)

	// Delete removes an item by its identifier.
	// searchParams provides the search parameters.
	// id is the identifier of the item to be deleted.
	// Returns an error if any.
	Delete(searchParams *S, id K) error

	// DeleteMany removes multiple items by their identifiers.
	// searchParams provides the search parameters.
	// ids is the list of identifiers of the items to be deleted.
	// Returns an error if any.
	DeleteMany(searchParams *S, ids []K) error

	// FindById retrieves an item by its identifier.
	// searchParams provides the search parameters.
	// id is the identifier of the item to be retrieved.
	// Returns the found item and an error if any.
	FindById(searchParams *S, id K) (*T, error)

	// FindByIds retrieves multiple items by their identifiers.
	// searchParams provides the search parameters.
	// ids is the list of identifiers of the items to be retrieved.
	// Returns the list of found items and an error if any.
	FindByIds(searchParams *S, ids []K) ([]*T, error)

	// FindAll retrieves all items with pagination.
	// searchParams provides the search parameters.
	// pageSize is the number of items per page.
	// page is the page number.
	// Returns a paged result of found items and an error if any.
	FindAll(searchParams *S, pageSize int, page int) (response.PagedResult[*T], error)

	// Search performs a search based on the search parameters.
	// searchParams provides the search parameters.
	// Returns a paged result of found items and an error if any.
	Search(searchParams *S) (response.PagedResult[*T], error)

	// Deleted retrieves the identifiers of deleted items.
	// searchParams provides the search parameters.
	// Returns the list of identifiers of deleted items and an error if any.
	Deleted(searchParams *S) ([]string, error)
}

BaseService defines a generic interface for basic CRUD operations. T represents the type of the item. K represents the type of the item's identifier. S represents the type of the search parameters.

type OrganizationService

type OrganizationService struct {
	Validate *validator.Validate
	// contains filtered or unexported fields
}

func (*OrganizationService) Create

func (*OrganizationService) CreateMany

func (e *OrganizationService) CreateMany(filterContext *repository.OrganizationSearch, items []*model.Organization) ([]*model.Organization, error)

func (*OrganizationService) Delete

func (e *OrganizationService) Delete(filterContext *repository.OrganizationSearch, id uuid.UUID) error

func (*OrganizationService) DeleteMany

func (e *OrganizationService) DeleteMany(filterContext *repository.OrganizationSearch, ids []uuid.UUID) error

func (*OrganizationService) Deleted

func (e *OrganizationService) Deleted(searchParams *repository.OrganizationSearch) ([]string, error)

func (*OrganizationService) FindAll

func (e *OrganizationService) FindAll(filterContext *repository.OrganizationSearch, pageSize int, page int) (response.PagedResult[*model.Organization], error)

func (*OrganizationService) FindById

func (e *OrganizationService) FindById(filterContext *repository.OrganizationSearch, id uuid.UUID) (*model.Organization, error)

func (*OrganizationService) FindByIds

func (e *OrganizationService) FindByIds(filterContext *repository.OrganizationSearch, ids []uuid.UUID) ([]*model.Organization, error)

func (*OrganizationService) Search

func (*OrganizationService) Update

func (*OrganizationService) UpdateMany

func (e *OrganizationService) UpdateMany(filterContext *repository.OrganizationSearch, items []*model.Organization) ([]*model.Organization, error)

type SystemUserOrganizationSearch

type SystemUserOrganizationSearch struct {
	OrganizationType string
	PageSize         int
	PageNumber       int
}

type SystemUserOrganizationService

type SystemUserOrganizationService struct {
	Validate *validator.Validate
	// contains filtered or unexported fields
}

func (*SystemUserOrganizationService) Create

func (*SystemUserOrganizationService) CreateMany

func (*SystemUserOrganizationService) Delete

func (*SystemUserOrganizationService) DeleteMany

func (*SystemUserOrganizationService) Deleted

func (*SystemUserOrganizationService) FindAll

func (*SystemUserOrganizationService) FindById

func (*SystemUserOrganizationService) FindByIds

func (*SystemUserOrganizationService) Search

func (*SystemUserOrganizationService) Update

func (*SystemUserOrganizationService) UpdateMany

type SystemUserService

type SystemUserService struct {
	Validate *validator.Validate
	// contains filtered or unexported fields
}

func (*SystemUserService) DeleteOrgById

func (e *SystemUserService) DeleteOrgById(orgId uuid.UUID) error

func (*SystemUserService) DeleteOrgSystemUserById

func (e *SystemUserService) DeleteOrgSystemUserById(orgId uuid.UUID, userId uuid.UUID) error

func (*SystemUserService) DeleteUserById

func (e *SystemUserService) DeleteUserById(userId uuid.UUID) error

func (*SystemUserService) GetByUserId

func (e *SystemUserService) GetByUserId(userId uuid.UUID) (*model.SystemUser, error)

func (*SystemUserService) GetUserByUserName

func (e *SystemUserService) GetUserByUserName(userName string) (*model.SystemUser, error)

func (*SystemUserService) RegisterOrganization

func (e *SystemUserService) RegisterOrganization(org *model.Organization) (*model.Organization, error)

RegisterOrganization creates an organization

func (*SystemUserService) SearchUserByEmailOrMobile

func (e *SystemUserService) SearchUserByEmailOrMobile(email string, mobileNumber string) (*model.SystemUser, error)

SearchUserByEmailOrMobile finds a user by email of mobile

Jump to

Keyboard shortcuts

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