mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-17 15:27:43 +01:00
collection and folder models
This commit is contained in:
parent
eeb28f6ddf
commit
4b67ba027e
41
src/Core/Models/Domain/Collection.cs
Normal file
41
src/Core/Models/Domain/Collection.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.View;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
public class Collection : Domain
|
||||
{
|
||||
public Collection() { }
|
||||
|
||||
public Collection(CollectionData obj, bool alreadyEncrypted = false)
|
||||
{
|
||||
BuildDomainModel(this, obj, new HashSet<string>
|
||||
{
|
||||
"Id",
|
||||
"OrganizationId",
|
||||
"Name",
|
||||
"ExternalId",
|
||||
"ReadOnly"
|
||||
}, alreadyEncrypted, new HashSet<string>
|
||||
{
|
||||
"Id",
|
||||
"OrganizationId",
|
||||
"ExternalId",
|
||||
"ReadOnly"
|
||||
});
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
public CipherString Name { get; set; }
|
||||
public string ExternalId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
public Task<CollectionView> DecryptAsync(string orgId)
|
||||
{
|
||||
return DecryptObjAsync(new CollectionView(this), this, new HashSet<string> { "Name" }, orgId);
|
||||
}
|
||||
}
|
||||
}
|
32
src/Core/Models/Domain/Folder.cs
Normal file
32
src/Core/Models/Domain/Folder.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
public class Folder : Domain
|
||||
{
|
||||
public Folder() { }
|
||||
|
||||
public Folder(FolderData obj, bool alreadyEncrypted = false)
|
||||
{
|
||||
BuildDomainModel(this, obj, new HashSet<string>
|
||||
{
|
||||
"Id",
|
||||
"Name"
|
||||
}, alreadyEncrypted, new HashSet<string> { "Id" });
|
||||
RevisionDate = obj.RevisionDate;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public CipherString Name { get; set; }
|
||||
public DateTime RevisionDate { get; set; }
|
||||
|
||||
public Task<FolderView> DecryptAsync(string orgId)
|
||||
{
|
||||
return DecryptObjAsync(new FolderView(this), this, new HashSet<string> { "Name" }, orgId);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,23 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Domain;
|
||||
|
||||
namespace Bit.Core.Models.View
|
||||
{
|
||||
public class CollectionView
|
||||
public class CollectionView : View
|
||||
{
|
||||
public Guid OrganizationId { get; set; }
|
||||
public CollectionView() { }
|
||||
|
||||
public CollectionView(Collection c)
|
||||
{
|
||||
Id = c.Id;
|
||||
OrganizationId = c.OrganizationId;
|
||||
ReadOnly = c.ReadOnly;
|
||||
ExternalId = c.ExternalId;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ExternalId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Bit.Core.Models.Domain;
|
||||
using System;
|
||||
|
||||
namespace Bit.Core.Models.View
|
||||
{
|
||||
public class FolderView
|
||||
public class FolderView : View
|
||||
{
|
||||
public FolderView() { }
|
||||
|
||||
public FolderView(Folder f)
|
||||
{
|
||||
Id = f.Id;
|
||||
RevisionDate = f.RevisionDate;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTime RevisionDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user