Skip to content

Commit

Permalink
saving only file_name
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnHarvard committed Nov 25, 2024
1 parent ecefccc commit b2c5761
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/pkg/trips/usecase/trips_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"path"
)

type TripsUsecaseImpl struct {
Expand Down Expand Up @@ -92,8 +93,9 @@ func (u *TripsUsecaseImpl) AddPlaceToTrip(ctx context.Context, tripID uint, plac
}

func (u *TripsUsecaseImpl) AddPhotosToTrip(ctx context.Context, tripID uint, photoPaths []string) error {
for _, path := range photoPaths {
err := u.tripRepo.AddPhotoToTrip(ctx, tripID, path)
for _, fullpath := range photoPaths {
filename := path.Base(fullpath)
err := u.tripRepo.AddPhotoToTrip(ctx, tripID, filename)
if err != nil {
return fmt.Errorf("failed to add photo to trip: %w", err)
}
Expand Down

0 comments on commit b2c5761

Please sign in to comment.