(
State(state): State<AppState>,
Extension(current_guild): Extension<CurrentUserGuild>,
)
| 110 | } |
| 111 | |
| 112 | pub async fn get_full_guild( |
| 113 | State(state): State<AppState>, |
| 114 | Extension(current_guild): Extension<CurrentUserGuild>, |
| 115 | ) -> ApiResult<Json<FullGuild>> { |
| 116 | let guild = state |
| 117 | .state_client |
| 118 | .get_guild(current_guild.id) |
| 119 | .await |
| 120 | .map_err(|err| { |
| 121 | error!(%err, "failed fetching guild"); |
| 122 | ApiErrorResponse::InternalError |
| 123 | })?; |
| 124 | |
| 125 | let Some(guild) = guild else { |
| 126 | // while this is possible due to the async nature of everything, |
| 127 | // realistically this case wont hit |
| 128 | error!("guild not found while current_guild is set"); |
| 129 | return Err(ApiErrorResponse::InternalError); |
| 130 | }; |
| 131 | |
| 132 | let channels = state |
| 133 | .state_client |
| 134 | .get_channels(current_guild.id) |
| 135 | .await |
| 136 | .map_err(|err| { |
| 137 | error!(%err, "failed fetching guild channels"); |
| 138 | ApiErrorResponse::InternalError |
| 139 | })?; |
| 140 | |
| 141 | let roles = state |
| 142 | .state_client |
| 143 | .get_roles(current_guild.id) |
| 144 | .await |
| 145 | .map_err(|err| { |
| 146 | error!(%err, "failed fetching guild roles"); |
| 147 | ApiErrorResponse::InternalError |
| 148 | })?; |
| 149 | |
| 150 | Ok(Json(FullGuild { |
| 151 | guild, |
| 152 | channels, |
| 153 | roles, |
| 154 | })) |
| 155 | } |
| 156 | |
| 157 | #[derive(Debug, Serialize)] |
| 158 | pub struct GuildPremiumSlot { |
nothing calls this directly
no test coverage detected