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

Add Avram to the ORM adapter roadmap #1

Open
watzon opened this issue Dec 10, 2019 · 20 comments
Open

Add Avram to the ORM adapter roadmap #1

watzon opened this issue Dec 10, 2019 · 20 comments
Labels
enhancement New feature or request

Comments

@watzon
Copy link
Contributor

watzon commented Dec 10, 2019

Avram is the Lucky Framework's ORM, and as Lucky is currently one of the best built (my opinion) and most popular web frameworks for Crystal it would make sense to make an adapter for it. I'd be happy to work on it as soon as another adapter has been written for me to go off of.

@igor-alexandrov
Copy link
Member

Done. I am currently working on Attacher class, that will give an ability to start working on a ORM adapters (you can read more about it here: https://twin.github.io/upcoming-features-in-shrine-3-0).

As soon as Attacher will be done, I will notify you.

@watzon
Copy link
Contributor Author

watzon commented Dec 10, 2019

Perfect. I just need that and a working S3/Minio backend and I'll be golden. Thanks for this!

@igor-alexandrov
Copy link
Member

@watzon what best (at least working) library for AWS S3 you can suggest?

@watzon
Copy link
Contributor Author

watzon commented Dec 10, 2019

There's only one existing library that I know of, and I don't know if it's been kept up to date. I'll look into it tomorrow for sure.

@igor-alexandrov
Copy link
Member

I added new issue: #2, let's continue discussion about S3 in it.

@wout
Copy link
Contributor

wout commented Jan 13, 2020

I am in the same boat as @watzon. Having Attacher and AWS S3 support would be awesome.

@igor-alexandrov
Copy link
Member

@wout I am currently working on Attacher. Will try to find somebody to implement S3 support.

@wout
Copy link
Contributor

wout commented Jan 13, 2020

@igor-alexandrov Great, thanks for letting me know. Just out of interest, are you porting shrine as-is? Or are you putting your twist on it?

@igor-alexandrov
Copy link
Member

@wout I started this as a complete port of Ruby library, but actually it already differs a lot. So I am open to suggestions.

@smadeja
Copy link

smadeja commented Jan 23, 2020

I'm happy to help with implementing S3 and Avram support.

@igor-alexandrov
Copy link
Member

@smadeja the good news is that @Arina1004 is already working on S3 support and I believe we will release it pretty soon. So, let's focus on ORM adapters. I will prepare branch with Shrine::Attacher class tomorrow and we can start.

@igor-alexandrov
Copy link
Member

igor-alexandrov commented Jan 24, 2020

@smadeja, @wout, @watzon I pushed feature/attacher branch.

Now we can start working on ORM adapters. Based on this article https://twin.github.io/upcoming-features-in-shrine-3-0/, it will work like this:

attacher = Shrine::Attacher.new
attacher.assign(file) # uploads file
attacher.file #=> #<Shrine::UploadedFile id="abc123.jpg" storage=:store ...>

# ...

attacher.data #=>
# {
#   "id" => "abc123.jpg",
#   "storage" => "store",
#   "metadata" => {
#     "size" => 9534842,
#     "filename" => "nature.jpg",
#     "mime_type" => "image/jpeg",
#   }
# }

Let's move S3 discussion to the #2, as I already said @Arina1004 is already working on it.

What I am looking for now is:

  • Implement Shrine::Attachment
  • Added first ORM adapter (e.g Avram).

@igor-alexandrov
Copy link
Member

I pushed a code with a Column plugin to feature/attacher branch. Now you can do the following:

Attacher.from_column('{"id":"...","storage":"...","metadata":{...}}')

# ...

attacher.file #=> nil
attacher.load_column('{"id":"...","storage":"...","metadata":{...}}')
attacher.file #=> #<Shrine::UploadedFile>

# ...

attacher.column_data #=> '{"id":"...","storage":"...","metadata":{...}}'

I am still working on specs and final API, but it looks pretty good even now.

@wout
Copy link
Contributor

wout commented Mar 15, 2020

Thanks for your work on this. I'm going to take it for a spin with Avram and report back.

@igor-alexandrov
Copy link
Member

@wout feel free to contact me if you have any questions.

@fernandes
Copy link

hey @igor-alexandrov I could make it work with Avram, my solution is a little bit weird (there are a few points that can be improved), but at least I could make it work with Lucky/Avram/S3

if you'd like we can collaborate to add support to shrine itself (best option 😄 )

thank for all your work on shrine!

@igor-alexandrov
Copy link
Member

@fernandes great! I also started working on Avram integration. Can you please share your code?

@fernandes
Copy link

hello @igor-alexandrov , I isolated and tried to simplify the most I could to make it easier to read, in this first example I'm using local store, after you implement, we can add support for S3 store and provide signed URLs for private images (I got it working with DO and Vultr S3 provider)

the URL signed is just one method, the idea is make it work out of the box on Lucky, but we need to re-use data from the config, possibly we can use Habitat to make it easier to handle

https://gist.github.com/fernandes/31c56b5aa1841643958031dc24c6a86b

@watzon
Copy link
Contributor Author

watzon commented Nov 14, 2020

Wondering if any progress has been made here? I'm once again working on a project where it would be very useful.

@igor-alexandrov
Copy link
Member

@watzon unfortunately no... I hope, I will have time to work on this somewhere in December.

@igor-alexandrov igor-alexandrov added the enhancement New feature or request label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants