Documentation
¶
Index ¶
- type WorkLocationService
- func (s *WorkLocationService) CreateWorkLocation(data *models.WorkLocationModel) error
- func (s *WorkLocationService) DeleteWorkLocation(id string) error
- func (s *WorkLocationService) FindAllWorkLocations(request *http.Request) (paginate.Page, error)
- func (s *WorkLocationService) GetWorkLocationByEmployee(employee *models.EmployeeModel) (*models.WorkLocationModel, error)
- func (s *WorkLocationService) GetWorkLocationByID(id string) (*models.WorkLocationModel, error)
- func (s *WorkLocationService) UpdateWorkLocation(id string, data *models.WorkLocationModel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WorkLocationService ¶
type WorkLocationService struct {
// contains filtered or unexported fields
}
func NewWorkLocationService ¶
func NewWorkLocationService(db *gorm.DB, ctx *context.ERPContext) *WorkLocationService
NewWorkLocationService creates a new instance of WorkLocationService.
The WorkLocationService is a service that provides operations to manipulate work locations.
The service requires a Gorm database and an ERP context.
func (*WorkLocationService) CreateWorkLocation ¶
func (s *WorkLocationService) CreateWorkLocation(data *models.WorkLocationModel) error
CreateWorkLocation creates a new work location.
The function takes a WorkLocationModel pointer and creates a new work location in the database.
The function returns an error if the creation failed.
func (*WorkLocationService) DeleteWorkLocation ¶
func (s *WorkLocationService) DeleteWorkLocation(id string) error
DeleteWorkLocation deletes a work location in the database.
The function takes a work location ID and attempts to delete the work location with the given ID from the database. If the deletion is successful, the function returns nil. If the deletion operation fails, the function returns an error.
func (*WorkLocationService) FindAllWorkLocations ¶
func (*WorkLocationService) GetWorkLocationByEmployee ¶
func (s *WorkLocationService) GetWorkLocationByEmployee(employee *models.EmployeeModel) (*models.WorkLocationModel, error)
GetWorkLocationByEmployee retrieves a work location associated with a specific employee.
It takes an EmployeeModel pointer as input and returns a pointer to a WorkLocationModel and an error if the operation fails. The function uses GORM to retrieve the work location data using the employee ID as the identifier. If the operation fails, an error is returned.
func (*WorkLocationService) GetWorkLocationByID ¶
func (s *WorkLocationService) GetWorkLocationByID(id string) (*models.WorkLocationModel, error)
GetWorkLocationByID retrieves a work location from the database by ID.
It takes an ID as input and returns a pointer to a WorkLocationModel and an error. The function uses GORM to retrieve the work location data from the work_locations table. If the operation fails, an error is returned.
func (*WorkLocationService) UpdateWorkLocation ¶
func (s *WorkLocationService) UpdateWorkLocation(id string, data *models.WorkLocationModel) error