Split réponses webs de apiresponse -> webresponse

This commit is contained in:
Victor Lacasse-Beaudoin 2023-10-24 17:55:07 -04:00
parent 206b45d41e
commit ce0f387ebd
4 changed files with 37 additions and 30 deletions

View file

@ -26,6 +26,8 @@ ADD templates/ templates/
ADD web_handlers/ web_handlers/ ADD web_handlers/ web_handlers/
Add webresponse/ webresponse/
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o agecem-org . RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o agecem-org .
# Alpine # Alpine

View file

@ -2,8 +2,6 @@ package apiresponse
import ( import (
"net/http" "net/http"
"git.agecem.com/agecem/agecem-org/models"
) )
type Responder interface { type Responder interface {
@ -45,28 +43,3 @@ func InternalServerErrorResponse() (int, SimpleResponse) {
Message: "Internal Server Error", 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
}

View file

@ -10,6 +10,7 @@ import (
"git.agecem.com/agecem/agecem-org/api" "git.agecem.com/agecem/agecem-org/api"
"git.agecem.com/agecem/agecem-org/apiresponse" "git.agecem.com/agecem/agecem-org/apiresponse"
"git.agecem.com/agecem/agecem-org/models" "git.agecem.com/agecem/agecem-org/models"
"git.agecem.com/agecem/agecem-org/webresponse"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
@ -50,7 +51,7 @@ func HandleVieEtudianteOrganisme(c echo.Context) error {
} }
func (h *WebHandler) HandleDocumentation(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() v1BucketListResponse, err := h.ApiClient.ListBuckets()
if err != nil { if err != nil {
@ -131,7 +132,7 @@ func HandleAdmin(c echo.Context) error {
} }
func (h *WebHandler) HandleAdminDocumentsUpload(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() v1BucketListResponse, err := h.ApiClient.ListBuckets()
if err != nil { if err != nil {
@ -154,7 +155,7 @@ func (h *WebHandler) HandleAdminDocumentsUpload(c echo.Context) error {
} }
func (h *WebHandler) HandleAdminDocumentsUploadPOST(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() v1BucketListResponse, err := h.ApiClient.ListBuckets()
if err != nil { if err != nil {

View file

@ -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
}