Work on getting notes API
This commit is contained in:
parent
f656757710
commit
8a4c19dd17
9 changed files with 153 additions and 11 deletions
|
@ -125,3 +125,60 @@ func convertInfoFieldStorageToLinstrom(field storage.UserInfoField) *linstromCus
|
|||
BelongsToId: field.BelongsTo,
|
||||
}
|
||||
}
|
||||
|
||||
func convertNoteStorageToLinstrom(
|
||||
note *storage.Note,
|
||||
store *storage.Storage,
|
||||
) (*linstromNote, error) {
|
||||
panic("Not implemented")
|
||||
}
|
||||
|
||||
func convertEmoteStorageToLinstrom(
|
||||
emote *storage.Emote,
|
||||
store *storage.Storage,
|
||||
) (*linstromEmote, error) {
|
||||
storageServer, err := store.FindRemoteServerById(emote.ServerId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("server: %w", err)
|
||||
}
|
||||
server, err := convertServerStorageToLinstrom(storageServer, store)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("server conversion: %w", err)
|
||||
}
|
||||
storageMedia, err := store.GetMediaMetadataById(emote.MetadataId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("media metadata: %w", err)
|
||||
}
|
||||
media := convertMediaMetadataStorageToLinstrom(storageMedia)
|
||||
|
||||
return &linstromEmote{
|
||||
Id: emote.ID,
|
||||
MetadataId: emote.MetadataId,
|
||||
Metadata: media,
|
||||
Name: emote.Name,
|
||||
ServerId: emote.ServerId,
|
||||
Server: server,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func convertReactionStorageToLinstrom(
|
||||
reaction *storage.Reaction,
|
||||
store *storage.Storage,
|
||||
) (*linstromReaction, error) {
|
||||
storageEmote, err := store.GetEmoteById(reaction.EmoteId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("emote: %w", err)
|
||||
}
|
||||
emote, err := convertEmoteStorageToLinstrom(storageEmote, store)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("emote conversion: %w", err)
|
||||
}
|
||||
|
||||
return &linstromReaction{
|
||||
Id: reaction.ID,
|
||||
NoteId: reaction.NoteId,
|
||||
ReactorId: reaction.ReactorId,
|
||||
EmoteId: reaction.EmoteId,
|
||||
Emote: emote,
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue