feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit
3 changed files with 38 additions and 37 deletions
Showing only changes of commit 4e50cb34c0 - Show all commits

View file

@ -29,18 +29,6 @@ pub struct Migration;
#[async_trait::async_trait] #[async_trait::async_trait]
impl MigrationTrait for Migration { impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_index(
Index::create()
.if_not_exists()
.name("sep_request")
.table(InChatRequests::Table)
.col(InChatRequests::RecipientId)
.col(InChatRequests::Sender)
.unique()
.to_owned(),
)
.await?;
manager manager
.create_table( .create_table(
Table::create() Table::create()
@ -74,6 +62,18 @@ impl MigrationTrait for Migration {
) )
.to_owned(), .to_owned(),
) )
.await?;
manager
.create_index(
Index::create()
.if_not_exists()
.name("sep_request")
.table(InChatRequests::Table)
.col(InChatRequests::RecipientId)
.col(InChatRequests::Sender)
.unique()
.to_owned(),
)
.await .await
} }
} }

View file

@ -29,19 +29,6 @@ pub struct Migration;
#[async_trait::async_trait] #[async_trait::async_trait]
impl MigrationTrait for Migration { impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_index(
Index::create()
.if_not_exists()
.name("sep_request")
.table(OutChatRequests::Table)
.col(OutChatRequests::SenderId)
.col(OutChatRequests::Recipient)
.unique()
.to_owned(),
)
.await?;
manager manager
.create_table( .create_table(
Table::create() Table::create()
@ -79,6 +66,19 @@ impl MigrationTrait for Migration {
) )
.to_owned(), .to_owned(),
) )
.await?;
manager
.create_index(
Index::create()
.if_not_exists()
.name("sep_request")
.table(OutChatRequests::Table)
.col(OutChatRequests::SenderId)
.col(OutChatRequests::Recipient)
.unique()
.to_owned(),
)
.await .await
} }
} }

View file

@ -40,18 +40,6 @@ impl MigrationTrait for Migration {
.to_owned(), .to_owned(),
) )
.await?; .await?;
manager
.create_index(
Index::create()
.if_not_exists()
.name("sep_status")
.table(UsersStatus::Table)
.col(UsersStatus::UserId)
.col(UsersStatus::Target)
.unique()
.to_owned(),
)
.await?;
manager manager
.create_table( .create_table(
@ -90,6 +78,19 @@ impl MigrationTrait for Migration {
) )
.to_owned(), .to_owned(),
) )
.await?;
manager
.create_index(
Index::create()
.if_not_exists()
.name("sep_status")
.table(UsersStatus::Table)
.col(UsersStatus::UserId)
.col(UsersStatus::Target)
.unique()
.to_owned(),
)
.await .await
} }
} }