aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_server/database/models.rs
blob: e47d614dd00d40f5411d26f3ec21b522b12918b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use time::OffsetDateTime;

pub(crate) struct History {
    pub(crate) id: i64,
    pub(crate) client_id: String, // a client generated ID
    pub(crate) user_id: i64,
    pub(crate) hostname: String,
    pub(crate) timestamp: OffsetDateTime,

    /// All the data we have about this command, encrypted.
    ///
    /// Currently this is an encrypted msgpack object, but this may change in the future.
    pub(crate) data: String,

    pub(crate) created_at: OffsetDateTime,
}

pub(crate) struct NewHistory {
    pub(crate) client_id: String,
    pub(crate) user_id: i64,
    pub(crate) hostname: String,
    pub(crate) timestamp: OffsetDateTime,

    /// All the data we have about this command, encrypted.
    ///
    /// Currently this is an encrypted msgpack object, but this may change in the future.
    pub(crate) data: String,
}

pub(crate) struct User {
    pub(crate) id: i64,
    pub(crate) username: String,
    pub(crate) email: String,
    pub(crate) password: String,
}

pub(crate) struct Session {
    pub(crate) id: i64,
    pub(crate) user_id: i64,
    pub(crate) token: String,
}

pub(crate) struct NewUser {
    pub(crate) username: String,
    pub(crate) email: String,
    pub(crate) password: String,
}

pub(crate) struct NewSession {
    pub(crate) user_id: i64,
    pub(crate) token: String,
}