clojurians-log-v2
clojurians-log-v2 copied to clipboard
Thoughts about slack user schema
https://github.com/oxalorg/clojurians-log-v2/blob/11b4de7bf78455a8329a2692b98488e83d76be21/schema.sql#L23
I got more and more questions and confused when I took a look at Slack user identity and user profile.
Say we need to store avatar image url, it looked like :image
has a pattern that is
BASE_URL?s=${SIZE}&d=FIXED_DATA-${SIZE}.png
Maybe we should consider to generate them instead of storing them all?
{:image_512
"https://secure.gravatar.com/avatar/93bb0380fa58db691b7b54c519f6a69f.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png",
:image_192
"https://secure.gravatar.com/avatar/93bb0380fa58db691b7b54c519f6a69f.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png",
:image_48
"https://secure.gravatar.com/avatar/93bb0380fa58db691b7b54c519f6a69f.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png",
:image_72
"https://secure.gravatar.com/avatar/93bb0380fa58db691b7b54c519f6a69f.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png",
:image_32
"https://secure.gravatar.com/avatar/93bb0380fa58db691b7b54c519f6a69f.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png",
:image_24
"https://secure.gravatar.com/avatar/93bb0380fa58db691b7b54c519f6a69f.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png",
Nice catch!!
Is it worth the hassle though? Even at 20k users, that's just an additional 200k strings stored in the database which seems quite small.
Also I can't find anywhere in the slack docs that guarantee that the URLs will always follow that pattern, what if that is not true for some older slack profiles (before they made it consistent?) 🙈