Skip to content

Commit

Permalink
fix all linter mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
Qaleka committed Dec 16, 2024
1 parent 8604339 commit 8d3c3c7
Show file tree
Hide file tree
Showing 8 changed files with 401 additions and 78 deletions.
2 changes: 1 addition & 1 deletion internal/service/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestJwtToken_Validate(t *testing.T) {

// Валидация истёкшего токена
expiredTime := time.Now().Add(-1 * time.Hour).Unix()
expiredToken, err := jwtService.Create(session, expiredTime)
expiredToken, _ := jwtService.Create(session, expiredTime)

_, err = jwtService.Validate(expiredToken, session)
assert.Error(t, err)
Expand Down
58 changes: 44 additions & 14 deletions microservices/ads_service/mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,32 @@ func (m *MockAdUseCase) GetUserPlaces(ctx context.Context, userId string) ([]dom
}

type MockAdRepository struct {
MockGetAllPlaces func(ctx context.Context, filter domain.AdFilter) ([]domain.GetAllAdsResponse, error)
MockGetPlaceById func(ctx context.Context, adId string) (domain.GetAllAdsResponse, error)
MockUpdateViewsCount func(ctx context.Context, ad domain.GetAllAdsResponse) (domain.GetAllAdsResponse, error)
MockCreatePlace func(ctx context.Context, ad *domain.Ad, newAd domain.CreateAdRequest, userId string) error
MockSavePlace func(ctx context.Context, ad *domain.Ad) error
MockUpdatePlace func(ctx context.Context, ad *domain.Ad, adId string, userId string, updatedAd domain.UpdateAdRequest) error
MockDeletePlace func(ctx context.Context, adId string, userId string) error
MockGetPlacesPerCity func(ctx context.Context, city string) ([]domain.GetAllAdsResponse, error)
MockSaveImages func(ctx context.Context, adUUID string, imagePaths []string) error
MockGetAdImages func(ctx context.Context, adId string) ([]string, error)
MockGetUserPlaces func(ctx context.Context, userId string) ([]domain.GetAllAdsResponse, error)
MockDeleteAdImage func(ctx context.Context, adId string, imageId int, userId string) (string, error)
MockGetAllPlaces func(ctx context.Context, filter domain.AdFilter, userId string) ([]domain.GetAllAdsResponse, error)
MockGetPlaceById func(ctx context.Context, adId string) (domain.GetAllAdsResponse, error)
MockUpdateViewsCount func(ctx context.Context, ad domain.GetAllAdsResponse) (domain.GetAllAdsResponse, error)
MockCreatePlace func(ctx context.Context, ad *domain.Ad, newAd domain.CreateAdRequest, userId string) error
MockSavePlace func(ctx context.Context, ad *domain.Ad) error
MockUpdatePlace func(ctx context.Context, ad *domain.Ad, adId string, userId string, updatedAd domain.UpdateAdRequest) error
MockDeletePlace func(ctx context.Context, adId string, userId string) error
MockGetPlacesPerCity func(ctx context.Context, city string) ([]domain.GetAllAdsResponse, error)
MockSaveImages func(ctx context.Context, adUUID string, imagePaths []string) error
MockGetAdImages func(ctx context.Context, adId string) ([]string, error)
MockGetUserPlaces func(ctx context.Context, userId string) ([]domain.GetAllAdsResponse, error)
MockDeleteAdImage func(ctx context.Context, adId string, imageId int, userId string) (string, error)
MockAddToFavorites func(ctx context.Context, adId string, userId string) error
MockDeleteFromFavorites func(ctx context.Context, adId string, userId string) error
MockGetUserFavorites func(ctx context.Context, userId string) ([]domain.GetAllAdsResponse, error)
MockUpdateFavoritesCount func(ctx context.Context, adId string) error
MockUpdatePriority func(ctx context.Context, adId string, userId string, amount int) error
MockResetExpiredPriorities func(ctx context.Context) error
}

func (m *MockAdRepository) DeleteAdImage(ctx context.Context, adId string, imageId int, userId string) (string, error) {
return m.MockDeleteAdImage(ctx, adId, imageId, userId)
}

func (m *MockAdRepository) GetAllPlaces(ctx context.Context, filter domain.AdFilter) ([]domain.GetAllAdsResponse, error) {
return m.MockGetAllPlaces(ctx, filter)
func (m *MockAdRepository) GetAllPlaces(ctx context.Context, filter domain.AdFilter, userId string) ([]domain.GetAllAdsResponse, error) {
return m.MockGetAllPlaces(ctx, filter, userId)
}

func (m *MockAdRepository) GetPlaceById(ctx context.Context, adId string) (domain.GetAllAdsResponse, error) {
Expand Down Expand Up @@ -161,6 +167,30 @@ func (m *MockAdRepository) GetUserPlaces(ctx context.Context, userId string) ([]
return m.MockGetUserPlaces(ctx, userId)
}

func (m *MockAdRepository) AddToFavorites(ctx context.Context, adId string, userId string) error {
return m.MockAddToFavorites(ctx, adId, userId)
}

func (m *MockAdRepository) DeleteFromFavorites(ctx context.Context, adId string, userId string) error {
return m.MockDeleteFromFavorites(ctx, adId, userId)
}

func (m *MockAdRepository) GetUserFavorites(ctx context.Context, userId string) ([]domain.GetAllAdsResponse, error) {
return m.MockGetUserFavorites(ctx, userId)
}

func (m *MockAdRepository) UpdateFavoritesCount(ctx context.Context, adId string) error {
return m.MockUpdateFavoritesCount(ctx, adId)
}

func (m *MockAdRepository) UpdatePriority(ctx context.Context, adId string, userId string, amount int) error {
return m.MockUpdatePriority(ctx, adId, userId, amount)
}

func (m *MockAdRepository) ResetExpiredPriorities(ctx context.Context) error {
return m.MockResetExpiredPriorities(ctx)
}

type MockMinioService struct {
UploadFileFunc func(file []byte, contentType, id string) (string, error)
DeleteFileFunc func(filePath string) error
Expand Down
Loading

0 comments on commit 8d3c3c7

Please sign in to comment.