refactor: Refactor in_chat_requests table #35

Manually merged
awiteb merged 7 commits from awiteb/rename-chat-request-table-and-save-respnse-in-it into master 2024-07-30 10:39:04 +02:00 AGit
3 changed files with 8 additions and 8 deletions
Showing only changes of commit d1ca5c0a48 - Show all commits

View file

@ -43,7 +43,7 @@ impl IncomingChatExt for DatabaseConnection {
IncomingChatEntity::insert(IncomingChatActiveModel {
recipient_id: Set(recipient.id),
sender: Set(*sender),
in_on: Set(Utc::now()),
received_timestamp: Set(Utc::now()),
..Default::default()
})
.on_conflict(

View file

@ -31,15 +31,15 @@ use crate::prelude::*;
#[sea_orm(table_name = "incoming_chat")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: IdCol,
pub recipient_id: IdCol,
pub id: IdCol,
pub recipient_id: IdCol,
/// Public key of the sender
pub sender: PublicKey,
pub sender: PublicKey,
/// Whether the chat response accepted or not.
/// 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
pub in_on: chrono::DateTime<Utc>,
pub received_timestamp: chrono::DateTime<Utc>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]

View file

@ -65,7 +65,7 @@ impl MigrationTrait for Migration {
.default(Option::<bool>::None),
)
.col(
ColumnDef::new(IncomingChat::InOn)
ColumnDef::new(IncomingChat::ReceivedTimestamp)
.timestamp_with_time_zone()
.not_null(),
)
@ -97,5 +97,5 @@ enum IncomingChat {
Sender,
/// Whether the chat response accepted or not
AcceptedResponse,
InOn,
ReceivedTimestamp,
}