Prototyping
This commit is contained in:
+2
-2
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class AddVaultContentHeaderViewModel : ObservableCollectionViewModel
|
||||
public partial class AddVaultContentCommandHeaderViewModel : ObservableCollectionViewModel
|
||||
{
|
||||
public AddVaultContentHeaderViewModel(IServiceProvider provider,
|
||||
public AddVaultContentCommandHeaderViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -3,14 +3,37 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class AddVaultContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
NamedComponent named) : ObservableCollectionViewModel(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
public partial class AddVaultContentViewModel :
|
||||
ObservableCollectionViewModel<IVaultContentEntryViewModel>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string named = $"{named}";
|
||||
private string named;
|
||||
|
||||
public AddVaultContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
NamedComponent named) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
Named = $"{named}";
|
||||
|
||||
Add<VaultContentHeaderViewModel>();
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
public Task<bool> Confirm()
|
||||
{
|
||||
VaultContentConfiguration configuration = new();
|
||||
foreach (IVaultContentEntryViewModel item in this)
|
||||
{
|
||||
item.Invoke(configuration);
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,18 +7,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.8" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bitvault.Data\Bitvault.Data.csproj" />
|
||||
<ProjectReference Include="..\Toolkit\Toolkit.Avalonia\Toolkit.Avalonia.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public record Category
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public record Content
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int State { get; set; }
|
||||
|
||||
public ICollection<Tag>? Tags { get; }
|
||||
|
||||
public Category? Category { get; }
|
||||
|
||||
public ICollection<Document>? Documents { get; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public record Document
|
||||
{
|
||||
public byte[]? Blob { get; set; }
|
||||
|
||||
public DocumentType Type { get; set; }
|
||||
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public enum DocumentType
|
||||
{
|
||||
Form,
|
||||
File
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public interface IVaultContentEntryViewModel :
|
||||
IValueInvoker<VaultContentConfiguration>;
|
||||
@@ -1,16 +0,0 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class IconPickerViewModel : ObservableViewModel
|
||||
{
|
||||
public IconPickerViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class Tag
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record VaultContentConfiguration
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
@@ -7,4 +7,9 @@ public partial class VaultContentHeaderViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer);
|
||||
IDisposer disposer) : ObservableViewModel<string, string>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IVaultContentEntryViewModel
|
||||
{
|
||||
public void Invoke(VaultContentConfiguration args) =>
|
||||
args.Name = Value;
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class VaultDbContext(DbContextOptions<VaultDbContext> options) :
|
||||
DbContext(options)
|
||||
{
|
||||
public DbSet<Category> Categories { get; set; }
|
||||
|
||||
public DbSet<Document> Documents { get; set; }
|
||||
|
||||
public DbSet<Content> Items { get; set; }
|
||||
|
||||
public DbSet<Tag> Tags { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Content>()
|
||||
.HasMany(x => x.Tags)
|
||||
.WithOne();
|
||||
|
||||
modelBuilder.Entity<Content>()
|
||||
.HasMany(x => x.Documents)
|
||||
.WithOne();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Bitvault.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
Reference in New Issue
Block a user