48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package personal_information
|
|
|
|
import (
|
|
"astra-api-gateway/config"
|
|
"astra-api-gateway/pkg/api"
|
|
"github.com/labstack/echo/v4"
|
|
"net/http"
|
|
)
|
|
|
|
func GetPDList(c echo.Context) error {
|
|
data, err, resp := api.GetRequest(
|
|
config.Env.MSHosts.PersonsHost+"/persons/",
|
|
c.Request().Header, c.Request().URL.RawQuery)
|
|
|
|
if err != nil {
|
|
return c.NoContent(http.StatusBadGateway)
|
|
}
|
|
|
|
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
|
}
|
|
|
|
func GetPD(c echo.Context) error {
|
|
id := c.Param("id")
|
|
|
|
data, err, resp := api.GetRequest(
|
|
config.Env.MSHosts.PersonsHost+"/persons/"+id,
|
|
c.Request().Header, c.Request().URL.RawQuery)
|
|
|
|
if err != nil {
|
|
return c.NoContent(http.StatusBadGateway)
|
|
}
|
|
|
|
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
|
}
|
|
|
|
func CreatePD(c echo.Context) error {
|
|
data, err, resp := api.PostRequest(
|
|
config.Env.MSHosts.EventsHost+"/persons/",
|
|
c.Request().Body,
|
|
c.Request().Header)
|
|
|
|
if err != nil {
|
|
return c.NoContent(http.StatusBadGateway)
|
|
}
|
|
|
|
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
|
}
|