mirror of
https://github.com/bitwarden/server
synced 2026-01-21 03:43:53 +00:00
sql event repo "Get" implementations
This commit is contained in:
33
src/Sql/dbo/Stored Procedures/Event_ReadPageByCipherId.sql
Normal file
33
src/Sql/dbo/Stored Procedures/Event_ReadPageByCipherId.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
CREATE PROCEDURE [dbo].[Event_ReadPageByCipherId]
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@UserId UNIQUEIDENTIFIER,
|
||||
@CipherId UNIQUEIDENTIFIER,
|
||||
@StartDate DATETIME2(7),
|
||||
@EndDate DATETIME2(7),
|
||||
@BeforeDate DATETIME2(7),
|
||||
@PageSize INT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[EventView]
|
||||
WHERE
|
||||
[Date] >= @StartDate
|
||||
AND (@BeforeDate IS NOT NULL OR [Date] <= @EndDate)
|
||||
AND (@BeforeDate IS NULL OR [Date] < @BeforeDate)
|
||||
AND (
|
||||
(@OrganizationId IS NULL AND [OrganizationId] IS NULL)
|
||||
OR (@OrganizationId IS NOT NULL AND [OrganizationId] = @OrganizationId)
|
||||
)
|
||||
AND (
|
||||
(@UserId IS NULL AND [UserId] IS NULL)
|
||||
OR (@UserId IS NOT NULL AND [UserId] = @UserId)
|
||||
)
|
||||
AND [CipherId] = @CipherId
|
||||
ORDER BY [Date] DESC
|
||||
OFFSET 0 ROWS
|
||||
FETCH NEXT @PageSize ROWS ONLY
|
||||
END
|
||||
Reference in New Issue
Block a user