diff --git a/Dockerfile b/Dockerfile index d2396ae..73284c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,8 @@ ADD templates/ templates/ ADD web_handlers/ web_handlers/ +Add webresponse/ webresponse/ + RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o agecem-org . # Alpine diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 6df6774..d4e98da 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -2,8 +2,6 @@ package apiresponse import ( "net/http" - - "git.agecem.com/agecem/agecem-org/models" ) type Responder interface { @@ -45,28 +43,3 @@ func InternalServerErrorResponse() (int, SimpleResponse) { Message: "Internal Server Error", } } - -type HandleAdminDocumentsUploadResponse struct { - Response - Data struct { - Buckets []models.Bucket - } -} - -type HandleDocumentationResponse struct { - Response - Data struct { - Buckets []models.Bucket - } -} - -type UploadDocumentResponse struct { - Response - Data UploadDocumentResponseData -} - -type UploadDocumentResponseData struct { - Bucket string - Object string - Size float64 -} diff --git a/web_handlers/web_handlers.go b/web_handlers/web_handlers.go index 8582c69..293666e 100644 --- a/web_handlers/web_handlers.go +++ b/web_handlers/web_handlers.go @@ -10,6 +10,7 @@ import ( "git.agecem.com/agecem/agecem-org/api" "git.agecem.com/agecem/agecem-org/apiresponse" "git.agecem.com/agecem/agecem-org/models" + "git.agecem.com/agecem/agecem-org/webresponse" "github.com/labstack/echo/v4" ) @@ -50,7 +51,7 @@ func HandleVieEtudianteOrganisme(c echo.Context) error { } func (h *WebHandler) HandleDocumentation(c echo.Context) error { - var response apiresponse.HandleDocumentationResponse + var response webresponse.HandleDocumentationResponse v1BucketListResponse, err := h.ApiClient.ListBuckets() if err != nil { @@ -131,7 +132,7 @@ func HandleAdmin(c echo.Context) error { } func (h *WebHandler) HandleAdminDocumentsUpload(c echo.Context) error { - var response apiresponse.HandleAdminDocumentsUploadResponse + var response webresponse.HandleAdminDocumentsUploadResponse v1BucketListResponse, err := h.ApiClient.ListBuckets() if err != nil { @@ -154,7 +155,7 @@ func (h *WebHandler) HandleAdminDocumentsUpload(c echo.Context) error { } func (h *WebHandler) HandleAdminDocumentsUploadPOST(c echo.Context) error { - var response apiresponse.HandleAdminDocumentsUploadResponse + var response webresponse.HandleAdminDocumentsUploadResponse v1BucketListResponse, err := h.ApiClient.ListBuckets() if err != nil { diff --git a/webresponse/webresponse.go b/webresponse/webresponse.go new file mode 100644 index 0000000..b17b463 --- /dev/null +++ b/webresponse/webresponse.go @@ -0,0 +1,31 @@ +package webresponse + +import ( + "git.agecem.com/agecem/agecem-org/apiresponse" + "git.agecem.com/agecem/agecem-org/models" +) + +type HandleAdminDocumentsUploadResponse struct { + apiresponse.Response + Data struct { + Buckets []models.Bucket + } +} + +type HandleDocumentationResponse struct { + apiresponse.Response + Data struct { + Buckets []models.Bucket + } +} + +type UploadDocumentResponse struct { + apiresponse.Response + Data UploadDocumentResponseData +} + +type UploadDocumentResponseData struct { + Bucket string + Object string + Size float64 +}