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

@@ -8,7 +8,7 @@ use rocket::{serde::json::Json, State};
/// Fetch an invite by its id.
#[openapi(tag = "Invites")]
#[get("/<target>")]
pub async fn fetch(db: &State<Database>, target: Reference) -> Result<Json<v0::InviteResponse>> {
pub async fn fetch(db: &State<Database>, target: Reference<'_>) -> Result<Json<v0::InviteResponse>> {
Ok(Json(match target.as_invite(db).await? {
Invite::Server {
channel, creator, ..
@@ -34,7 +34,7 @@ pub async fn fetch(db: &State<Database>, target: Reference) -> Result<Json<v0::I
let server = db.fetch_server(&server).await?;
v0::InviteResponse::Server {
code: target.id,
code: target.id.to_string(),
member_count: db.fetch_member_count(&server.id).await? as i64,
server_id: server.id,
server_name: server.name,
@@ -64,7 +64,7 @@ pub async fn fetch(db: &State<Database>, target: Reference) -> Result<Json<v0::I
description,
..
} => v0::InviteResponse::Group {
code: target.id,
code: target.id.to_string(),
channel_id: id,
channel_name: name,
channel_description: description,