Updating ui

This commit is contained in:
Benjamin Sherriff
2024-01-30 20:09:51 -05:00
parent ca9270f3a7
commit 57286bb0e7
32 changed files with 420 additions and 425 deletions

View File

@@ -3,7 +3,7 @@ use log::error;
use serde::{Serialize, Deserialize};
use siren::{Response, Metadata, ServiceError};
use crate::{dnd::spells::{QuerySpell, QueryFilters}, auth::{JwtAuth, verify_role}};
use crate::{dnd::spells::{QuerySpell, QueryFilters}, auth::{Auth, verify_role}};
use super::{Spell, InsertSpell};
@@ -134,7 +134,7 @@ async fn get_by_id(id: web::Path<String>) -> HttpResponse {
}
#[post("/spells")]
async fn create(spell: web::Json<Spell>, auth: JwtAuth) -> HttpResponse {
async fn create(spell: web::Json<Spell>, auth: Auth) -> HttpResponse {
let _ = match verify_role(&auth, "admin") {
Ok(_) => {},
Err(err) => return ResponseError::error_response(&err)
@@ -149,7 +149,7 @@ async fn create(spell: web::Json<Spell>, auth: JwtAuth) -> HttpResponse {
}
#[put("/spells/{id}")]
async fn update(id: web::Path<String>, spell: web::Json<Spell>, auth: JwtAuth) -> HttpResponse {
async fn update(id: web::Path<String>, spell: web::Json<Spell>, auth: Auth) -> HttpResponse {
let _ = match verify_role(&auth, "admin") {
Ok(_) => {},
Err(err) => return ResponseError::error_response(&err)
@@ -171,7 +171,7 @@ async fn update(id: web::Path<String>, spell: web::Json<Spell>, auth: JwtAuth) -
}
#[delete("/spells/{id}")]
async fn delete(id: web::Path<String>, auth: JwtAuth) -> HttpResponse {
async fn delete(id: web::Path<String>, auth: Auth) -> HttpResponse {
let _ = match verify_role(&auth, "admin") {
Ok(_) => {},
Err(err) => return ResponseError::error_response(&err)