Refactor du projet réduire le nombre de packages et sous-dossiers #200
3 changed files with 7 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
package models
|
package main
|
||||||
|
|
||||||
type Bucket struct {
|
type Bucket struct {
|
||||||
Name string
|
Name string
|
10
handler.go
10
handler.go
|
@ -11,16 +11,14 @@ import (
|
||||||
"codeberg.org/vlbeaudoin/pave/v2"
|
"codeberg.org/vlbeaudoin/pave/v2"
|
||||||
"codeberg.org/vlbeaudoin/voki/v3"
|
"codeberg.org/vlbeaudoin/voki/v3"
|
||||||
"git.agecem.com/agecem/agecem-org/api"
|
"git.agecem.com/agecem/agecem-org/api"
|
||||||
"git.agecem.com/agecem/agecem-org/config"
|
|
||||||
"git.agecem.com/agecem/agecem-org/media"
|
"git.agecem.com/agecem/agecem-org/media"
|
||||||
"git.agecem.com/agecem/agecem-org/models"
|
|
||||||
"git.agecem.com/agecem/agecem-org/version"
|
"git.agecem.com/agecem/agecem-org/version"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
)
|
)
|
||||||
|
|
||||||
type V1Handler struct {
|
type V1Handler struct {
|
||||||
Config config.Config
|
Config Config
|
||||||
MediaClient *media.MediaClient
|
MediaClient *media.MediaClient
|
||||||
Pave *pave.Pave
|
Pave *pave.Pave
|
||||||
}
|
}
|
||||||
|
@ -628,7 +626,7 @@ func (h *WebHandler) HandleDocumentation(c echo.Context) error {
|
||||||
return c.Render(http.StatusOK, "documentation-html", response)
|
return c.Render(http.StatusOK, "documentation-html", response)
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Data.Buckets = append(response.Data.Buckets, models.Bucket{
|
response.Data.Buckets = append(response.Data.Buckets, Bucket{
|
||||||
Name: bucket,
|
Name: bucket,
|
||||||
DisplayName: displayName,
|
DisplayName: displayName,
|
||||||
Documents: v1BucketReadResponse.Data.Keys,
|
Documents: v1BucketReadResponse.Data.Keys,
|
||||||
|
@ -698,7 +696,7 @@ func (h *WebHandler) HandleAdminDocumentsUpload(c echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for bucketName, displayName := range v1BucketsGET.Data.Buckets {
|
for bucketName, displayName := range v1BucketsGET.Data.Buckets {
|
||||||
response.Data.Buckets = append(response.Data.Buckets, models.Bucket{
|
response.Data.Buckets = append(response.Data.Buckets, Bucket{
|
||||||
Name: bucketName,
|
Name: bucketName,
|
||||||
DisplayName: displayName,
|
DisplayName: displayName,
|
||||||
})
|
})
|
||||||
|
@ -722,7 +720,7 @@ func (h *WebHandler) HandleAdminDocumentsUploadPOST(c echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for bucketName, displayName := range v1BucketsGET.Data.Buckets {
|
for bucketName, displayName := range v1BucketsGET.Data.Buckets {
|
||||||
response.Data.Buckets = append(response.Data.Buckets, models.Bucket{
|
response.Data.Buckets = append(response.Data.Buckets, Bucket{
|
||||||
Name: bucketName,
|
Name: bucketName,
|
||||||
DisplayName: displayName,
|
DisplayName: displayName,
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"codeberg.org/vlbeaudoin/voki/v3"
|
"codeberg.org/vlbeaudoin/voki/v3"
|
||||||
"git.agecem.com/agecem/agecem-org/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIResponse struct {
|
type APIResponse struct {
|
||||||
|
@ -89,7 +88,7 @@ type ReadSpecResponse struct {
|
||||||
type HandleAdminDocumentsUploadResponse struct {
|
type HandleAdminDocumentsUploadResponse struct {
|
||||||
APIResponse
|
APIResponse
|
||||||
Data struct {
|
Data struct {
|
||||||
Buckets []models.Bucket
|
Buckets []Bucket
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ type HandleAdminDocumentsUploadResponse struct {
|
||||||
type HandleDocumentationResponse struct {
|
type HandleDocumentationResponse struct {
|
||||||
APIResponse
|
APIResponse
|
||||||
Data struct {
|
Data struct {
|
||||||
Buckets []models.Bucket
|
Buckets []Bucket
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue