From af63c844a8fb735447d58d9c3c0d7c3c0f40c4b8 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Tue, 31 Dec 2024 01:19:23 +0100 Subject: [PATCH] add event_id --- src/db/models/event.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/db/models/event.rs b/src/db/models/event.rs index a7987cdb7ba..5fea7160bd1 100644 --- a/src/db/models/event.rs +++ b/src/db/models/event.rs @@ -1,10 +1,9 @@ -use crate::db::DbConn; +use chrono::{NaiveDateTime, TimeDelta, Utc}; +//use derive_more::{AsRef, Deref, Display, From}; use serde_json::Value; use super::{CipherId, CollectionId, GroupId, MembershipId, OrgPolicyId, OrganizationId, UserId}; -use crate::{api::EmptyResult, error::MapResult, CONFIG}; - -use chrono::{NaiveDateTime, TimeDelta, Utc}; +use crate::{api::EmptyResult, db::DbConn, error::MapResult, CONFIG}; // https://bitwarden.com/help/event-logs/ @@ -16,7 +15,7 @@ db_object! { #[diesel(table_name = event)] #[diesel(primary_key(uuid))] pub struct Event { - pub uuid: String, + pub uuid: EventId, pub event_type: i32, // EventType pub user_uuid: Option, pub org_uuid: Option, @@ -129,7 +128,7 @@ impl Event { }; Self { - uuid: crate::util::get_uuid(), + uuid: EventId(crate::util::get_uuid()), event_type, user_uuid: None, org_uuid: None, @@ -328,3 +327,6 @@ impl Event { } } } + +#[derive(Clone, Debug, DieselNewType, FromForm, Hash, PartialEq, Eq, Serialize, Deserialize)] +pub struct EventId(String);