an app.bsky.* indexer

re-enable ActorProfile, GraphBlock, GraphListblock, GraphListitem

Changed files
+16 -20
cmd
monarch
+16 -20
cmd/monarch/handlers.go
···
switch uri.Collection() {
case syntax.NSID("app.bsky.actor.profile"):
-
// profile := models.NewActorProfile(uri, *rec)
-
// if err := hs.store.Where(models.ActorProfile{ID: string(uri)}).Assign(profile).FirstOrCreate(&models.ActorProfile{}).Error; err != nil {
-
// return fmt.Errorf("error upserting actor profile: %w", err)
-
// }
-
return nil
+
profile := models.NewActorProfile(uri, *rec)
+
if err := hs.store.Where(models.ActorProfile{ID: string(uri)}).Assign(profile).FirstOrCreate(&models.ActorProfile{}).Error; err != nil {
+
return fmt.Errorf("error upserting actor profile: %w", err)
+
}
case syntax.NSID("app.bsky.actor.status"):
status := models.NewActorStatus(uri, *rec)
···
}
case syntax.NSID("app.bsky.graph.block"):
-
// block := models.NewGraphBlock(uri, *rec)
-
// if err := hs.store.Where(models.GraphBlock{ID: string(uri)}).Assign(block).FirstOrCreate(&models.GraphBlock{}).Error; err != nil {
-
// return fmt.Errorf("error upserting graph block: %w", err)
-
// }
-
return nil
+
block := models.NewGraphBlock(uri, *rec)
+
if err := hs.store.Where(models.GraphBlock{ID: string(uri)}).Assign(block).FirstOrCreate(&models.GraphBlock{}).Error; err != nil {
+
return fmt.Errorf("error upserting graph block: %w", err)
+
}
case syntax.NSID("app.bsky.graph.list"):
list := models.NewGraphList(uri, *rec)
···
}
case syntax.NSID("app.bsky.graph.listblock"):
-
// listblock := models.NewGraphListblock(uri, *rec)
-
// if err := hs.store.Where(models.GraphListblock{ID: string(uri)}).Assign(listblock).FirstOrCreate(&models.GraphListblock{}).Error; err != nil {
-
// return fmt.Errorf("error upserting graph listblock: %w", err)
-
// }
-
return nil
+
listblock := models.NewGraphListblock(uri, *rec)
+
if err := hs.store.Where(models.GraphListblock{ID: string(uri)}).Assign(listblock).FirstOrCreate(&models.GraphListblock{}).Error; err != nil {
+
return fmt.Errorf("error upserting graph listblock: %w", err)
+
}
case syntax.NSID("app.bsky.graph.listitem"):
-
// listitem := models.NewGraphListitem(uri, *rec)
-
// if err := hs.store.Where(models.GraphListitem{ID: string(uri)}).Assign(listitem).FirstOrCreate(&models.GraphListitem{}).Error; err != nil {
-
// return fmt.Errorf("error upserting graph listitem: %w", err)
-
// }
-
return nil
+
listitem := models.NewGraphListitem(uri, *rec)
+
if err := hs.store.Where(models.GraphListitem{ID: string(uri)}).Assign(listitem).FirstOrCreate(&models.GraphListitem{}).Error; err != nil {
+
return fmt.Errorf("error upserting graph listitem: %w", err)
+
}
case syntax.NSID("app.bsky.graph.starterpack"):
pack := models.NewGraphStarterpack(uri, *rec)