🔨 Refactors code
This commit is contained in:
@@ -15,7 +15,7 @@ use uuid::Uuid;
|
||||
pub fn index(
|
||||
offset: Option<i64>,
|
||||
limit: Option<i64>,
|
||||
auth: Authenticated,
|
||||
_auth: Authenticated,
|
||||
state: &State<AppState>,
|
||||
) -> Result<Json<Vec<HitDTO>>, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
@@ -37,7 +37,7 @@ pub fn index(
|
||||
}
|
||||
|
||||
#[get("/<id>")]
|
||||
pub fn get(id: &str, auth: Authenticated, state: &State<AppState>) -> Result<Json<HitDTO>, Status> {
|
||||
pub fn get(id: &str, _auth: Authenticated, state: &State<AppState>) -> Result<Json<HitDTO>, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
|
||||
let id = match Uuid::parse_str(id).ok() {
|
||||
@@ -57,7 +57,7 @@ pub fn get(id: &str, auth: Authenticated, state: &State<AppState>) -> Result<Jso
|
||||
}
|
||||
|
||||
#[delete("/<id>")]
|
||||
pub fn delete(id: &str, auth: Authenticated, state: &State<AppState>) -> Result<Status, Status> {
|
||||
pub fn delete(id: &str, _auth: Authenticated, state: &State<AppState>) -> Result<Status, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
|
||||
let id = match Uuid::parse_str(id).ok() {
|
||||
|
||||
@@ -16,7 +16,7 @@ use uuid::Uuid;
|
||||
pub fn index(
|
||||
offset: Option<i64>,
|
||||
limit: Option<i64>,
|
||||
auth: Authenticated,
|
||||
_auth: Authenticated,
|
||||
state: &State<AppState>,
|
||||
) -> Result<Json<Vec<TrackerDTO>>, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
@@ -40,7 +40,7 @@ pub fn index(
|
||||
#[get("/<id>")]
|
||||
pub fn get(
|
||||
id: &str,
|
||||
auth: Authenticated,
|
||||
_auth: Authenticated,
|
||||
state: &State<AppState>,
|
||||
) -> Result<Json<TrackerDTO>, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
@@ -62,7 +62,7 @@ pub fn get(
|
||||
}
|
||||
|
||||
#[post("/")]
|
||||
pub fn create(auth: Authenticated, state: &State<AppState>) -> Result<Json<TrackerDTO>, Status> {
|
||||
pub fn create(_auth: Authenticated, state: &State<AppState>) -> Result<Json<TrackerDTO>, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
|
||||
let new = Tracker {
|
||||
@@ -85,7 +85,7 @@ pub fn create(auth: Authenticated, state: &State<AppState>) -> Result<Json<Track
|
||||
pub fn delete(
|
||||
id: &str,
|
||||
delete_hits: Option<bool>,
|
||||
auth: Authenticated,
|
||||
_auth: Authenticated,
|
||||
state: &State<AppState>,
|
||||
) -> Result<Status, Status> {
|
||||
let mut db = state.db.lock().unwrap();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
mod api;
|
||||
mod auth;
|
||||
mod dtos;
|
||||
mod models;
|
||||
mod schema;
|
||||
mod auth;
|
||||
|
||||
use crate::api::hit;
|
||||
use crate::api::image;
|
||||
|
||||
@@ -13,4 +13,3 @@ pub struct Hit {
|
||||
pub language: Option<String>,
|
||||
pub created_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user