package personal_information import ( "astra-api-gateway/config" "astra-api-gateway/pkg/api" "github.com/labstack/echo/v4" "net/http" ) func GetPDDocs(c echo.Context) error { data, err, resp := api.GetRequest( config.Env.MSHosts.PersonsHost+"/docs", 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 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) } func CreateDocuments(c echo.Context) error { data, err, resp := api.PostRequest( config.Env.MSHosts.EventsHost+"/documents/", 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) } func CreateContacts(c echo.Context) error { data, err, resp := api.PostRequest( config.Env.MSHosts.EventsHost+"/contacts/", 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) } func CreateAddress(c echo.Context) error { data, err, resp := api.PostRequest( config.Env.MSHosts.EventsHost+"/address/", 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) } func UpdateDocuments(c echo.Context) error { id := c.Param("id") data, err, resp := api.PatchRequest( config.Env.MSHosts.EventsHost+"/documents/"+id, 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) } func UpdateContacts(c echo.Context) error { id := c.Param("id") data, err, resp := api.PatchRequest( config.Env.MSHosts.EventsHost+"/contacts/"+id, 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) } func UpdateAddress(c echo.Context) error { id := c.Param("id") data, err, resp := api.PatchRequest( config.Env.MSHosts.EventsHost+"/address/"+id, 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) } func DeleteDocuments(c echo.Context) error { id := c.Param("id") data, err, resp := api.DeleteRequest( config.Env.MSHosts.EventsHost+"/documents/"+id, c.Request().Header) if err != nil { return c.NoContent(http.StatusBadGateway) } return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data) } func DeleteContacts(c echo.Context) error { id := c.Param("id") data, err, resp := api.DeleteRequest( config.Env.MSHosts.EventsHost+"/contacts/"+id, c.Request().Header) if err != nil { return c.NoContent(http.StatusBadGateway) } return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data) } func DeleteAddress(c echo.Context) error { id := c.Param("id") data, err, resp := api.DeleteRequest( config.Env.MSHosts.EventsHost+"/address/"+id, c.Request().Header) if err != nil { return c.NoContent(http.StatusBadGateway) } return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data) }