fix issues
This commit is contained in:
@@ -5,11 +5,13 @@ import (
|
||||
|
||||
"datarush/internal/competition/domain"
|
||||
pb "datarush/pkg/api/competition"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ICompetitionService defines the interface for business logic.
|
||||
@@ -72,7 +74,7 @@ func (h *CompetitionHandler) EditCompetition(ctx context.Context, req *pb.Compet
|
||||
return fromDomainCompetition(updatedComp), nil
|
||||
}
|
||||
|
||||
func (h *CompetitionHandler) DeleteCompetition(ctx context.Context, req *pb.DeleteCompetitionRequest) (*pb.DeleteCompetitionResponse, error) {
|
||||
func (h *CompetitionHandler) DeleteCompetition(ctx context.Context, req *pb.DeleteCompetitionRequest) (*emptypb.Empty, error) {
|
||||
id, err := uuid.Parse(req.GetCompetitionId())
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid competition id format")
|
||||
@@ -80,7 +82,7 @@ func (h *CompetitionHandler) DeleteCompetition(ctx context.Context, req *pb.Dele
|
||||
if err := h.service.DeleteCompetition(ctx, id); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to delete competition: %v", err)
|
||||
}
|
||||
return &pb.DeleteCompetitionResponse{Success: true}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func (h *CompetitionHandler) ListCompetitions(ctx context.Context, req *pb.ListCompetitionsRequest) (*pb.ListCompetitionsResponse, error) {
|
||||
@@ -196,4 +198,4 @@ func toDomainCompetitionType(ct pb.CompetitionType) domain.CompetitionType {
|
||||
|
||||
func fromDomainCompetitionType(ct domain.CompetitionType) pb.CompetitionType {
|
||||
return pb.CompetitionType(pb.CompetitionType_value["COMPETITION_TYPE_"+string(ct)])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user