Add ability to get the user for an invite code in collab API
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
3d7e912c6b
commit
a3bbabaaac
2 changed files with 44 additions and 10 deletions
|
@ -26,6 +26,7 @@ pub fn routes(state: Arc<AppState>) -> Router<Body> {
|
|||
put(update_user).delete(destroy_user).get(get_user),
|
||||
)
|
||||
.route("/users/:id/access_tokens", post(create_access_token))
|
||||
.route("/invite_codes/:code", get(get_user_for_invite_code))
|
||||
.route("/panic", post(trace_panic))
|
||||
.layer(
|
||||
ServiceBuilder::new()
|
||||
|
@ -210,3 +211,10 @@ async fn create_access_token(
|
|||
encrypted_access_token,
|
||||
}))
|
||||
}
|
||||
|
||||
async fn get_user_for_invite_code(
|
||||
Path(code): Path<String>,
|
||||
Extension(app): Extension<Arc<AppState>>,
|
||||
) -> Result<Json<User>> {
|
||||
Ok(Json(app.db.get_user_for_invite_code(&code).await?))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue