A community based topic aggregation platform built on atproto
1package posts
2
3import "context"
4
5// Service defines the business logic interface for posts
6// Coordinates between Repository, community service, and PDS
7type Service interface {
8 // CreatePost creates a new post in a community
9 // Flow: Validate -> Fetch community -> Ensure fresh token -> Write to PDS -> Return URI/CID
10 // AppView indexing happens asynchronously via Jetstream consumer
11 CreatePost(ctx context.Context, req CreatePostRequest) (*CreatePostResponse, error)
12
13 // Future methods (Beta):
14 // GetPost(ctx context.Context, uri string, viewerDID *string) (*Post, error)
15 // UpdatePost(ctx context.Context, req UpdatePostRequest) (*Post, error)
16 // DeletePost(ctx context.Context, uri string, userDID string) error
17 // ListCommunityPosts(ctx context.Context, communityDID string, limit, offset int) ([]*Post, error)
18}
19
20// Repository defines the data access interface for posts
21// Used by Jetstream consumer to index posts from firehose
22type Repository interface {
23 // Create inserts a new post into the AppView database
24 // Called by Jetstream consumer after post is created on PDS
25 Create(ctx context.Context, post *Post) error
26
27 // GetByURI retrieves a post by its AT-URI
28 // Used for E2E test verification and future GET endpoint
29 GetByURI(ctx context.Context, uri string) (*Post, error)
30
31 // Future methods (Beta):
32 // Update(ctx context.Context, post *Post) error
33 // Delete(ctx context.Context, uri string) error
34 // List(ctx context.Context, communityDID string, limit, offset int) ([]*Post, int, error)
35}