Update /{account_id}/statuses method to return 404 if profile doesn't exist

This commit is contained in:
silverpill 2022-01-11 16:58:40 +00:00
parent b8e87f13ac
commit 82508e103c
2 changed files with 33 additions and 30 deletions

View file

@ -87,37 +87,9 @@ paths:
$ref: '#/components/schemas/Account'
400:
description: Invalid user data
/api/v1/directory:
get:
summary: List accounts visible in the directory.
parameters:
- name: offset
in: query
description: How many accounts to skip before returning results.
required: false
schema:
type: integer
default: 0
- name: limit
in: query
description: How many accounts to load.
required: false
schema:
type: integer
default: 40
responses:
200:
description: Successful operation
content:
application/json:
schema:
description: Profile list
type: array
items:
$ref: '#/components/schemas/Account'
/api/v1/accounts/{account_id}/statuses:
get:
summary: Statuses posted to the given account.
summary: Posts created by the given actor.
parameters:
- $ref: '#/components/parameters/account_id'
- name: max_id
@ -144,6 +116,8 @@ paths:
type: array
items:
$ref: '#/components/schemas/Status'
404:
description: Profile not found
/api/v1/accounts/{account_id}/followers:
get:
summary: Actors which follow the given actor.
@ -236,6 +210,34 @@ paths:
$ref: '#/components/schemas/Relationship'
404:
description: Profile not found
/api/v1/directory:
get:
summary: List accounts visible in the directory.
parameters:
- name: offset
in: query
description: How many accounts to skip before returning results.
required: false
schema:
type: integer
default: 0
- name: limit
in: query
description: How many accounts to load.
required: false
schema:
type: integer
default: 40
responses:
200:
description: Successful operation
content:
application/json:
schema:
description: Profile list
type: array
items:
$ref: '#/components/schemas/Account'
/api/v1/statuses:
post:
summary: Create new post.

View file

@ -297,9 +297,10 @@ async fn get_account_statuses(
Some(auth) => Some(get_current_user(db_client, auth.token()).await?),
None => None,
};
let profile = get_profile_by_id(db_client, &account_id).await?;
let mut posts = get_posts_by_author(
db_client,
&account_id,
&profile.id,
maybe_current_user.as_ref().map(|user| &user.id),
false,
query_params.max_id,