2024-08-24 19:21:01 +07:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"connectrpc.com/connect"
|
|
|
|
"github.com/tigorlazuardi/bluemage/go/api"
|
2024-08-25 12:43:57 +07:00
|
|
|
"github.com/tigorlazuardi/bluemage/go/gen/converter"
|
2024-08-24 19:21:01 +07:00
|
|
|
images "github.com/tigorlazuardi/bluemage/go/gen/proto/images/v1"
|
2024-08-25 12:43:57 +07:00
|
|
|
"github.com/tigorlazuardi/bluemage/go/pkg/errs"
|
2024-08-24 19:21:01 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
type ImageHandler struct {
|
|
|
|
API *api.API
|
|
|
|
}
|
|
|
|
|
2024-08-25 12:43:57 +07:00
|
|
|
var imageConverter = converter.ImageConverterImpl{}
|
|
|
|
|
2024-08-24 19:21:01 +07:00
|
|
|
func (im *ImageHandler) ListImages(ctx context.Context, request *connect.Request[images.ListImagesRequest]) (*connect.Response[images.ListImagesResponse], error) {
|
2024-08-25 12:43:57 +07:00
|
|
|
listRequest := imageConverter.ProtoListImagesRequestToAPIImagesRequest(request.Msg)
|
|
|
|
|
|
|
|
list, err := im.API.ImageList(ctx, listRequest)
|
|
|
|
if err != nil {
|
|
|
|
return nil, errs.IntoConnectError(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
_ = list
|
|
|
|
|
2024-08-24 19:21:01 +07:00
|
|
|
panic("not implemented") // TODO: Implement
|
|
|
|
}
|
|
|
|
|
|
|
|
func (im *ImageHandler) DeleteImages(ctx context.Context, request *connect.Request[images.DeleteImagesRequest]) (*connect.Response[images.DeleteImagesResponse], error) {
|
|
|
|
panic("not implemented") // TODO: Implement
|
|
|
|
}
|
|
|
|
|
|
|
|
func (im *ImageHandler) GetImage(ctx context.Context, request *connect.Request[images.GetImageRequest]) (*connect.Response[images.GetImageResponse], error) {
|
|
|
|
panic("not implemented") // TODO: Implement
|
|
|
|
}
|