refactor: Update public key column type from String to PublicKey #29

Manually merged
awiteb merged 6 commits from awiteb/refactor-entities-public-key into master 2024-07-24 00:20:10 +02:00 AGit
4 changed files with 8 additions and 8 deletions
Showing only changes of commit eb52c0a030 - Show all commits

View file

@ -22,7 +22,7 @@
//! Entity for `in_chat_requests` table
use chrono::Utc;
use oxidetalis_core::types::PublicKey as CorePublicKey;
use oxidetalis_core::types::PublicKey;
Amjad50 marked this conversation as resolved
Review

Why is it here CorePublicKey? while in oxidetails crate is just PublicKey, I think it might be confusing as we would think its 2 types.

Why is it here `CorePublicKey`? while in `oxidetails` crate is just `PublicKey`, I think it might be confusing as we would think its 2 types.
Review

while in oxidetails crate is just PublicKey

Because oxidetalis only work with one PublicKey from the core, while
the core work with two PublicKey, the first one from k256 crate and
the second one it its own.

> while in `oxidetails` crate is just `PublicKey` Because `oxidetalis` only work with one `PublicKey` from the core, while the core work with two `PublicKey`, the first one from `k256` crate and the second one it its own.
Review

Ah right, didn't notice that

Ah right, didn't notice that
Review

Amjad50: Why is it here CorePublicKey? while in oxidetails crate is just PublicKey

You're right, I was mean if we use it in the core not entities.

awiteb: while the core work with two PublicKey

I didn't realize that was in entities.

> Amjad50: Why is it here CorePublicKey? while in oxidetails crate is just PublicKey You're right, I was mean if we use it in the core not entities. > awiteb: while the core work with two PublicKey I didn't realize that was in entities.
use sea_orm::entity::prelude::*;
use crate::prelude::*;
@ -34,7 +34,7 @@ pub struct Model {
pub id: UserId,
pub recipient_id: UserId,
/// Public key of the sender
pub sender: CorePublicKey,
pub sender: PublicKey,
/// The timestamp of the request, when it was received
pub in_on: chrono::DateTime<Utc>,
}

View file

@ -22,7 +22,7 @@
//! Entity for `out_chat_requests` table
use chrono::Utc;
use oxidetalis_core::types::PublicKey as CorePublicKey;
use oxidetalis_core::types::PublicKey;
use sea_orm::entity::prelude::*;
use crate::prelude::*;
@ -34,7 +34,7 @@ pub struct Model {
pub id: UserId,
pub sender_id: UserId,
/// Public key of the recipient
pub recipient: CorePublicKey,
pub recipient: PublicKey,
/// The timestamp of the request, when it was sent
pub out_on: chrono::DateTime<Utc>,
}

View file

@ -21,7 +21,7 @@
//! Entity for `users` table
use oxidetalis_core::types::PublicKey as CorePublicKey;
use oxidetalis_core::types::PublicKey;
use sea_orm::entity::prelude::*;
use crate::prelude::*;
@ -31,7 +31,7 @@ use crate::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: UserId,
pub public_key: CorePublicKey,
pub public_key: PublicKey,
pub is_admin: bool,
}

View file

@ -22,7 +22,7 @@
//! Entity for `users_status` table
use chrono::Utc;
use oxidetalis_core::types::PublicKey as CorePublicKey;
use oxidetalis_core::types::PublicKey;
use sea_orm::entity::prelude::*;
use crate::prelude::*;
@ -42,7 +42,7 @@ pub struct Model {
#[sea_orm(primary_key)]
pub id: UserId,
pub user_id: UserId,
pub target: CorePublicKey,
pub target: PublicKey,
pub status: AccessStatus,
pub updated_at: chrono::DateTime<Utc>,
}