fix: no more id collisions
This commit is contained in:
parent
71d017693c
commit
0b3573a513
11 changed files with 151 additions and 120 deletions
|
@ -1,5 +1,5 @@
|
|||
use serde::{Serialize, Deserialize};
|
||||
use tetratto_shared::{snow::AlmostSnowflake, unix_epoch_timestamp};
|
||||
use tetratto_shared::{snow::Snowflake, unix_epoch_timestamp};
|
||||
|
||||
use super::communities_permissions::CommunityPermission;
|
||||
|
||||
|
@ -30,10 +30,7 @@ impl Channel {
|
|||
/// Create a new [`Channel`].
|
||||
pub fn new(community: usize, owner: usize, position: usize, title: String) -> Self {
|
||||
Self {
|
||||
id: AlmostSnowflake::new(1234567890)
|
||||
.to_string()
|
||||
.parse::<usize>()
|
||||
.unwrap(),
|
||||
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
|
||||
community,
|
||||
owner,
|
||||
created: unix_epoch_timestamp() as usize,
|
||||
|
@ -84,10 +81,7 @@ impl Message {
|
|||
let now = unix_epoch_timestamp() as usize;
|
||||
|
||||
Self {
|
||||
id: AlmostSnowflake::new(1234567890)
|
||||
.to_string()
|
||||
.parse::<usize>()
|
||||
.unwrap(),
|
||||
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
|
||||
channel,
|
||||
owner,
|
||||
created: now,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue