30 lines
668 B
Go
30 lines
668 B
Go
package translators
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.mstar.dev/mstar/linstrom/config"
|
|
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
|
)
|
|
|
|
func EmoteTagFromStorage(ctx context.Context, id string) (*Tag, error) {
|
|
emote, err := dbgen.Emote.Where(dbgen.Emote.ID.Eq(id)).First()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
emoteId := config.GlobalConfig.General.GetFullPublicUrl() + "/api/activitypub/emote/" + id
|
|
emoteMedia, err := MediaFromStorage(ctx, emote.MetadataId)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := Tag{
|
|
Type: "Emoji",
|
|
Name: emote.Name,
|
|
Href: nil,
|
|
Id: &emoteId,
|
|
Updated: &emote.UpdatedAt,
|
|
Icon: emoteMedia,
|
|
}
|
|
|
|
return &out, nil
|
|
}
|