chore: switch Reference to using an actual reference

This commit is contained in:
Zomatree
2025-08-12 03:44:29 +01:00
parent 65fbd36624
commit ed22b3a5ce
76 changed files with 133 additions and 131 deletions

View File

@@ -11,7 +11,7 @@ use rocket_empty::EmptyResponse;
pub async fn delete_bot(
db: &State<Database>,
user: User,
target: Reference,
target: Reference<'_>,
) -> Result<EmptyResponse> {
let bot = target.as_bot(db).await?;
if bot.owner != user.id {

View File

@@ -14,7 +14,7 @@ use validator::Validate;
pub async fn edit_bot(
db: &State<Database>,
user: User,
target: Reference,
target: Reference<'_>,
data: Json<DataEditBot>,
) -> Result<Json<v0::BotWithUserResponse>> {
let data = data.into_inner();

View File

@@ -11,7 +11,7 @@ use rocket::{serde::json::Json, State};
pub async fn fetch_bot(
db: &State<Database>,
user: User,
bot: Reference,
bot: Reference<'_>,
) -> Result<Json<FetchBotResponse>> {
if user.bot.is_some() {
return Err(create_error!(IsBot));

View File

@@ -13,9 +13,9 @@ use rocket::State;
pub async fn fetch_public_bot(
db: &State<Database>,
user: Option<User>,
target: Reference,
target: Reference<'_>,
) -> Result<Json<PublicBot>> {
let bot = db.fetch_bot(&target.id).await?;
let bot = db.fetch_bot(target.id).await?;
if !bot.public && user.is_none_or(|x| x.id != bot.owner) {
return Err(create_error!(NotFound));
}

View File

@@ -20,7 +20,7 @@ pub async fn invite_bot(
db: &State<Database>,
amqp: &State<AMQP>,
user: User,
target: Reference,
target: Reference<'_>,
dest: Json<v0::InviteBotDestination>,
) -> Result<EmptyResponse> {
if user.bot.is_some() {