aboutsummaryrefslogtreecommitdiff
path: root/backend/notes/app.bsky.feed.post.go
diff options
context:
space:
mode:
authorGuillermo Serrahima <dev@vylion.com>2026-03-18 22:02:13 +0100
committerGuillermo Serrahima <dev@vylion.com>2026-03-20 00:50:46 +0100
commit59545c874d8635c39ccdbecf84f953686dd5c03c (patch)
tree2c0e682acd56925c2a65dcf2c96a22c95202e550 /backend/notes/app.bsky.feed.post.go
parent9181a6e454e3b294004923b2036b9852212cce7f (diff)
downloadllostre-59545c874d8635c39ccdbecf84f953686dd5c03c.tar.xz
llostre-59545c874d8635c39ccdbecf84f953686dd5c03c.zip
more naming refactors
Diffstat (limited to 'backend/notes/app.bsky.feed.post.go')
-rw-r--r--backend/notes/app.bsky.feed.post.go102
1 files changed, 0 insertions, 102 deletions
diff --git a/backend/notes/app.bsky.feed.post.go b/backend/notes/app.bsky.feed.post.go
deleted file mode 100644
index 451633e..0000000
--- a/backend/notes/app.bsky.feed.post.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package notes
-
-import (
- "fmt"
- "llostre/backend/general"
- "time"
-)
-
-type AppBskyFeedPostRecord struct {
- URI string `json:"uri"`
- Value struct {
- Text string `json:"text"`
- CreatedAt string `json:"createdAt"`
- Reply *struct {
- Parent struct {
- URI string `json:"uri"`
- } `json:"parent"`
- } `json:"reply,omitempty"`
- Facets []struct {
- Index struct {
- ByteStart int `json:"byteStart"`
- ByteEnd int `json:"byteEnd"`
- } `json:"index"`
- Features []struct {
- Type string `json:"$type"`
- URI string `json:"uri,omitempty"`
- DID string `json:"did,omitempty"`
- Tag string `json:"tag,omitempty"`
- } `json:"features"`
- } `json:"facets,omitempty"`
- } `json:"value"`
-}
-
-func NoteFromAppBskyFeedPostRecord(record AppBskyFeedPostRecord, profile *general.Profile) (*Note, error) {
- if record.URI == "" {
- return nil, fmt.Errorf("missing required field: uri")
- }
-
- createdAt, err := time.Parse(time.RFC3339, record.Value.CreatedAt)
- if err != nil {
- return nil, fmt.Errorf("failed to parse timestamp: %w", err)
- }
-
- var replyTo *string
- if record.Value.Reply != nil {
- replyTo = &record.Value.Reply.Parent.URI
- }
-
- var facets []Facet
- for _, f := range record.Value.Facets {
- for _, feature := range f.Features {
- var value string
- var facetType string
-
- switch feature.Type {
- case "app.bsky.richtext.facet#link":
- facetType = "link"
- value = feature.URI
- case "app.bsky.richtext.facet#mention":
- facetType = "mention"
- value = feature.DID
- case "app.bsky.richtext.facet#tag":
- facetType = "tag"
- value = feature.Tag
- default:
- continue
- }
-
- facets = append(facets, Facet{
- ByteStart: f.Index.ByteStart,
- ByteEnd: f.Index.ByteEnd,
- Type: facetType,
- Value: value,
- })
- }
- }
-
- var handle, displayName, avatarURL string
- if profile != nil {
- handle = profile.Handle
- displayName = profile.DisplayName
- avatarURL = profile.AvatarURL
- } else {
- handle = "handle.invalid"
- displayName = ""
- avatarURL = ""
- }
-
- did, _, _, err := general.ParseURI(record.URI)
-
- return &Note{
- URI: record.URI,
- AuthorDID: did,
- AuthorHandle: handle,
- AuthorName: displayName,
- AvatarURL: avatarURL,
- CreatedAt: createdAt,
- Text: record.Value.Text,
- ReplyTo: replyTo,
- Facets: facets,
- }, nil
-}