@@ -12,7 +12,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq, rsp *pb.CommentsCreateRsp) error {
|
||||
func (h *Handler) CommentCreate(ctx context.Context, req *pb.CommentCreateReq, rsp *pb.CommentCreateRsp) error {
|
||||
logger.Debug(ctx, "Start AddComment")
|
||||
|
||||
err := req.Validate()
|
||||
@@ -23,7 +23,7 @@ func (h *Handler) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq,
|
||||
}
|
||||
|
||||
var com *models.Comment
|
||||
if com, err = h.store.CommentsCreate(ctx, req); err != nil {
|
||||
if com, err = h.store.CommentCreate(ctx, req); err != nil {
|
||||
logger.Error(ctx, err)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
httpsrv.SetRspCode(ctx, http.StatusNotFound)
|
@@ -11,7 +11,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq, rsp *pb.CommentsDeleteRsp) error {
|
||||
func (h *Handler) CommentDelete(ctx context.Context, req *pb.CommentDeleteReq, rsp *pb.CommentDeleteRsp) error {
|
||||
logger.Debug(ctx, "Start AddComment")
|
||||
|
||||
err := req.Validate()
|
||||
@@ -21,7 +21,7 @@ func (h *Handler) CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq,
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
if err = h.store.CommentsDelete(ctx, req); err != nil {
|
||||
if err = h.store.CommentDelete(ctx, req); err != nil {
|
||||
logger.Error(ctx, err)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
httpsrv.SetRspCode(ctx, http.StatusNotFound)
|
@@ -10,7 +10,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) CommentsList(ctx context.Context, req *pb.CommentsListReq, rsp *pb.CommentsListRsp) error {
|
||||
func (h *Handler) CommentList(ctx context.Context, req *pb.CommentListReq, rsp *pb.CommentListRsp) error {
|
||||
logger.Debug(ctx, "Start GetModule")
|
||||
|
||||
err := req.Validate()
|
||||
@@ -20,7 +20,7 @@ func (h *Handler) CommentsList(ctx context.Context, req *pb.CommentsListReq, rsp
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
comments, err := h.store.CommentsList(ctx, req)
|
||||
comments, err := h.store.CommentList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error(ctx, err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
11
internal/handler/comment_lookup.go
Normal file
11
internal/handler/comment_lookup.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||
)
|
||||
|
||||
func (h *Handler) CommentLookup(ctx context.Context, req *pb.CommentLookupReq, rsp *pb.CommentLookupRsp) error {
|
||||
return nil
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||
)
|
||||
|
||||
func (h *Handler) CommentsLookup(ctx context.Context, req *pb.CommentsLookupReq, rsp *pb.CommentsLookupRsp) error {
|
||||
return nil
|
||||
}
|
@@ -12,9 +12,8 @@ import (
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
store storage.Storage
|
||||
codec codec.Codec
|
||||
chanUrl chan *pb.PackagesCreateReq
|
||||
store storage.Storage
|
||||
codec codec.Codec
|
||||
}
|
||||
|
||||
func NewNotFoundError(err error) *pb.ErrorRsp {
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) ModulesList(ctx context.Context, req *pb.ModulesListReq, rsp *pb.ModulesListRsp) error {
|
||||
func (h *Handler) ModuleList(ctx context.Context, req *pb.ModuleListReq, rsp *pb.ModuleListRsp) error {
|
||||
logger.Debug(ctx, "Start GetModule")
|
||||
|
||||
err := req.Validate()
|
||||
@@ -20,7 +20,7 @@ func (h *Handler) ModulesList(ctx context.Context, req *pb.ModulesListReq, rsp *
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
modules, err := h.store.ModulesList(ctx, req)
|
||||
modules, err := h.store.ModuleList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error(ctx, err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq, rsp *pb.PackagesCreateRsp) error {
|
||||
func (h *Handler) PackageCreate(ctx context.Context, req *pb.PackageCreateReq, rsp *pb.PackageCreateRsp) error {
|
||||
logger.Debug(ctx, "PackagesCreate handler start")
|
||||
|
||||
if err := req.Validate(); err != nil {
|
||||
@@ -19,7 +19,7 @@ func (h *Handler) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq,
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
pkg, err := h.store.PackagesCreate(ctx, req)
|
||||
pkg, err := h.store.PackageCreate(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error(ctx, err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
|
@@ -9,7 +9,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq, rsp *pb.PackagesDeleteRsp) error {
|
||||
func (h *Handler) PackageDelete(ctx context.Context, req *pb.PackageDeleteReq, rsp *pb.PackageDeleteRsp) error {
|
||||
logger.Debug(ctx, "Start UpdatePackage")
|
||||
|
||||
if err := req.Validate(); err != nil {
|
||||
@@ -18,7 +18,7 @@ func (h *Handler) PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq,
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
if err := h.store.PackagesDelete(ctx, req); err != nil {
|
||||
if err := h.store.PackageDelete(ctx, req); err != nil {
|
||||
logger.Error(ctx, err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||
return httpsrv.SetError(NewInternalError(err))
|
@@ -10,10 +10,10 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) PackagesList(ctx context.Context, req *pb.PackagesListReq, rsp *pb.PackagesListRsp) error {
|
||||
func (h *Handler) PackageList(ctx context.Context, req *pb.PackageListReq, rsp *pb.PackageListRsp) error {
|
||||
logger.Debug(ctx, "PackagesList handler start")
|
||||
|
||||
packages, err := h.store.PackagesList(ctx, req)
|
||||
packages, err := h.store.PackageList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "error db response: %v", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
@@ -10,7 +10,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) PackagesLookup(ctx context.Context, req *pb.PackagesLookupReq, rsp *pb.PackagesLookupRsp) error {
|
||||
func (h *Handler) PackageLookup(ctx context.Context, req *pb.PackageLookupReq, rsp *pb.PackageLookupRsp) error {
|
||||
logger.Debug(ctx, "Start PackagesLookup")
|
||||
|
||||
if err := req.Validate(); err != nil {
|
||||
@@ -19,7 +19,7 @@ func (h *Handler) PackagesLookup(ctx context.Context, req *pb.PackagesLookupReq,
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
pkg, err := h.store.PackagesLookup(ctx, req)
|
||||
pkg, err := h.store.PackageLookup(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error(ctx, err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
@@ -10,10 +10,10 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) PackagesModules(ctx context.Context, req *pb.PackagesModulesReq, rsp *pb.PackagesModulesRsp) error {
|
||||
logger.Debug(ctx, "PackagesModuleshandler start")
|
||||
func (h *Handler) PackageModules(ctx context.Context, req *pb.PackageModulesReq, rsp *pb.PackageModulesRsp) error {
|
||||
logger.Debug(ctx, "PackageModules handler start")
|
||||
|
||||
modules, err := h.store.PackagesModules(ctx, req)
|
||||
modules, err := h.store.PackageModules(ctx, req)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "error db response: %v", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
@@ -10,7 +10,7 @@ import (
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
func (h *Handler) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq, rsp *pb.PackagesUpdateRsp) error {
|
||||
func (h *Handler) PackageUpdate(ctx context.Context, req *pb.PackageUpdateReq, rsp *pb.PackageUpdateRsp) error {
|
||||
logger.Debug(ctx, "Start UpdatePackage")
|
||||
|
||||
if err := req.Validate(); err != nil {
|
||||
@@ -19,7 +19,7 @@ func (h *Handler) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq,
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
pkg, err := h.store.PackagesUpdate(ctx, req)
|
||||
pkg, err := h.store.PackageUpdate(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error(ctx, err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
Reference in New Issue
Block a user