1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

Updates for devices

This commit is contained in:
Kyle Spearrin 2016-06-21 22:17:31 -04:00
parent a07a682831
commit 0e6fd21805
4 changed files with 7 additions and 1 deletions

View File

@ -23,7 +23,7 @@ namespace Bit.Api.Models
{
return ToDevice(new Device
{
UserId = new Guid(userId)
UserId = userId == null ? default(Guid) : new Guid(userId)
});
}

View File

@ -74,6 +74,7 @@ namespace Bit.Core.Identity
var existingDevice = await _deviceRepository.GetByIdentifierAsync(device.Identifier, user.Id);
if(existingDevice == null)
{
device.UserId = user.Id;
await _deviceRepository.CreateAsync(device);
}
}

View File

@ -3,6 +3,7 @@
@UserId UNIQUEIDENTIFIER,
@Name NVARCHAR(50),
@Type TINYINT,
@Identifier NVARCHAR(50),
@PushToken NVARCHAR(255),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7)
@ -16,6 +17,7 @@ BEGIN
[UserId],
[Name],
[Type],
[Identifier],
[PushToken],
[CreationDate],
[RevisionDate]
@ -26,6 +28,7 @@ BEGIN
@UserId,
@Name,
@Type,
@Identifier,
@PushToken,
@CreationDate,
@RevisionDate

View File

@ -3,6 +3,7 @@
@UserId UNIQUEIDENTIFIER,
@Name NVARCHAR(50),
@Type TINYINT,
@Identifier NVARCHAR(50),
@PushToken NVARCHAR(255),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7)
@ -16,6 +17,7 @@ BEGIN
[UserId] = @UserId,
[Name] = @Name,
[Type] = @Type,
[Identifier] = @Identifier,
[PushToken] = @PushToken,
[CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate