refactor: Refactor in_chat_requests
table #35
3 changed files with 8 additions and 8 deletions
|
@ -43,7 +43,7 @@ impl IncomingChatExt for DatabaseConnection {
|
||||||
IncomingChatEntity::insert(IncomingChatActiveModel {
|
IncomingChatEntity::insert(IncomingChatActiveModel {
|
||||||
recipient_id: Set(recipient.id),
|
recipient_id: Set(recipient.id),
|
||||||
sender: Set(*sender),
|
sender: Set(*sender),
|
||||||
in_on: Set(Utc::now()),
|
received_timestamp: Set(Utc::now()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.on_conflict(
|
.on_conflict(
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub struct Model {
|
||||||
/// This will be `None` if it is chat request, otherwise `bool`
|
/// This will be `None` if it is chat request, otherwise `bool`
|
||||||
pub accepted_response: Option<bool>,
|
pub accepted_response: Option<bool>,
|
||||||
/// The timestamp of the request, when it was received
|
/// The timestamp of the request, when it was received
|
||||||
pub in_on: chrono::DateTime<Utc>,
|
pub received_timestamp: chrono::DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl MigrationTrait for Migration {
|
||||||
.default(Option::<bool>::None),
|
.default(Option::<bool>::None),
|
||||||
)
|
)
|
||||||
.col(
|
.col(
|
||||||
ColumnDef::new(IncomingChat::InOn)
|
ColumnDef::new(IncomingChat::ReceivedTimestamp)
|
||||||
.timestamp_with_time_zone()
|
.timestamp_with_time_zone()
|
||||||
.not_null(),
|
.not_null(),
|
||||||
)
|
)
|
||||||
|
@ -97,5 +97,5 @@ enum IncomingChat {
|
||||||
Sender,
|
Sender,
|
||||||
/// Whether the chat response accepted or not
|
/// Whether the chat response accepted or not
|
||||||
AcceptedResponse,
|
AcceptedResponse,
|
||||||
InOn,
|
ReceivedTimestamp,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue