Skip to content

Commit

Permalink
Add reposts support to the firehose process commits example (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshalX committed Sep 8, 2023
1 parent 10a0b43 commit 34daf6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/firehose/process_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ def _get_ops_by_type(commit: models.ComAtprotoSyncSubscribeRepos.Commit) -> dict
operation_by_type['likes']['created'].append({'record': record, **create_info})
elif uri.collection == ids.AppBskyFeedPost and is_record_type(record, ids.AppBskyFeedPost):
operation_by_type['posts']['created'].append({'record': record, **create_info})
elif uri.collection == ids.AppBskyFeedRepost and is_record_type(record, ids.AppBskyFeedRepost):
operation_by_type['reposts']['created'].append({'record': record, **create_info})
elif uri.collection == ids.AppBskyGraphFollow and is_record_type(record, ids.AppBskyGraphFollow):
operation_by_type['follows']['created'].append({'record': record, **create_info})

if op.action == 'delete':
if uri.collection == ids.AppBskyFeedLike:
operation_by_type['likes']['deleted'].append({'uri': str(uri)})
if uri.collection == ids.AppBskyFeedPost:
elif uri.collection == ids.AppBskyFeedPost:
operation_by_type['posts']['deleted'].append({'uri': str(uri)})
if uri.collection == ids.AppBskyGraphFollow:
elif uri.collection == ids.AppBskyFeedRepost:
operation_by_type['reposts']['deleted'].append({'uri': str(uri)})
elif uri.collection == ids.AppBskyGraphFollow:
operation_by_type['follows']['deleted'].append({'uri': str(uri)})

return operation_by_type
Expand Down

0 comments on commit 34daf6e

Please sign in to comment.