generated from PenaSide/GolangTemplate
fix: remove linter that dosn't allow add todo on the top of the func
This commit is contained in:
parent
0a232e505d
commit
66fd4545a7
@ -44,7 +44,7 @@ linters:
|
|||||||
- revive
|
- revive
|
||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- stylecheck
|
# - stylecheck
|
||||||
- thelper
|
- thelper
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
type historyService interface {
|
type historyService interface {
|
||||||
GetHistoryList(context.Context, *dto.GetHistories) (*models.PaginationResponse[models.History], errors.Error)
|
GetHistoryList(context.Context, *dto.GetHistories) (*models.PaginationResponse[models.History], errors.Error)
|
||||||
GetRecentTariffs(context.Context, string) ([]models.TariffID, errors.Error) //new
|
GetRecentTariffs(context.Context, string) ([]models.TariffID, errors.Error) // new
|
||||||
}
|
}
|
||||||
|
|
||||||
type Deps struct {
|
type Deps struct {
|
||||||
@ -71,7 +71,7 @@ func (receiver *Controller) GetHistoryList(ctx echo.Context, params swagger.GetH
|
|||||||
return ctx.JSON(http.StatusOK, histories)
|
return ctx.JSON(http.StatusOK, histories)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:tests
|
// TODO:tests.
|
||||||
func (receiver *Controller) GetRecentTariffs(ctx echo.Context) error {
|
func (receiver *Controller) GetRecentTariffs(ctx echo.Context) error {
|
||||||
userID, ok := ctx.Get(models.AuthJWTDecodedUserIDKey).(string)
|
userID, ok := ctx.Get(models.AuthJWTDecodedUserIDKey).(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -3,9 +3,7 @@ package repository
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"log"
|
"log"
|
||||||
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/fields"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
@ -14,6 +12,7 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/dto"
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/dto"
|
||||||
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/errors"
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/errors"
|
||||||
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/fields"
|
||||||
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
|
||||||
mongoWrapper "penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/mongo"
|
mongoWrapper "penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/mongo"
|
||||||
)
|
)
|
||||||
@ -111,9 +110,8 @@ func (receiver *HistoryRepository) CountAll(ctx context.Context, dto *dto.GetHis
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO:tests
|
// TODO:tests
|
||||||
// GetRecentTariffs method for processing a user request with data aggregation with a limit of 100 sorted in descending order
|
// GetRecentTariffs method for processing a user request with data aggregation with a limit of 100 sorted in descending order.
|
||||||
func (receiver *HistoryRepository) GetRecentTariffs(ctx context.Context, userID string) ([]models.TariffID, errors.Error) {
|
func (receiver *HistoryRepository) GetRecentTariffs(ctx context.Context, userID string) ([]models.TariffID, errors.Error) {
|
||||||
|
|
||||||
matchStage := bson.D{
|
matchStage := bson.D{
|
||||||
{Key: "$match", Value: bson.D{
|
{Key: "$match", Value: bson.D{
|
||||||
{Key: fields.History.UserID, Value: userID},
|
{Key: fields.History.UserID, Value: userID},
|
||||||
|
@ -16,7 +16,7 @@ type historyRepository interface {
|
|||||||
CountAll(context.Context, *dto.GetHistories) (int64, errors.Error)
|
CountAll(context.Context, *dto.GetHistories) (int64, errors.Error)
|
||||||
FindMany(context.Context, *dto.GetHistories) ([]models.History, errors.Error)
|
FindMany(context.Context, *dto.GetHistories) ([]models.History, errors.Error)
|
||||||
Insert(context.Context, *models.History) (*models.History, errors.Error)
|
Insert(context.Context, *models.History) (*models.History, errors.Error)
|
||||||
GetRecentTariffs(context.Context, string) ([]models.TariffID, errors.Error) //new
|
GetRecentTariffs(context.Context, string) ([]models.TariffID, errors.Error) // new
|
||||||
}
|
}
|
||||||
|
|
||||||
type Deps struct {
|
type Deps struct {
|
||||||
@ -92,9 +92,8 @@ func (receiver *Service) CreateHistory(ctx context.Context, history *models.Hist
|
|||||||
return createdHistory, nil
|
return createdHistory, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:tests
|
// TODO:tests.
|
||||||
func (receiver *Service) GetRecentTariffs(ctx context.Context, userID string) ([]models.TariffID, errors.Error) {
|
func (receiver *Service) GetRecentTariffs(ctx context.Context, userID string) ([]models.TariffID, errors.Error) {
|
||||||
|
|
||||||
if userID == "" {
|
if userID == "" {
|
||||||
receiver.logger.Error("user id is missing in <GetRecentTariffs> of <HistoryService>")
|
receiver.logger.Error("user id is missing in <GetRecentTariffs> of <HistoryService>")
|
||||||
return nil, errors.New(
|
return nil, errors.New(
|
||||||
|
Loading…
Reference in New Issue
Block a user