mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
use EventTableEntity instead of TableEntity
This commit is contained in:
@ -14,20 +14,20 @@ namespace Bit.Core.Models.Data
|
||||
CipherId = cipher.Id;
|
||||
Type = (int)type;
|
||||
ActingUserId = actingUserId;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
if(OrganizationId.HasValue)
|
||||
{
|
||||
UserId = null;
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__CipherId={1}__ActingUserId={2}__Type={3}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), CipherId, ActingUserId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), CipherId, ActingUserId, Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
PartitionKey = $"UserId={UserId}";
|
||||
RowKey = string.Format("Date={0}__CipherId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), CipherId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), CipherId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ namespace Bit.Core.Models.Data
|
||||
CollectionId = collection.Id;
|
||||
Type = (int)type;
|
||||
ActingUserId = actingUserId;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__ActingUserId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), ActingUserId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), ActingUserId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class EventTableEntity : TableEntity
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
public int Type { get; set; }
|
||||
public Guid? UserId { get; set; }
|
||||
public Guid? OrganizationId { get; set; }
|
||||
|
@ -13,11 +13,11 @@ namespace Bit.Core.Models.Data
|
||||
GroupId = group.Id;
|
||||
Type = (int)type;
|
||||
ActingUserId = actingUserId;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__ActingUserId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), ActingUserId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), ActingUserId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ namespace Bit.Core.Models.Data
|
||||
OrganizationId = organization.Id;
|
||||
Type = (int)type;
|
||||
ActingUserId = actingUserId;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__ActingUserId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), ActingUserId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), ActingUserId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ namespace Bit.Core.Models.Data
|
||||
OrganizationUserId = organizationUser.Id;
|
||||
Type = (int)type;
|
||||
ActingUserId = actingUserId;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__ActingUserId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), ActingUserId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), ActingUserId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
UserId = userId;
|
||||
Type = (int)type;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
PartitionKey = $"UserId={UserId}";
|
||||
RowKey = string.Format("Date={0}__Type={1}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), Type);
|
||||
}
|
||||
|
||||
public UserEvent(Guid userId, Guid organizationId, EventType type)
|
||||
@ -22,11 +22,11 @@ namespace Bit.Core.Models.Data
|
||||
OrganizationId = organizationId;
|
||||
UserId = userId;
|
||||
Type = (int)type;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__UserId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), UserId, Type);
|
||||
CoreHelpers.DateTimeToTableStorageKey(Date), UserId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user