Skip to content

Commit

Permalink
feat: pet util extract image ids
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jan 27, 2024
1 parent a56c4aa commit a75fa64
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
- BUCKET_ACCESS_KEY=BUCKET_ACCESS_KEY
- BUCKET_SECRET_KEY=BUCKET_SECRET_KEY
- BUCKET_NAME=johnjud-pet-images
- BUCKET_USE_SSL=false
- BUCKET_USE_SSL=true
ports:
- "3004:3004"
networks:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- BUCKET_ACCESS_KEY=BUCKET_ACCESS_KEY
- BUCKET_SECRET_KEY=BUCKET_SECRET_KEY
- BUCKET_NAME=johnjud-pet-images
- BUCKET_USE_SSL=false
- BUCKET_USE_SSL=true
ports:
- "3004:3004"
networks:
Expand Down
8 changes: 8 additions & 0 deletions src/app/utils/pet/pet.utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ func ExtractImageUrls(in []*imageProto.Image) []string {
return result
}

func ExtractImageIDs(in []*imageProto.Image) []string {
var result []string
for _, e := range in {
result = append(result, e.Id)
}
return result
}

func parseDate(dateStr string) (time.Time, error) {
parsedTime, err := time.Parse(time.RFC3339, dateStr)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions src/mocks/image/image.mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ func (c *ServiceMock) FindByPetId(petId string) (res []*proto.Image, err error)

return res, args.Error(1)
}

func (c *ServiceMock) AssignPet(petId string, imageIds []string) (err error) {
args := c.Called(petId, imageIds)

return args.Error(1)
}

0 comments on commit a75fa64

Please sign in to comment.