37 lines
1.2 KiB
Rust
37 lines
1.2 KiB
Rust
|
use rocket::serde::{Serialize, Deserialize};
|
||
|
|
||
|
#[derive(Serialize, Deserialize, Clone)]
|
||
|
#[serde(crate = "rocket::serde")]
|
||
|
/// Represents a single register send by the frontend
|
||
|
/// to create a new register in the database
|
||
|
pub struct RegisterCreate {
|
||
|
person_id: i32,
|
||
|
course_id: i32,
|
||
|
/// YYYY-MM-DD
|
||
|
date: String
|
||
|
}
|
||
|
|
||
|
|
||
|
#[derive(Serialize, Deserialize, Clone)]
|
||
|
#[serde(crate = "rocket::serde")]
|
||
|
pub struct Register {
|
||
|
pub register_id: i32,
|
||
|
/// Display code, shown on the certificate.
|
||
|
/// Currently a 4-digit number. After 9999, it will be a 4-digit hex number.
|
||
|
///
|
||
|
/// Example: `0322``
|
||
|
pub register_code: i32,
|
||
|
/// Date of creation of the register, in YYYY-MM-DD format
|
||
|
pub register_creation_date: String,
|
||
|
/// Date shown on the certificate, in YYYY-MM-DD format
|
||
|
pub register_display_date: String,
|
||
|
/// Some course's names can be extended with a label.
|
||
|
/// Used in machinery courses, where the course name is the type of machinery,
|
||
|
/// and the custom label the manufacturer and series (i.e. `320D CAT`).
|
||
|
pub register_custom_label: String,
|
||
|
/// Foreign key to the person table
|
||
|
pub register_person_id: i32,
|
||
|
/// Foreign key to the course table
|
||
|
pub register_course_id: i32,
|
||
|
}
|