audio streaming app plyr.fm
38
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 86 lines 2.5 kB view raw view rendered
1--- 2title: comments 3sidebarTitle: comments 4--- 5 6# `backend.api.tracks.comments` 7 8 9Track timed comments endpoints. 10 11## Functions 12 13### `get_track_comments` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L66) 14 15```python 16get_track_comments(track_id: int, db: Annotated[AsyncSession, Depends(get_db)]) -> CommentsListResponse 17``` 18 19 20get all comments for a track, ordered by timestamp. 21 22public endpoint - no auth required. 23 24 25### `create_comment` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L122) 26 27```python 28create_comment(track_id: int, body: CommentCreate, db: Annotated[AsyncSession, Depends(get_db)], auth_session: AuthSession = Depends(require_auth)) -> CommentResponse 29``` 30 31 32create a timed comment on a track. 33 34requires auth. track owner must have allow_comments enabled. 35the comment is visible immediately; the ATProto record is created in background. 36 37 38### `delete_comment` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L212) 39 40```python 41delete_comment(comment_id: int, db: Annotated[AsyncSession, Depends(get_db)], auth_session: AuthSession = Depends(require_auth)) -> DeletedResponse 42``` 43 44 45delete a comment. only the author can delete their own comments. 46 47the comment is removed immediately; the ATProto record is deleted in background. 48 49 50### `update_comment` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L250) 51 52```python 53update_comment(comment_id: int, body: CommentUpdate, db: Annotated[AsyncSession, Depends(get_db)], auth_session: AuthSession = Depends(require_auth)) -> CommentResponse 54``` 55 56 57update a comment's text. only the author can edit their own comments. 58 59the comment is updated immediately; the ATProto record is updated in background. 60 61 62## Classes 63 64### `CommentCreate` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L30) 65 66 67request body for creating a comment. 68 69 70### `CommentUpdate` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L37) 71 72 73request body for updating a comment. 74 75 76### `CommentResponse` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L43) 77 78 79response model for a single comment. 80 81 82### `CommentsListResponse` [source](https://github.com/zzstoatzz/plyr.fm/blob/main/backend/src/backend/api/tracks/comments.py#L57) 83 84 85response model for list of comments. 86