Update /{account_id}/statuses method to return 404 if profile doesn't exist
This commit is contained in:
parent
b8e87f13ac
commit
82508e103c
2 changed files with 33 additions and 30 deletions
|
@ -87,37 +87,9 @@ paths:
|
||||||
$ref: '#/components/schemas/Account'
|
$ref: '#/components/schemas/Account'
|
||||||
400:
|
400:
|
||||||
description: Invalid user data
|
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:
|
/api/v1/accounts/{account_id}/statuses:
|
||||||
get:
|
get:
|
||||||
summary: Statuses posted to the given account.
|
summary: Posts created by the given actor.
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: '#/components/parameters/account_id'
|
- $ref: '#/components/parameters/account_id'
|
||||||
- name: max_id
|
- name: max_id
|
||||||
|
@ -144,6 +116,8 @@ paths:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Status'
|
$ref: '#/components/schemas/Status'
|
||||||
|
404:
|
||||||
|
description: Profile not found
|
||||||
/api/v1/accounts/{account_id}/followers:
|
/api/v1/accounts/{account_id}/followers:
|
||||||
get:
|
get:
|
||||||
summary: Actors which follow the given actor.
|
summary: Actors which follow the given actor.
|
||||||
|
@ -236,6 +210,34 @@ paths:
|
||||||
$ref: '#/components/schemas/Relationship'
|
$ref: '#/components/schemas/Relationship'
|
||||||
404:
|
404:
|
||||||
description: Profile not found
|
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:
|
/api/v1/statuses:
|
||||||
post:
|
post:
|
||||||
summary: Create new post.
|
summary: Create new post.
|
||||||
|
|
|
@ -297,9 +297,10 @@ async fn get_account_statuses(
|
||||||
Some(auth) => Some(get_current_user(db_client, auth.token()).await?),
|
Some(auth) => Some(get_current_user(db_client, auth.token()).await?),
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
let profile = get_profile_by_id(db_client, &account_id).await?;
|
||||||
let mut posts = get_posts_by_author(
|
let mut posts = get_posts_by_author(
|
||||||
db_client,
|
db_client,
|
||||||
&account_id,
|
&profile.id,
|
||||||
maybe_current_user.as_ref().map(|user| &user.id),
|
maybe_current_user.as_ref().map(|user| &user.id),
|
||||||
false,
|
false,
|
||||||
query_params.max_id,
|
query_params.max_id,
|
||||||
|
|
Loading…
Reference in a new issue