about summary refs log tree commit diff
path: root/src/types.rs
blob: 0a4926e491af0c8d4dae5d1c10280f48690b4803 (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
use diesel::PgConnection;
use diesel::r2d2::{ConnectionManager, Pool};
use crate::schema::links;

#[derive(Debug, Deserialize)]
pub struct UserData {
    pub url: String
}

#[derive(Debug, Serialize)]
pub struct UserResponse {
    pub hash: String
}

#[derive(Debug, Serialize)]
pub struct ErrorResponse {
    pub error: String
}

#[derive(Queryable, Insertable)]
#[table_name="links"]
pub struct Entry {
    pub hash: String,
    pub url: String
}

pub type PoolState = Pool<ConnectionManager<PgConnection>>;