Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-07 02:35:30 +03:00
parent 8729d0b88e
commit c5f3fa325e
42 changed files with 1316 additions and 2009 deletions

View File

@@ -4,16 +4,18 @@ import (
"net/http"
"strconv"
"git.unistack.org/unistack-org/pkgdash/internal/storage"
pb "git.unistack.org/unistack-org/pkgdash/proto"
"github.com/google/uuid"
jsonpbcodec "go.unistack.org/micro-codec-jsonpb/v4"
"go.unistack.org/micro/v4/codec"
jsonpbcodec "go.unistack.org/micro-codec-jsonpb/v3"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/pkgdash/internal/storage"
pb "go.unistack.org/pkgdash/proto"
)
type Handler struct {
store storage.Storage
codec codec.Codec
logger logger.Logger
store storage.Storage
codec codec.Codec
}
func NewNotFoundError(err error) *pb.ErrorRsp {
@@ -43,10 +45,11 @@ func NewValidationError(err error) *pb.ErrorRsp {
}
}
func NewHandler(store storage.Storage) (*Handler, error) {
func NewHandler(log logger.Logger, store storage.Storage) (*Handler, error) {
h := &Handler{
codec: jsonpbcodec.NewCodec(),
store: store,
logger: log,
codec: jsonpbcodec.NewCodec(),
store: store,
}
return h, nil