From 87f10c3fb0c9f0d5794136124690bee5c5bef765 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Fri, 8 Mar 2019 18:40:48 -0500 Subject: remove old oauth model and schema block --- src/db/models.rs | 43 ------------------------------------------- src/db/schema.rs | 11 ----------- 2 files changed, 54 deletions(-) (limited to 'src/db') diff --git a/src/db/models.rs b/src/db/models.rs index 030daba..66e161a 100644 --- a/src/db/models.rs +++ b/src/db/models.rs @@ -284,46 +284,3 @@ impl InvocationRecord { .map_err(Error::from) } } - -#[derive(Queryable, Identifiable, PartialEq, Debug)] -#[table_name="google_oauth_tokens"] -pub struct GoogleOAuthToken { - pub id: i32, - pub token: String, - pub refresh_token: String, - pub expiration: NaiveDateTime, - pub created: NaiveDateTime, -} - -impl GoogleOAuthToken { - pub fn create(conn: &PgConnection, token: String, refresh_token: String, expiration: NaiveDateTime) -> Result { - ::diesel::insert_into(google_oauth_tokens::table) - .values(&NewGoogleOAuthToken { - token, - refresh_token, - expiration, - }) - .get_result::(conn) - .map_err(Error::from) - } - - pub fn latest(conn: &PgConnection) -> Result { - use chrono; - - let now = chrono::Utc::now().naive_utc(); - - google_oauth_tokens::table - .filter(google_oauth_tokens::expiration.gt(now)) - .order(google_oauth_tokens::created.desc()) - .first(conn) - .map_err(Error::from) - } -} - -#[derive(Insertable, PartialEq, Debug)] -#[table_name="google_oauth_tokens"] -pub struct NewGoogleOAuthToken { - pub token: String, - pub refresh_token: String, - pub expiration: NaiveDateTime, -} diff --git a/src/db/schema.rs b/src/db/schema.rs index 9a67cec..01ec1d0 100644 --- a/src/db/schema.rs +++ b/src/db/schema.rs @@ -16,16 +16,6 @@ table! { } } -table! { - google_oauth_tokens (id) { - id -> Int4, - token -> Varchar, - refresh_token -> Varchar, - expiration -> Timestamp, - created -> Timestamp, - } -} - table! { images (id) { id -> Int4, @@ -88,7 +78,6 @@ joinable!(invocation_records -> memes (meme_id)); allow_tables_to_appear_in_same_query!( audio, audit_records, - google_oauth_tokens, images, invocation_records, memes, -- cgit v1.3.1