summaryrefslogtreecommitdiff
path: root/src/models.rs
blob: b3d653f97a2a7b075c145e950222f295321bf45a (plain)
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
use crate::schema::config;
use crate::schema::strava_tokens;
use crate::schema::users;
use chrono::DateTime;
use chrono::Utc;

#[derive(Insertable, Queryable)]
#[table_name = "config"]
pub struct Config {
    pub strava_client_secret: String,
    pub strava_client_id: String,
    pub rocket_secret_key: String,
    pub singleton: bool,
}

#[derive(Insertable)]
#[table_name = "users"]
pub struct NewUser<'a> {
    pub username: &'a str,
    pub password: &'a str,
}

#[derive(Queryable)]
pub struct User {
    pub username: String,
    pub password: String,
}

#[derive(Insertable, Queryable)]
#[table_name = "strava_tokens"]
pub struct StravaToken {
    pub username: String,
    pub refresh_token: String,
    pub access_token: String,
    pub expires_at: DateTime<Utc>,
}