Refactored and fixed api endpoints

This commit is contained in:
Benjamin Sherriff
2023-12-02 13:52:01 -05:00
parent 046bf51697
commit dc2ff172b0
11 changed files with 238 additions and 182 deletions

View File

@@ -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,