Skip to content

Commit

Permalink
Why do you call this API two times??
Browse files Browse the repository at this point in the history
  • Loading branch information
petyos committed May 3, 2024
1 parent e608ce1 commit 967f08a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions driven/image/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func (im Adapter) ProcessImage(item model.WebToolsEvent) (*model.ContentImagesUR
return nil, err
}

if webtoolsImage == nil {
im.logger.Infof("no webtools image for %s", item.EventID)
return nil, nil
}

//upload
uploadImageFromContent, err := im.uploadImageFromContent(webtoolsImage.ImageData,
webtoolsImage.Height, webtoolsImage.Width, webtoolsImage.Quality,
Expand All @@ -62,6 +67,7 @@ func (im Adapter) ProcessImage(item model.WebToolsEvent) (*model.ContentImagesUR
return &res, nil
}

// Why do you call this API two times??
func (im Adapter) downloadWebtoolImages(item model.WebToolsEvent) (*model.ImageData, error) {
var webtoolImage model.ImageData
currentAppConfig := "https://calendars.illinois.edu/eventImage"
Expand Down Expand Up @@ -140,7 +146,7 @@ func (im Adapter) downloadWebtoolImages(item model.WebToolsEvent) (*model.ImageD
return nil, nil
}
webtoolImage = model.ImageData{ImageData: imageData, Height: height, Width: width,
Quality: 100, Path: "event/tout", FileName: filename}
Quality: 100, Path: "event/tout/tmp", FileName: filename}
}
return &webtoolImage, nil
}
Expand All @@ -156,7 +162,6 @@ func (im Adapter) uploadImageFromContent(imageData []byte, height int, width int
fmt.Println("Error:", err)
return "", err
}
fmt.Println("Response:", respData)

type response struct {
URL string `json:"url"`
Expand Down

0 comments on commit 967f08a

Please sign in to comment.