37 lines
878 B
Go
37 lines
878 B
Go
package request
|
|
|
|
import (
|
|
"furtuna-be/internal/constants/branch"
|
|
"furtuna-be/internal/entity"
|
|
)
|
|
|
|
type BranchParam struct {
|
|
Search string `form:"search" json:"search" example:"Ketua Umum"`
|
|
Name string `form:"name" json:"name" example:"Ketua Umum"`
|
|
Limit int `form:"limit" json:"limit" example:"10"`
|
|
Offset int `form:"offset" json:"offset" example:"0"`
|
|
}
|
|
|
|
func (p *BranchParam) ToEntity() entity.BranchSearch {
|
|
return entity.BranchSearch{
|
|
Search: p.Search,
|
|
Name: p.Name,
|
|
Limit: p.Limit,
|
|
Offset: p.Offset,
|
|
}
|
|
}
|
|
|
|
type Branch struct {
|
|
Name string `json:"name" validate:"required"`
|
|
Location string `json:"location" validate:"required"`
|
|
Status branch.BranchStatus `json:"status"`
|
|
}
|
|
|
|
func (e *Branch) ToEntity() *entity.Branch {
|
|
return &entity.Branch{
|
|
Name: e.Name,
|
|
Location: e.Location,
|
|
Status: e.Status,
|
|
}
|
|
}
|