mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 17:12:49 -05:00
share api
This commit is contained in:
35
src/Api/Models/Request/ShareRequestModel.cs
Normal file
35
src/Api/Models/Request/ShareRequestModel.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Domains;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class ShareRequestModel
|
||||
{
|
||||
[Required]
|
||||
[StringLength(36)]
|
||||
public string UserId { get; set; }
|
||||
[Required]
|
||||
[StringLength(36)]
|
||||
public string CipherId { get; set; }
|
||||
public string Key { get; set; }
|
||||
|
||||
public Share ToShare(Guid sharerUserId)
|
||||
{
|
||||
return ToShare(new Share
|
||||
{
|
||||
SharerUserId = sharerUserId
|
||||
});
|
||||
}
|
||||
|
||||
public Share ToShare(Share existingShare)
|
||||
{
|
||||
existingShare.UserId = new Guid(UserId);
|
||||
existingShare.CipherId = new Guid(CipherId);
|
||||
existingShare.Key = Key;
|
||||
|
||||
return existingShare;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user