fix: improve generated openapi.json (#584)
* fix: /bots/{bot}
Paths "/bots/{bot}" and "/bots/{target}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /channels/{group_id}/recipients/{member_id}
Paths "/channels/{group_id}/recipients/{member_id}" and "/channels/{target}/recipients/{member}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /channels/{channel_id}/webhook
Paths "/channels/{target}/webhooks" and "/channels/{channel_id}/webhooks" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /servers/{server_id}/members/{member_id}
Paths "/servers/{target}/members/{member}" and "/servers/{server}/members/{member}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /custom/emoji/{emoji_id}
Paths "/custom/emoji/{id}" and "/custom/emoji/{emoji_id}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
---------
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
Signed-off-by: Damocles <106018783+Damocles078@users.noreply.github.com>
This commit is contained in:
@@ -10,11 +10,11 @@ use validator::Validate;
|
||||
///
|
||||
/// Edit bot details by its id.
|
||||
#[openapi(tag = "Bots")]
|
||||
#[patch("/<target>", data = "<data>")]
|
||||
#[patch("/<bot_id>", data = "<data>")]
|
||||
pub async fn edit_bot(
|
||||
db: &State<Database>,
|
||||
user: User,
|
||||
target: Reference<'_>,
|
||||
bot_id: Reference<'_>,
|
||||
data: Json<DataEditBot>,
|
||||
) -> Result<Json<v0::BotWithUserResponse>> {
|
||||
let data = data.into_inner();
|
||||
@@ -24,7 +24,7 @@ pub async fn edit_bot(
|
||||
})
|
||||
})?;
|
||||
|
||||
let mut bot = target.as_bot(db).await?;
|
||||
let mut bot = bot_id.as_bot(db).await?;
|
||||
if bot.owner != user.id {
|
||||
return Err(create_error!(NotFound));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user