DEVELOPMENT ENVIRONMENT

~liljamo/ulairi

ref: 6881fb5a28bf2746e4aebf61ec5f3b9a4ac7a886 ulairi/ulairi-api/src/roles/mod.rs -rw-r--r-- 425 bytes
6881fb5aJonni Liljamo docs: update README.md, add LICENSE and NOTICE 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub mod model;

use self::model::Role;
use rocket::{self, http::Status};
use rocket_contrib::json::{Json, JsonValue};

use crate::db;

#[get("/all")]
pub fn get_all(connection: db::DbConn) -> Json<JsonValue> {
    // Return all roles as an array of objects
    Json(json!({ "roles": Role::get_all(&connection) }))
}

pub fn mount(rocket: rocket::Rocket) -> rocket::Rocket {
    rocket.mount("/api/roles", routes![get_all])
}