38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package division
|
|
|
|
import (
|
|
"fmt"
|
|
helper "simrs-vx/internal/use-case/simgos-sync-plugin/new"
|
|
|
|
sync "simrs-vx/internal/infra/sync-consumer-cfg"
|
|
|
|
e "simrs-vx/internal/domain/main-entities/division"
|
|
elog "simrs-vx/internal/domain/sync-entities/log"
|
|
)
|
|
|
|
func Create(input *e.CreateDto) error {
|
|
return helper.DoJsonRequest(input, "POST", getPrefixEndpoint())
|
|
}
|
|
|
|
func CreateLog(input *elog.SimxLogDto) error {
|
|
prefixEndpoint := getPrefixEndpoint()
|
|
endpoint := prefixEndpoint + "/log"
|
|
return helper.DoJsonRequest(input, "POST", endpoint)
|
|
}
|
|
|
|
func Update(input *e.UpdateDto) error {
|
|
prefixEndpoint := getPrefixEndpoint()
|
|
endpoint := fmt.Sprintf("%s/%v", prefixEndpoint, *input.Id)
|
|
return helper.DoJsonRequest(input, "PATCH", endpoint)
|
|
}
|
|
|
|
func Delete(input *e.DeleteDto) error {
|
|
prefixEndpoint := getPrefixEndpoint()
|
|
endpoint := fmt.Sprintf("%s/%v", prefixEndpoint, *input.Id)
|
|
return helper.DoJsonRequest(input, "DELETE", endpoint)
|
|
}
|
|
|
|
func getPrefixEndpoint() string {
|
|
return fmt.Sprintf("%s%s/v1/division", sync.O.TargetHost, sync.O.Prefix)
|
|
}
|