1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-17 23:50:58 -05:00

dep. history and favorites apis. backwards compat

This commit is contained in:
Kyle Spearrin
2017-04-12 14:42:19 -04:00
parent c6ef3dc283
commit 09048cf98f
10 changed files with 25 additions and 166 deletions

View File

@ -68,7 +68,6 @@
</ItemGroup>
<ItemGroup>
<Build Include="dbo\Tables\Device.sql" />
<Build Include="dbo\Tables\History.sql" />
<Build Include="dbo\Tables\Cipher.sql" />
<Build Include="dbo\Tables\FolderCipher.sql" />
<Build Include="dbo\Tables\Grant.sql" />
@ -85,7 +84,6 @@
<Build Include="dbo\Tables\SubvaultUser.sql" />
<Build Include="dbo\Views\SubvaultUserView.sql" />
<Build Include="dbo\Views\DeviceView.sql" />
<Build Include="dbo\Views\HistoryView.sql" />
<Build Include="dbo\Views\FolderView.sql" />
<Build Include="dbo\Views\CipherView.sql" />
<Build Include="dbo\Views\OrganizationUserView.sql" />
@ -123,7 +121,6 @@
<Build Include="dbo\Stored Procedures\Device_ReadById.sql" />
<Build Include="dbo\Stored Procedures\Organization_DeleteById.sql" />
<Build Include="dbo\Stored Procedures\Device_ReadByIdentifierUserId.sql" />
<Build Include="dbo\Stored Procedures\CipherDetails_ReadByRevisionDateUserWithDeleteHistory.sql" />
<Build Include="dbo\Stored Procedures\Organization_ReadById.sql" />
<Build Include="dbo\Stored Procedures\Device_ReadByUserId.sql" />
<Build Include="dbo\Stored Procedures\CipherDetails_ReadByTypeUserId.sql" />
@ -131,7 +128,6 @@
<Build Include="dbo\Stored Procedures\Device_Update.sql" />
<Build Include="dbo\Stored Procedures\CipherDetails_ReadByUserId.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_Create.sql" />
<Build Include="dbo\Stored Procedures\History_ReadById.sql" />
<Build Include="dbo\Stored Procedures\CipherDetails_ReadByUserIdHasSubvault.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_DeleteById.sql" />
<Build Include="dbo\Stored Procedures\User_Create.sql" />

View File

@ -1,24 +0,0 @@
CREATE PROCEDURE [dbo].[CipherDetails_ReadByRevisionDateUserWithDeleteHistory]
@SinceRevisionDate DATETIME2(7),
@UserId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
SELECT
*
FROM
[dbo].[CipherDetails](@UserId) C
WHERE
[RevisionDate] > @SinceRevisionDate
AND [UserId] = @UserId
SELECT
[CipherId]
FROM
[dbo].[History]
WHERE
[Date] > @SinceRevisionDate
AND [Event] = 2 -- Only cipher delete events.
AND [UserId] = @UserId
END

View File

@ -1,13 +0,0 @@
CREATE PROCEDURE [dbo].[History_ReadById]
@Id BIGINT
AS
BEGIN
SET NOCOUNT ON
SELECT
*
FROM
[dbo].[HistoryView]
WHERE
[Id] = @Id
END

View File

@ -26,21 +26,6 @@ BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[History]
(
[UserId],
[CipherId],
[Event],
[Date]
)
SELECT
[UserId],
[Id],
0, --Insert
[CreationDate]
FROM
INSERTED
DECLARE @UserId UNIQUEIDENTIFIER = (SELECT TOP 1 [UserId] FROM INSERTED)
UPDATE
@ -61,21 +46,6 @@ BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[History]
(
[UserId],
[CipherId],
[Event],
[Date]
)
SELECT
[UserId],
[Id],
1, --Update
[RevisionDate]
FROM
INSERTED
DECLARE @UserId UNIQUEIDENTIFIER = (SELECT TOP 1 [UserId] FROM INSERTED)
UPDATE
@ -96,21 +66,6 @@ BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[History]
(
[UserId],
[CipherId],
[Event],
[Date]
)
SELECT
[UserId],
[Id],
2, --Delete
GETUTCDATE()
FROM
DELETED
DECLARE @UserId UNIQUEIDENTIFIER = (SELECT TOP 1 [UserId] FROM DELETED)
UPDATE

View File

@ -1,9 +0,0 @@
CREATE TABLE [dbo].[History] (
[Id] BIGINT IDENTITY (1, 1) NOT NULL,
[UserId] UNIQUEIDENTIFIER NULL,
[CipherId] UNIQUEIDENTIFIER NOT NULL,
[Event] TINYINT NOT NULL,
[Date] DATETIME2 (7) NOT NULL,
CONSTRAINT [PK_CipherHistory] PRIMARY KEY CLUSTERED ([Id] ASC)
);

View File

@ -1,6 +0,0 @@
CREATE VIEW [dbo].[HistoryView]
AS
SELECT
*
FROM
[dbo].[History]