Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cloudinary driver for goravel #4

Merged
merged 18 commits into from
Sep 5, 2023
Merged

refactor: cloudinary driver for goravel #4

merged 18 commits into from
Sep 5, 2023

Conversation

kkumar-gcc
Copy link
Member

@kkumar-gcc kkumar-gcc commented Jul 30, 2023

Closes #1

πŸ“‘ Description

This PR will remove unnecessary folders and clean up code-base for review.

βœ… Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

@kkumar-gcc kkumar-gcc requested a review from hwbrzzl July 30, 2023 10:09
hwbrzzl
hwbrzzl previously approved these changes Jul 30, 2023
Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! A few questions.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
service_provider.go Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
cloudinary_test.go Outdated Show resolved Hide resolved
cloudinary_test.go Outdated Show resolved Hide resolved
utils.go Outdated Show resolved Hide resolved
@hwbrzzl
Copy link
Contributor

hwbrzzl commented Jul 30, 2023

Please add the .github folder like this: https://github.com/goravel/redis/tree/master/.github

@kkumar-gcc kkumar-gcc changed the title Refactor code refactor: cloudinary driver for goravel Jul 31, 2023
@kkumar-gcc kkumar-gcc requested a review from hwbrzzl August 2, 2023 06:06
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
utils.go Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
cloudinary.go Outdated Show resolved Hide resolved
cloudinary.go Outdated
func (r *Cloudinary) getResourceType(path string) string {
extension := strings.TrimPrefix(filepath.Ext(path), ".")
value := "image"
resourceTypes := r.config.Get(fmt.Sprintf("filesystems.disks.%s.resource_types", r.disk), defaultResourcesTypes()).(map[string][]string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be no change here. Based on the below image or range the ResourceTypes. What's your choice?

telegram-cloud-photo-size-5-6246531548778182330-y

@codecov-commenter
Copy link

Codecov Report

Patch has no changes to coverable lines.

πŸ“’ Thoughts on this report? Let us know!.

@kkumar-gcc kkumar-gcc requested a review from hwbrzzl September 4, 2023 13:15
ResourceType: r.getResourceType(path),
})
// TODO: Search if there is a better way to get asset info
assetTypes := []api.AssetType{api.Image, api.Video, api.File}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Why is there no api.Raw?

Copy link
Member Author

@kkumar-gcc kkumar-gcc Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api.File is actually api.Raw.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

@kkumar-gcc kkumar-gcc Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// PutFileAs stores a new file on the disk.
func (r *Cloudinary) PutFileAs(path string, source filesystem.File, name string) (string, error) {
uploadResult, err := r.instance.Upload.Upload(r.ctx, source.File(), uploader.UploadParams{
Folder: validPath(path),
PublicID: r.getPublicId(name),
PublicID: name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Can the name contain extension?

Copy link
Member Author

@kkumar-gcc kkumar-gcc Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are following cloudinary then u shouldn't but it won't give any error.
BUT URL OF FILE will contain two file extensions ie .../filename.png.png.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd better follow the cloudinary suggestion.

Copy link
Member Author

@kkumar-gcc kkumar-gcc Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd better follow the cloudinary suggestion.

Yeah, we are following cloudinay(user's choice).

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! I think we can go ahead after these two optimizations.

go.mod Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kkumar-gcc kkumar-gcc merged commit 9ae569e into master Sep 5, 2023
@kkumar-gcc kkumar-gcc deleted the dev branch September 5, 2023 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

πŸ› [Bug] Some Suggestions
3 participants