mirror of
https://github.com/bitwarden/mobile
synced 2025-12-26 05:03:39 +00:00
add collection syncing
This commit is contained in:
@@ -17,6 +17,7 @@ namespace Bit.App.Models.Api
|
||||
public bool OrganizationUseTotp { get; set; }
|
||||
public JObject Data { get; set; }
|
||||
public IEnumerable<AttachmentResponse> Attachments { get; set; }
|
||||
public IEnumerable<string> CollectionIds { get; set; }
|
||||
public DateTime RevisionDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
9
src/App/Models/Api/Response/CollectionResponse.cs
Normal file
9
src/App/Models/Api/Response/CollectionResponse.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Bit.App.Models.Api
|
||||
{
|
||||
public class CollectionResponse
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace Bit.App.Models.Api
|
||||
{
|
||||
public ProfileResponse Profile { get; set; }
|
||||
public IEnumerable<FolderResponse> Folders { get; set; }
|
||||
public IEnumerable<CollectionResponse> Collections { get; set; }
|
||||
public IEnumerable<CipherResponse> Ciphers { get; set; }
|
||||
public DomainsResponse Domains { get; set; }
|
||||
}
|
||||
|
||||
29
src/App/Models/Collection.cs
Normal file
29
src/App/Models/Collection.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Bit.App.Models.Data;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Models
|
||||
{
|
||||
public class Collection
|
||||
{
|
||||
public Collection()
|
||||
{ }
|
||||
|
||||
public Collection(CollectionData data)
|
||||
{
|
||||
Id = data.Id;
|
||||
OrganizationId = data.OrganizationId;
|
||||
Name = data.Name != null ? new CipherString(data.Name) : null;
|
||||
}
|
||||
|
||||
public Collection(CollectionResponse response)
|
||||
{
|
||||
Id = response.Id;
|
||||
OrganizationId = response.OrganizationId;
|
||||
Name = response.Name != null ? new CipherString(response.Name) : null;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
public CipherString Name { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/App/Models/Data/CipherCollectionData.cs
Normal file
18
src/App/Models/Data/CipherCollectionData.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using SQLite;
|
||||
|
||||
namespace Bit.App.Models.Data
|
||||
{
|
||||
[Table("CipherCollection")]
|
||||
public class CipherCollectionData
|
||||
{
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
[Indexed]
|
||||
public string UserId { get; set; }
|
||||
[Indexed]
|
||||
public string CipherId { get; set; }
|
||||
[Indexed]
|
||||
public string CollectionId { get; set; }
|
||||
}
|
||||
}
|
||||
36
src/App/Models/Data/CollectionData.cs
Normal file
36
src/App/Models/Data/CollectionData.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using SQLite;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Models.Data
|
||||
{
|
||||
[Table("Collection")]
|
||||
public class CollectionData : IDataObject<string>
|
||||
{
|
||||
public CollectionData()
|
||||
{ }
|
||||
|
||||
public CollectionData(Collection collection, string userId)
|
||||
{
|
||||
Id = collection.Id;
|
||||
UserId = userId;
|
||||
Name = collection.Name?.EncryptedString;
|
||||
OrganizationId = collection.OrganizationId;
|
||||
}
|
||||
|
||||
public CollectionData(CollectionResponse collection, string userId)
|
||||
{
|
||||
Id = collection.Id;
|
||||
UserId = userId;
|
||||
Name = collection.Name;
|
||||
OrganizationId = collection.OrganizationId;
|
||||
}
|
||||
|
||||
[PrimaryKey]
|
||||
public string Id { get; set; }
|
||||
[Indexed]
|
||||
public string UserId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,5 @@ namespace Bit.App.Models.Data
|
||||
public string UserId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTime RevisionDateTime { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public Folder ToFolder()
|
||||
{
|
||||
return new Folder(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user