Fixes #13 Fix param parsing, change '1ros aux' cert length from 4 to 12 hours
This commit is contained in:
parent
d474b8bb55
commit
02e3521eb8
@ -20,16 +20,16 @@ pub async fn create_user(
|
|||||||
data: Json<ClassroomPersonCreate>,
|
data: Json<ClassroomPersonCreate>,
|
||||||
) -> (Status, Json<JsonResult<PersonLink>>) {
|
) -> (Status, Json<JsonResult<PersonLink>>) {
|
||||||
match create(&data.0).await {
|
match create(&data.0).await {
|
||||||
Ok(p) => return (Status::Ok, JsonResult::ok(p)),
|
Ok(p) => (Status::Ok, JsonResult::ok(p)),
|
||||||
Err(err) => return (Status::InternalServerError, JsonResult::err(err)),
|
Err(err) => (Status::InternalServerError, JsonResult::err(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/classroom/course/<user_id>")]
|
#[get("/classroom/course/<user_id>")]
|
||||||
pub async fn get_courses(user_id: i32) -> (Status, Json<JsonResult<Vec<ClassroomCourse>>>) {
|
pub async fn get_courses(user_id: i32) -> (Status, Json<JsonResult<Vec<ClassroomCourse>>>) {
|
||||||
match crate::online_classroom::get_courses::get_courses(user_id).await {
|
match crate::online_classroom::get_courses::get_courses(user_id).await {
|
||||||
Ok(courses) => return (Status::Ok, JsonResult::ok(courses)),
|
Ok(courses) => (Status::Ok, JsonResult::ok(courses)),
|
||||||
Err(err) => return (Status::InternalServerError, JsonResult::err(err)),
|
Err(err) => (Status::InternalServerError, JsonResult::err(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,16 +44,16 @@ pub async fn register_course_contr(
|
|||||||
data: Json<ClassroomCourseRegistration>,
|
data: Json<ClassroomCourseRegistration>,
|
||||||
) -> (Status, Json<JsonResult<()>>) {
|
) -> (Status, Json<JsonResult<()>>) {
|
||||||
match register_course(user_id, &data.surname_first_letter, &data.courses).await {
|
match register_course(user_id, &data.surname_first_letter, &data.courses).await {
|
||||||
Ok(()) => return (Status::Ok, JsonResult::ok(())),
|
Ok(()) => (Status::Ok, JsonResult::ok(())),
|
||||||
Err(err) => return (Status::InternalServerError, JsonResult::err(err)),
|
Err(err) => (Status::InternalServerError, JsonResult::err(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/classroom/expiration_date/<user_id>")]
|
#[get("/classroom/expiration_date/<user_id>")]
|
||||||
pub async fn get_expiration_date(user_id: i32) -> (Status, Json<JsonResult<String>>) {
|
pub async fn get_expiration_date(user_id: i32) -> (Status, Json<JsonResult<String>>) {
|
||||||
match crate::online_classroom::get_expiration_date::get_expiration_date(user_id).await {
|
match crate::online_classroom::get_expiration_date::get_expiration_date(user_id).await {
|
||||||
Ok(date) => return (Status::Ok, JsonResult::ok(date)),
|
Ok(date) => (Status::Ok, JsonResult::ok(date)),
|
||||||
Err(err) => return (Status::InternalServerError, JsonResult::err(err)),
|
Err(err) => (Status::InternalServerError, JsonResult::err(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ pub async fn set_expiration_date(
|
|||||||
data: Json<ExpirationDate>,
|
data: Json<ExpirationDate>,
|
||||||
) -> (Status, Json<JsonResult<()>>) {
|
) -> (Status, Json<JsonResult<()>>) {
|
||||||
match update_expiration_date(user_id, data.date.clone()).await {
|
match update_expiration_date(user_id, data.date.clone()).await {
|
||||||
Ok(()) => return (Status::Ok, JsonResult::ok(())),
|
Ok(()) => (Status::Ok, JsonResult::ok(())),
|
||||||
Err(err) => return (Status::InternalServerError, JsonResult::err(err)),
|
Err(err) => (Status::InternalServerError, JsonResult::err(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ pub async fn insert_all(data: Json<Vec<RegisterCreate>>) -> (Status, Json<JsonRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[get("/register/<dni>")]
|
#[get("/register/<dni>")]
|
||||||
pub async fn get_by_dni(dni: i32) -> (Status, Json<JsonResult<Vec<Register>>>) {
|
pub async fn get_by_dni(dni: String) -> (Status, Json<JsonResult<Vec<Register>>>) {
|
||||||
let registers = Register::get_by_dni(dni).await;
|
let registers = Register::get_by_dni(dni).await;
|
||||||
|
|
||||||
match registers {
|
match registers {
|
||||||
|
@ -88,7 +88,7 @@ impl RegisterCreate {
|
|||||||
} else {
|
} else {
|
||||||
let res = sqlx::query!(
|
let res = sqlx::query!(
|
||||||
"SELECT MAX(register_code) AS max FROM register
|
"SELECT MAX(register_code) AS max FROM register
|
||||||
WHERE register_course_id = '?'",
|
WHERE register_course_id=?",
|
||||||
course_id
|
course_id
|
||||||
)
|
)
|
||||||
.fetch_one(db)
|
.fetch_one(db)
|
||||||
@ -126,7 +126,7 @@ pub struct Register {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Register {
|
impl Register {
|
||||||
pub async fn get_by_dni(dni: i32) -> Result<Vec<Register>, sqlx::Error> {
|
pub async fn get_by_dni(dni: String) -> Result<Vec<Register>, sqlx::Error> {
|
||||||
let db = db();
|
let db = db();
|
||||||
|
|
||||||
let res = sqlx::query!(
|
let res = sqlx::query!(
|
||||||
|
@ -73,7 +73,7 @@ const tTopics = createSimpleText({
|
|||||||
yPosition: 9.4,
|
yPosition: 9.4,
|
||||||
width: 20.92,
|
width: 20.92,
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
text: "En temas de: Tres Reglas de Seguridad Básicas (S.S.S.), Primeros Auxilios Psicológico, Inicio de la Cadena de Vida, RCP, Hemorragias Quemaduras, Fracturas, uso de férulas y vendajes, Maniobra de Heimlich, Traslado de Pacientes, Posición lateral de Seguridad PLS, Tratamientos por intoxicación asfixia o ahogamiento, Practicas en Técnicas de Control de Primeros Auxilios, equivalente a 04 horas lectivas.",
|
text: "En temas de: Tres Reglas de Seguridad Básicas (S.S.S.), Primeros Auxilios Psicológico, Inicio de la Cadena de Vida, RCP, Hemorragias Quemaduras, Fracturas, uso de férulas y vendajes, Maniobra de Heimlich, Traslado de Pacientes, Posición lateral de Seguridad PLS, Tratamientos por intoxicación asfixia o ahogamiento, Practicas en Técnicas de Control de Primeros Auxilios, equivalente a 12 horas lectivas.",
|
||||||
size: 22,
|
size: 22,
|
||||||
font: "Times New Roman",
|
font: "Times New Roman",
|
||||||
alignment: AlignmentType.LEFT,
|
alignment: AlignmentType.LEFT,
|
||||||
|
Loading…
Reference in New Issue
Block a user