Merge branch 'feat/sync-from-simx-160' of https://github.com/dikstub-rssa/simrs-be into feat/sync-setting-vanili
# Conflicts: # internal/infra/sync-cfg/sync-cfg.go # internal/infra/sync-cfg/tycovar.go
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package soapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
sync "simrs-vx/internal/infra/sync-cfg"
|
||||
helper "simrs-vx/internal/use-case/simgos-sync-plugin/new"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/soapi"
|
||||
elog "simrs-vx/internal/domain/sync-entities/log"
|
||||
)
|
||||
|
||||
func Create(input *e.Soapi) 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.Soapi) 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/encounter", sync.O.TargetHost, sync.O.Prefix)
|
||||
}
|
||||
Reference in New Issue
Block a user