Refactored and fixed api endpoints
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use actix_web::{get, post, web, HttpResponse, HttpRequest, ResponseError};
|
||||
use log::error;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use siren::{GetResponse, Metadata, ServiceError};
|
||||
use siren::{Response, Metadata, ServiceError};
|
||||
|
||||
use crate::{storage::messages::{QueryMessage, QueryFilters, InsertMessage}, auth::{JwtAuth, verify_role}};
|
||||
|
||||
@@ -50,7 +50,7 @@ async fn get_all(req: HttpRequest, auth: JwtAuth) -> HttpResponse {
|
||||
|
||||
match QueryMessage::get_all(&filters, limit, page) {
|
||||
Ok(messages) => {
|
||||
HttpResponse::Ok().json(GetResponse {
|
||||
HttpResponse::Ok().json(Response {
|
||||
data: messages,
|
||||
metadata: Some(Metadata {
|
||||
total: total_count as i32,
|
||||
|
||||
Reference in New Issue
Block a user