Skip to main content

paperless_api/
user.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
4#[repr(transparent)]
5pub struct UserId(pub i32);
6
7/// A paperless user
8#[derive(Debug, Clone, Deserialize)]
9pub struct User {
10    pub id: UserId,
11    pub username: String,
12    pub email: String,
13    pub first_name: String,
14    pub last_name: String,
15    pub is_superuser: bool,
16    pub is_staff: bool,
17    pub is_active: bool,
18}
19
20impl std::fmt::Display for UserId {
21    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22        write!(f, "{}", self.0)
23    }
24}