Coder Social home page Coder Social logo

Comments (11)

skushagra9 avatar skushagra9 commented on August 23, 2024 2

Can I work on this ?

from inbox.

cstrnt avatar cstrnt commented on August 23, 2024 1

between

Agree! We could prefix the nanoId with the type so it ends up like _. Unkey is doing that (as well as stripe) and I love that

from inbox.

McPizza0 avatar McPizza0 commented on August 23, 2024 1

prefix the nanoId with the type so it ends up like _.

good idea, updated issue description
we good to go @cstrnt ?

from inbox.

cstrnt avatar cstrnt commented on August 23, 2024 1

Looks good to me. Should be scoped well enough for implementation

from inbox.

cstrnt avatar cstrnt commented on August 23, 2024

I would honestly just add a field to each model in the db schema like avatarUrl which can be nullable.
This allows us to not fetch the avatar if there isn't one or just default to some other URL :)

Also makes caching less of an issue since we aren't just re-using the same URL but rather generate a new URL for the avatar. Therefore we can just mark the old avatar as immutable and cache it on the CDN and browser forever

from inbox.

skushagra9 avatar skushagra9 commented on August 23, 2024

@cstrnt are you working on this ??

from inbox.

cstrnt avatar cstrnt commented on August 23, 2024

@skushagra9 nope, I think we should still discuss a little about the implementation and its implications before we do that. Feel free to leave your thoughts here

from inbox.

McPizza0 avatar McPizza0 commented on August 23, 2024

I would honestly just add a field to each model in the db schema like avatarUrl which can be nullable.
This is how we had it when using cloudflare images
switched to current method to ensure that unused (replaced) avatars dont take up unnecessary storage space

we could achieve the same as your proposal by having avatar = true in the db instead of a url
and pass that to the avatar component

though this dosnt solve the caching issue

from inbox.

cstrnt avatar cstrnt commented on August 23, 2024

That's right, both solutions have advantages and disadvantages. I personally lean towards the solution of storing the url in the db (reference: dub)

from inbox.

McPizza0 avatar McPizza0 commented on August 23, 2024

thought about this some more
i agree with your approach @cstrnt but we should store an avatarId (not full url) in the tables.
the url would end up being the storage app url which may change over time (CDN, regions, AGI etc)

we can generate this avatarId using nanoIdLong from utils package (32 char length alphanumeric id)

Q: when uploading to s3, current path format is /avatars/${type}/${profile.publicId} - do we keep type as a separation between avatar types, or merge all into one path?

from inbox.

McPizza0 avatar McPizza0 commented on August 23, 2024

updated issue description

from inbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.