1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

Refactor naming: Sites => Logins

This commit is contained in:
Kyle Spearrin
2017-01-02 21:52:13 -05:00
parent 7e56797847
commit 9cde513026
11 changed files with 86 additions and 68 deletions

View File

@ -5,8 +5,20 @@ namespace Bit.Api.Models
{
public class ImportRequestModel
{
private LoginRequestModel[] _logins;
public FolderRequestModel[] Folders { get; set; }
public SiteRequestModel[] Sites { get; set; }
[Obsolete]
public LoginRequestModel[] Sites
{
get { return _logins; }
set { _logins = value; }
}
public LoginRequestModel[] Logins
{
get { return _logins; }
set { _logins = value; }
}
public KeyValuePair<int, int>[] FolderRelationships { get; set; }
}
}

View File

@ -48,8 +48,8 @@ namespace Bit.Api.Models
case CipherType.Folder:
cipher.Data = JsonConvert.SerializeObject(new FolderDataModel(this), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
break;
case CipherType.Site:
cipher.Data = JsonConvert.SerializeObject(new SiteDataModel(this), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
case CipherType.Login:
cipher.Data = JsonConvert.SerializeObject(new LoginDataModel(this), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
break;
default:
throw new ArgumentException("Unsupported " + nameof(Type) + ".");

View File

@ -6,7 +6,7 @@ using Newtonsoft.Json;
namespace Bit.Api.Models
{
public class SiteRequestModel
public class LoginRequestModel
{
[StringLength(36)]
public string FolderId { get; set; }
@ -36,14 +36,15 @@ namespace Bit.Api.Models
});
}
public Cipher ToCipher(Cipher existingSite)
public Cipher ToCipher(Cipher existingLogin)
{
existingSite.FolderId = string.IsNullOrWhiteSpace(FolderId) ? null : (Guid?)new Guid(FolderId);
existingSite.Favorite = Favorite;
existingSite.Data = JsonConvert.SerializeObject(new SiteDataModel(this), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
existingSite.Type = Core.Enums.CipherType.Site;
existingLogin.FolderId = string.IsNullOrWhiteSpace(FolderId) ? null : (Guid?)new Guid(FolderId);
existingLogin.Favorite = Favorite;
existingLogin.Data = JsonConvert.SerializeObject(new LoginDataModel(this),
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
existingLogin.Type = Core.Enums.CipherType.Login;
return existingSite;
return existingLogin;
}
}
}