importer feature
This commit is contained in:
17
crates/domain/src/models/import_profile.rs
Normal file
17
crates/domain/src/models/import_profile.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use crate::value_objects::{ImportProfileId, UserId};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ImportProfile {
|
||||
pub id: ImportProfileId,
|
||||
pub user_id: UserId,
|
||||
pub name: String,
|
||||
pub field_mappings: String,
|
||||
pub created_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl ImportProfile {
|
||||
pub fn new(id: ImportProfileId, user_id: UserId, name: String, field_mappings: String, created_at: NaiveDateTime) -> Self {
|
||||
Self { id, user_id, name, field_mappings, created_at }
|
||||
}
|
||||
}
|
||||
20
crates/domain/src/models/import_session.rs
Normal file
20
crates/domain/src/models/import_session.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use crate::value_objects::{ImportSessionId, UserId};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ImportSession {
|
||||
pub id: ImportSessionId,
|
||||
pub user_id: UserId,
|
||||
pub parsed_data: String,
|
||||
pub field_mappings: Option<String>,
|
||||
pub row_results: Option<String>,
|
||||
pub created_at: NaiveDateTime,
|
||||
pub expires_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl ImportSession {
|
||||
pub fn new(id: ImportSessionId, user_id: UserId, parsed_data: String, created_at: NaiveDateTime) -> Self {
|
||||
let expires_at = created_at + chrono::Duration::hours(24);
|
||||
Self { id, user_id, parsed_data, field_mappings: None, row_results: None, created_at, expires_at }
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,11 @@ use crate::{
|
||||
},
|
||||
};
|
||||
pub mod collections;
|
||||
pub mod import_session;
|
||||
pub mod import_profile;
|
||||
|
||||
pub use import_session::ImportSession;
|
||||
pub use import_profile::ImportProfile;
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub enum SortDirection {
|
||||
|
||||
Reference in New Issue
Block a user