diff --git a/core/src/services/candidate_service.rs b/core/src/services/candidate_service.rs index dc0771f..3732c09 100644 --- a/core/src/services/candidate_service.rs +++ b/core/src/services/candidate_service.rs @@ -2,7 +2,7 @@ use chrono::Duration; use entity::candidate; use sea_orm::{DatabaseConnection, prelude::Uuid, ModelTrait}; -use crate::{crypto::{self, hash_sha256}, Query, token::{generate_candidate_token, candidate_token::CandidateToken}, error::{ServiceError, USER_NOT_FOUND_ERROR, INVALID_CREDENTIALS_ERROR, DB_ERROR, USER_NOT_FOUND_BY_JWT_ID, USER_NOT_FOUND_BY_SESSION_ID}, Mutation}; +use crate::{crypto::{self}, Query, token::{generate_candidate_token, candidate_token::CandidateToken}, error::{ServiceError, USER_NOT_FOUND_ERROR, INVALID_CREDENTIALS_ERROR, DB_ERROR, USER_NOT_FOUND_BY_JWT_ID, USER_NOT_FOUND_BY_SESSION_ID}, Mutation}; pub struct CandidateService; diff --git a/entity/src/session.rs b/entity/src/session.rs index f7322c4..3fdde8c 100644 --- a/entity/src/session.rs +++ b/entity/src/session.rs @@ -8,7 +8,6 @@ pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub user_id: i32, - #[sea_orm(column_type = "Custom(\"inet\".to_owned())")] pub ip_address: String, pub created_at: DateTime, pub expires_at: DateTime, diff --git a/migration/src/m20221025_154422_create_session.rs b/migration/src/m20221025_154422_create_session.rs index a6003dd..9c084de 100644 --- a/migration/src/m20221025_154422_create_session.rs +++ b/migration/src/m20221025_154422_create_session.rs @@ -1,28 +1,11 @@ use sea_orm_migration::prelude::*; -use crate::m20221024_121621_create_candidate::Candidate; - #[derive(DeriveMigrationName)] pub struct Migration; #[async_trait::async_trait] impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { - let table = Table::create() - .table(Session::Table) - .if_not_exists() - .col( - ColumnDef::new(Session::Id) - .uuid() - .not_null() - .unique_key() - .primary_key(), - ) - .col(ColumnDef::new(Session::UserId).integer().not_null()) - .col(ColumnDef::new(Session::CreatedAt).date_time().not_null()) - .col(ColumnDef::new(Session::ExpiresAt).date_time().not_null()) - .to_owned(); - manager .create_table( Table::create() @@ -36,7 +19,7 @@ impl MigrationTrait for Migration { .primary_key(), ) .col(ColumnDef::new(Session::UserId).integer().not_null()) - .col(ColumnDef::new(Session::IpAddress).inet().not_null()) + .col(ColumnDef::new(Session::IpAddress).string().not_null()) .col(ColumnDef::new(Session::CreatedAt).date_time().not_null()) .col(ColumnDef::new(Session::ExpiresAt).date_time().not_null()) .to_owned(),