feat: Chat request implementation #14
1 changed files with 6 additions and 7 deletions
|
@ -22,7 +22,6 @@ use salvo::{
|
|||
oapi::{endpoint, extract::JsonBody},
|
||||
writing::Json,
|
||||
Depot,
|
||||
Extractible,
|
||||
Request,
|
||||
Router,
|
||||
Writer,
|
||||
|
@ -88,13 +87,13 @@ pub async fn register(
|
|||
tags("User"),
|
||||
responses(
|
||||
(status_code = 200, description = "Returns whitelisted users", content_type = "application/json", body = Vec<WhiteListedUser>),
|
||||
(status_code = 403, description = "Not registered user, must register first", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 400, description = "Wrong query parameter", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 401, description = "The entered signature or public key is invalid", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 403, description = "Not registered user, must register first", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 429, description = "Too many requests", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 500, description = "Internal server error", content_type = "application/json", body = MessageSchema),
|
||||
),
|
||||
parameters(
|
||||
Pagination,
|
||||
("X-OTMP-PUBLIC" = PublicKey, Header, description = "Public key of the sender"),
|
||||
("X-OTMP-SIGNATURE" = Signature, Header, description = "Signature of the request"),
|
||||
),
|
||||
|
@ -102,8 +101,8 @@ pub async fn register(
|
|||
async fn user_whitelist(
|
||||
req: &mut Request,
|
||||
depot: &mut Depot,
|
||||
pagination: Pagination,
|
||||
) -> ApiResult<Json<Vec<WhiteListedUser>>> {
|
||||
let pagination = Pagination::extract(req).await?;
|
||||
let conn = depot.db_conn();
|
||||
let user = conn
|
||||
.get_user_by_pubk(
|
||||
|
@ -127,13 +126,13 @@ async fn user_whitelist(
|
|||
tags("User"),
|
||||
responses(
|
||||
(status_code = 200, description = "Returns blacklisted users", content_type = "application/json", body = Vec<BlackListedUser>),
|
||||
(status_code = 403, description = "Not registered user, must register first", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 400, description = "Wrong query parameter", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 401, description = "The entered signature or public key is invalid", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 403, description = "Not registered user, must register first", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 429, description = "Too many requests", content_type = "application/json", body = MessageSchema),
|
||||
(status_code = 500, description = "Internal server error", content_type = "application/json", body = MessageSchema),
|
||||
),
|
||||
parameters(
|
||||
Pagination,
|
||||
("X-OTMP-PUBLIC" = PublicKey, Header, description = "Public key of the sender"),
|
||||
("X-OTMP-SIGNATURE" = Signature, Header, description = "Signature of the request"),
|
||||
),
|
||||
|
@ -141,8 +140,8 @@ async fn user_whitelist(
|
|||
async fn user_blacklist(
|
||||
req: &mut Request,
|
||||
depot: &mut Depot,
|
||||
pagination: Pagination,
|
||||
) -> ApiResult<Json<Vec<BlackListedUser>>> {
|
||||
let pagination = Pagination::extract(req).await?;
|
||||
let conn = depot.db_conn();
|
||||
let user = conn
|
||||
.get_user_by_pubk(
|
||||
|
|
Loading…
Reference in a new issue