refactor/unit-dropping: done

This commit is contained in:
2025-12-11 17:51:08 +07:00
parent c7f2876e6e
commit 261f3cdeb3
82 changed files with 330 additions and 2765 deletions
@@ -49,19 +49,19 @@ func UpdateStatus(input *e.Encounter) error {
return helper.DoJsonRequest(input, "PATCH", endpoint)
}
func RequestSwitchUnit(input *e.Encounter) error {
func RequestSwitchSpecialist(input *e.Encounter) error {
prefixEndpoint := getPrefixEndpoint()
endpoint := fmt.Sprintf("%s/%v/req-switch-unit", prefixEndpoint, input.Id)
return helper.DoJsonRequest(input, "PATCH", endpoint)
}
func ApproveSwitchUnit(input *e.ApproveCancelUnitDto) error {
func ApproveSwitchSpecialist(input *e.ApproveCancelSpecialistDto) error {
prefixEndpoint := getPrefixEndpoint()
endpoint := fmt.Sprintf("%s/%v/approve-switch-unit", prefixEndpoint, input.Id)
return helper.DoJsonRequest(input, "PATCH", endpoint)
}
func CancelSwitchUnit(input *e.ApproveCancelUnitDto) error {
func CancelSwitchSpecialist(input *e.ApproveCancelSpecialistDto) error {
prefixEndpoint := getPrefixEndpoint()
endpoint := fmt.Sprintf("%s/%v/cancel-switch-unit", prefixEndpoint, input.Id)
return helper.DoJsonRequest(input, "PATCH", endpoint)
@@ -1,37 +0,0 @@
package unit
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/unit"
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/unit", sync.O.TargetHost, sync.O.Prefix)
}