diff --git a/Directory.Packages.props b/Directory.Packages.props
index 19d2fdf8..9f3701fc 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -10,6 +10,7 @@
+
@@ -24,7 +25,6 @@
-
@@ -34,10 +34,8 @@
-
-
@@ -46,12 +44,9 @@
-
-
-
@@ -60,16 +55,14 @@
-
-
-
+
@@ -81,6 +74,5 @@
-
-
+
\ No newline at end of file
diff --git a/src/PostIt/PostIt/App.axaml.cs b/src/PostIt/PostIt/App.axaml.cs
index 6919f09d..66592224 100644
--- a/src/PostIt/PostIt/App.axaml.cs
+++ b/src/PostIt/PostIt/App.axaml.cs
@@ -27,18 +27,18 @@ public partial class App : Application
{
desktop.MainWindow = new MainWindow
{
- DataContext = new MainViewModel()
+ DataContext = new MainPageViewModel()
};
}
else if (ApplicationLifetime is IActivityApplicationLifetime singleViewFactoryApplicationLifetime)
{
- singleViewFactoryApplicationLifetime.MainViewFactory = () => new MainView { DataContext = new MainViewModel() };
+ singleViewFactoryApplicationLifetime.MainViewFactory = () => new MainPage { DataContext = new MainPageViewModel() };
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
{
- singleViewPlatform.MainView = new MainView
+ singleViewPlatform.MainView = new MainPage
{
- DataContext = new MainViewModel()
+ DataContext = new MainPageViewModel()
};
}
diff --git a/src/PostIt/PostIt/Settings/Settings.cs b/src/PostIt/PostIt/Settings/Settings.cs
index 462faedd..1064004c 100644
--- a/src/PostIt/PostIt/Settings/Settings.cs
+++ b/src/PostIt/PostIt/Settings/Settings.cs
@@ -26,7 +26,7 @@ public partial class Settings : ObservableObject
[ObservableProperty]
- public partial string[] Scopes { get; set; }
+ public partial string[] Scopes { get; set; }
internal OidcClientOptions GetOidcClientOptions()
{
@@ -40,41 +40,44 @@ public partial class Settings : ObservableObject
}
- internal async Task Load(IStorageProvider storageProvider)
+ internal async Task Load()
{
- var configFile = await storageProvider.TryGetFileFromPathAsync(
- Path.Combine(AppContext.BaseDirectory, SettingsFileName));
+ String configPath =
+ Path.Combine(AppContext.BaseDirectory, SettingsFileName);
- if (configFile is null)
+ FileInfo configFileInfo = new FileInfo(configPath);
+
+ if (!configFileInfo.Exists)
{
- Console.Error.WriteLine("🩎 No settings file found.");
+ Console.Error.WriteLine($"🩎 Settings file not found at {configFileInfo.FullName}");
return; // no settings file
}
- try {
- using var stream = await configFile.OpenReadAsync();
-
- using var reader = new StreamReader( stream);
- var json = await reader.ReadToEndAsync();
- if (string.IsNullOrWhiteSpace(json))
- {
- Console.Error.WriteLine("🩎 Settings file is empty.");
- return ;
- }
+ Console.WriteLine($"🔎 Loading settings from {configFileInfo.FullName}");
- var settings = JsonSerializer.Deserialize(json);
+ try
+ {
+ using var stream = configFileInfo.OpenRead();
+ using var reader = new StreamReader(stream);
+ var json = await reader.ReadToEndAsync();
+ if (string.IsNullOrWhiteSpace(json))
+ {
+ Console.Error.WriteLine("🩎 Settings file is empty.");
+ return;
+ }
- if (settings is null)
- {
- Console.Error.WriteLine("🩎 Settings file is invalid.");
- return ;
- }
- this.Authentication = settings.Authentication;
- this.DarkMode = settings.DarkMode;
- this.ApiUrl = settings.ApiUrl;
- this.Scopes = settings.Scopes;
+ var settings = JsonSerializer.Deserialize(json);
+
+ if (settings is null)
+ {
+ Console.Error.WriteLine("🩎 Settings file is invalid.");
+ return;
+ }
+ this.Authentication = settings.Authentication;
+ this.DarkMode = settings.DarkMode;
+ this.ApiUrl = settings.ApiUrl;
+ this.Scopes = settings.Scopes;
-
}
catch (Exception ex)
{
diff --git a/src/PostIt/PostIt/ViewLocator.cs b/src/PostIt/PostIt/ViewLocator.cs
index 7c03656f..38f2b3fe 100644
--- a/src/PostIt/PostIt/ViewLocator.cs
+++ b/src/PostIt/PostIt/ViewLocator.cs
@@ -2,36 +2,34 @@ using System;
using System.Diagnostics.CodeAnalysis;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
+using Microsoft.Extensions.DependencyInjection;
using PostIt.ViewModels;
+using PostIt.Views;
namespace PostIt;
///
/// Given a view model, returns the corresponding view if possible.
///
-[RequiresUnreferencedCode(
- "Default implementation of ViewLocator involves reflection which may be trimmed away.",
- Url = "https://docs.avaloniaui.net/docs/concepts/view-locator")]
+
public class ViewLocator : IDataTemplate
{
- public Control? Build(object? param)
+ private readonly IServiceProvider _services;
+
+ public ViewLocator(IServiceProvider services)
{
- if (param is null)
- return null;
+ _services = services;
+ }
- var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
- var type = Type.GetType(name);
-
- if (type != null)
+ public Control Build(object data)
+ {
+ return data switch
{
- return (Control)Activator.CreateInstance(type)!;
- }
-
- return new TextBlock { Text = "Not Found: " + name };
+ MainPageViewModel => _services.GetRequiredService(),
+ SettingsPageViewModel => _services.GetRequiredService(),
+ _ => new TextBlock { Text = $"No view for {data.GetType().Name}" }
+ };
}
- public bool Match(object? data)
- {
- return data is ViewModelBase;
- }
+ public bool Match(object data) => data is ViewModelBase;
}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs b/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs
new file mode 100644
index 00000000..d56711af
--- /dev/null
+++ b/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs
@@ -0,0 +1,15 @@
+
+namespace PostIt.ViewModels;
+
+public class HomePageViewModel : ViewModelBase
+{
+ private string _welcomeText = "Welcome to PostIt!";
+ public string WelcomeText
+ {
+ get => _welcomeText;
+ set => SetProperty(ref _welcomeText, value);
+ }
+ public override bool CanNavigateNext { get => true; protected set => throw new System.NotImplementedException(); }
+ public override bool CanNavigatePrevious { get => false; protected set => throw new System.NotImplementedException(); }
+
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/ViewModels/MainViewModel.cs b/src/PostIt/PostIt/ViewModels/MainViewModel.cs
index 6dcc951d..10f9febe 100644
--- a/src/PostIt/PostIt/ViewModels/MainViewModel.cs
+++ b/src/PostIt/PostIt/ViewModels/MainViewModel.cs
@@ -15,9 +15,15 @@ using Avalonia.Styling;
namespace PostIt.ViewModels;
-public partial class MainViewModel : ViewModelBase
+public partial class MainPageViewModel : ViewModelBase
{
+ [ObservableProperty]
+ public partial string Title { get; set; }
+
+ [ObservableProperty]
+ public partial ViewModelBase? CurrentViewModel { get; set; }
+ public SettingsPageViewModel SettingsModel { get; }
[ObservableProperty]
public partial string StatusMessage { get; set; }
@@ -34,18 +40,20 @@ public partial class MainViewModel : ViewModelBase
public partial ObservableCollection FilteredPosts { get; set; }
[ObservableProperty]
- public partial BlogPost? SelectedPost{ get; set; }
+ public partial BlogPost? SelectedPost { get; set; }
[ObservableProperty]
- public partial bool IsBusy{ get; set; }
+ public partial bool IsBusy { get; set; }
[ObservableProperty]
ThemeVariant themeVariant = ThemeVariant.Default;
-
+
[ObservableProperty]
public partial Settings Settings { get; private set; }
+ public override bool CanNavigateNext { get => throw new NotImplementedException(); protected set => throw new NotImplementedException(); }
+ public override bool CanNavigatePrevious { get => throw new NotImplementedException(); protected set => throw new NotImplementedException(); }
- public MainViewModel()
+ public MainPageViewModel()
{
SearchText = string.Empty;
Posts = new ObservableCollection();
@@ -55,6 +63,9 @@ public partial class MainViewModel : ViewModelBase
IsBusy = false;
StatusMessage = "Ready";
Settings = new Settings();
+ Title = "PostIt";
+ CurrentViewModel = this;
+ SettingsModel = new SettingsPageViewModel();
}
partial void OnSearchTextChanged(string value)
@@ -105,7 +116,7 @@ public partial class MainViewModel : ViewModelBase
try
{
- var loginWin = new PostIt.Views.LoginWindow();
+ var loginWin = new PostIt.Views.LoginPage();
var result = await loginWin.StartLoginAsync(Settings.GetOidcClientOptions());
if (result is not null && !result.IsError && !string.IsNullOrWhiteSpace(result.AccessToken))
@@ -202,6 +213,12 @@ public partial class MainViewModel : ViewModelBase
StatusMessage = "New blog post ready.";
}
+ [RelayCommand]
+ internal void OpenSettings()
+ {
+ // Appeler la méthode OpenSettings de la vue MainWindow
+ CurrentViewModel = SettingsModel;
+ }
private async Task RefreshPostsAsync()
{
@@ -224,7 +241,7 @@ public partial class MainViewModel : ViewModelBase
private void ApplyFilter()
{
if (Posts is null) return;
-
+
var query = SearchText?.Trim();
var filtered = string.IsNullOrWhiteSpace(query)
? Posts.OrderByDescending(p => p.DateModified)
@@ -299,6 +316,7 @@ public partial class MainViewModel : ViewModelBase
return payload;
}
+
private static readonly JsonSerializerOptions JsonOptions = new()
{
PropertyNameCaseInsensitive = true
diff --git a/src/PostIt/PostIt/ViewModels/SettingsViewModel.cs b/src/PostIt/PostIt/ViewModels/SettingsViewModel.cs
index aab3b2af..2f871ee1 100644
--- a/src/PostIt/PostIt/ViewModels/SettingsViewModel.cs
+++ b/src/PostIt/PostIt/ViewModels/SettingsViewModel.cs
@@ -2,7 +2,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
namespace PostIt.ViewModels;
-public partial class SettingsViewModel : ViewModelBase
+public partial class SettingsPageViewModel : ViewModelBase
{
[ObservableProperty]
public partial bool DarkMode { get; set; }
@@ -15,5 +15,6 @@ public partial class SettingsViewModel : ViewModelBase
[ObservableProperty]
public partial string ClientSecret { get; set; }
-
+ public override bool CanNavigateNext { get => false; protected set => throw new System.NotImplementedException(); }
+ public override bool CanNavigatePrevious { get => true; protected set => throw new System.NotImplementedException(); }
}
diff --git a/src/PostIt/PostIt/ViewModels/ViewModelBase.cs b/src/PostIt/PostIt/ViewModels/ViewModelBase.cs
index 3d28c6dd..93019360 100644
--- a/src/PostIt/PostIt/ViewModels/ViewModelBase.cs
+++ b/src/PostIt/PostIt/ViewModels/ViewModelBase.cs
@@ -5,4 +5,15 @@ namespace PostIt.ViewModels;
public abstract partial class ViewModelBase : ObservableObject
{
+
+ ///
+ /// Gets if the user can navigate to the next page
+ ///
+ public abstract bool CanNavigateNext { get; protected set; }
+
+ ///
+ /// Gets if the user can navigate to the previous page
+ ///
+ public abstract bool CanNavigatePrevious { get; protected set; }
+
}
diff --git a/src/PostIt/PostIt/Views/HomePage.axaml b/src/PostIt/PostIt/Views/HomePage.axaml
new file mode 100644
index 00000000..1c188b31
--- /dev/null
+++ b/src/PostIt/PostIt/Views/HomePage.axaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt/Views/HomePage.axaml.cs b/src/PostIt/PostIt/Views/HomePage.axaml.cs
new file mode 100644
index 00000000..8b32847d
--- /dev/null
+++ b/src/PostIt/PostIt/Views/HomePage.axaml.cs
@@ -0,0 +1,23 @@
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using System.Threading.Tasks;
+
+namespace PostIt.Views;
+
+public partial class HomePage : ContentPage
+{
+ public HomePage()
+ {
+ InitializeComponent();
+ }
+
+ private async void OnLoginClick(object? sender, RoutedEventArgs e)
+ {
+ if (Navigation is not null)
+
+ await Navigation.PushModalAsync(new LoginPage());
+ }
+
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/Views/LoginPage.axaml b/src/PostIt/PostIt/Views/LoginPage.axaml
new file mode 100644
index 00000000..5b79bb60
--- /dev/null
+++ b/src/PostIt/PostIt/Views/LoginPage.axaml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt/Views/LoginPage.axaml.cs b/src/PostIt/PostIt/Views/LoginPage.axaml.cs
new file mode 100644
index 00000000..0d86e47c
--- /dev/null
+++ b/src/PostIt/PostIt/Views/LoginPage.axaml.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Threading.Tasks;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using IdentityModel.OidcClient;
+using PostIt.Services;
+
+namespace PostIt.Views;
+
+public partial class LoginPage : ContentPage
+{
+ private TaskCompletionSource _tcs = new();
+
+ public Settings Settings { get; }
+
+ public LoginPage()
+ {
+ this.Settings = new Settings();
+ InitializeComponent();
+ }
+
+ public async Task StartLoginAsync(OidcClientOptions options)
+ {
+ try
+ {
+ Settings.Load().Wait();
+
+ var client = new OidcClient(options);
+ var loginResult = await client.LoginAsync(new LoginRequest());
+ return loginResult;
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ private async void OnLoginClick(object? sender, RoutedEventArgs e)
+ {
+ // This is where you specify your actual login auth logic
+ if (Navigation is not null)
+ await Navigation.PopModalAsync();
+ }
+
+ private async void OnCancelClick(object? sender, RoutedEventArgs e)
+ {
+ // Cancel button dismisses all open modals
+ if (Navigation is not null)
+ await Navigation.PopAllModalsAsync();
+ }
+}
diff --git a/src/PostIt/PostIt/Views/LoginWindow.axaml b/src/PostIt/PostIt/Views/LoginWindow.axaml
deleted file mode 100644
index 6d80609b..00000000
--- a/src/PostIt/PostIt/Views/LoginWindow.axaml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/PostIt/PostIt/Views/LoginWindow.axaml.cs b/src/PostIt/PostIt/Views/LoginWindow.axaml.cs
deleted file mode 100644
index f80a2698..00000000
--- a/src/PostIt/PostIt/Views/LoginWindow.axaml.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using Avalonia.Controls;
-using Avalonia.Interactivity;
-using IdentityModel.OidcClient;
-using PostIt.Services;
-
-namespace PostIt.Views;
-
-public partial class LoginWindow : Window
-{
- private TaskCompletionSource _tcs = new();
-
- public LoginWindow()
- {
- InitializeComponent();
- CancelButton.Click += (_, __) => Close(null);
- }
-
- public async Task StartLoginAsync(OidcClientOptions options)
- {
- try
- {
- var client = new OidcClient(options);
- var loginResult = await client.LoginAsync(new LoginRequest());
- return loginResult;
- }
- catch (Exception)
- {
- return null;
- }
- }
-}
diff --git a/src/PostIt/PostIt/Views/MainView.axaml b/src/PostIt/PostIt/Views/MainPage.axaml
similarity index 86%
rename from src/PostIt/PostIt/Views/MainView.axaml
rename to src/PostIt/PostIt/Views/MainPage.axaml
index d1aae9de..2313d973 100644
--- a/src/PostIt/PostIt/Views/MainView.axaml
+++ b/src/PostIt/PostIt/Views/MainPage.axaml
@@ -1,4 +1,4 @@
-
+ mc:Ignorable="d"
+ x:Class="PostIt.Views.MainPage"
+ x:DataType="vm:MainPageViewModel" HorizontalAlignment="Center" VerticalAlignment="Center" >
-
+
-
+
-
-
+
@@ -26,7 +25,6 @@
-
@@ -56,6 +54,6 @@
-
+
-
+
diff --git a/src/PostIt/PostIt/Views/MainView.axaml.cs b/src/PostIt/PostIt/Views/MainPage.axaml.cs
similarity index 62%
rename from src/PostIt/PostIt/Views/MainView.axaml.cs
rename to src/PostIt/PostIt/Views/MainPage.axaml.cs
index 0ed68cf1..f84098cd 100644
--- a/src/PostIt/PostIt/Views/MainView.axaml.cs
+++ b/src/PostIt/PostIt/Views/MainPage.axaml.cs
@@ -4,9 +4,9 @@ using Avalonia.Controls;
namespace PostIt.Views;
-public partial class MainView : UserControl
+public partial class MainPage : NavigationPage
{
- public MainView()
+ public MainPage()
{
InitializeComponent();
}
diff --git a/src/PostIt/PostIt/Views/MainViewModel.cs b/src/PostIt/PostIt/Views/MainViewModel.cs
new file mode 100644
index 00000000..5d30ae8f
--- /dev/null
+++ b/src/PostIt/PostIt/Views/MainViewModel.cs
@@ -0,0 +1,26 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using PostIt.ViewModels;
+
+public partial class MainWindowViewModel : ObservableObject
+{
+ // Stocke le ViewModel de la page actuellement affichée
+ [ObservableProperty]
+ private object? _currentPage;
+
+ // Instances des pages pour éviter de les recréer à chaque fois (Optionnel)
+ private readonly HomePageViewModel _homePage = new();
+ private readonly SettingsPageViewModel _settingsPage = new();
+
+ public MainWindowViewModel()
+ {
+ // Définir la page de démarrage par défaut
+ CurrentPage = _homePage;
+ }
+
+ [RelayCommand]
+ private void NavigateToHome() => CurrentPage = _homePage;
+
+ [RelayCommand]
+ private void NavigateToSettings() => CurrentPage = _settingsPage;
+}
diff --git a/src/PostIt/PostIt/Views/MainWindow.axaml b/src/PostIt/PostIt/Views/MainWindow.axaml
index e9f1966a..f8f4317f 100644
--- a/src/PostIt/PostIt/Views/MainWindow.axaml
+++ b/src/PostIt/PostIt/Views/MainWindow.axaml
@@ -1,13 +1,14 @@
-
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt/Views/MainWindow.axaml.cs b/src/PostIt/PostIt/Views/MainWindow.axaml.cs
index 831fb6e0..9cb85f55 100644
--- a/src/PostIt/PostIt/Views/MainWindow.axaml.cs
+++ b/src/PostIt/PostIt/Views/MainWindow.axaml.cs
@@ -1,35 +1,11 @@
using Avalonia.Controls;
-using Avalonia.Styling;
-using PostIt.ViewModels;
-using System;
-using System.Threading.Tasks;
namespace PostIt.Views;
public partial class MainWindow : Window
{
- internal Settings Settings { get; private set; }
-
public MainWindow()
{
-
InitializeComponent();
-
- this.Settings = new Settings();
-
-
}
-
- protected override void OnDataContextChanged(EventArgs e)
- {
- base.OnDataContextChanged(e);
- if (DataContext is MainViewModel vm)
- {
- Task.Run(async () => await this.Settings.Load(this.StorageProvider)).Wait();
- this.RequestedThemeVariant = Settings.DarkMode ? ThemeVariant.Dark : ThemeVariant.Light;
- MainView.DataContext = new MainViewModel();
- vm.Settings.Load(this.StorageProvider).Wait();
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/Views/SettingsView.axaml b/src/PostIt/PostIt/Views/SettingsPage.axaml
similarity index 88%
rename from src/PostIt/PostIt/Views/SettingsView.axaml
rename to src/PostIt/PostIt/Views/SettingsPage.axaml
index 40a403ac..9d5b6f89 100644
--- a/src/PostIt/PostIt/Views/SettingsView.axaml
+++ b/src/PostIt/PostIt/Views/SettingsPage.axaml
@@ -1,11 +1,10 @@
-
@@ -26,4 +25,4 @@
-
+
diff --git a/src/PostIt/PostIt/Views/SettingsView.axaml.cs b/src/PostIt/PostIt/Views/SettingsPage.axaml.cs
similarity index 57%
rename from src/PostIt/PostIt/Views/SettingsView.axaml.cs
rename to src/PostIt/PostIt/Views/SettingsPage.axaml.cs
index 20e8c1c2..14916bb3 100644
--- a/src/PostIt/PostIt/Views/SettingsView.axaml.cs
+++ b/src/PostIt/PostIt/Views/SettingsPage.axaml.cs
@@ -3,9 +3,9 @@
using Avalonia.Controls;
namespace PostIt.Views;
-public partial class SettingsView: Window
+public partial class SettingsPage: ContentPage
{
- public SettingsView()
+ public SettingsPage()
{
InitializeComponent();
}
diff --git a/src/Yavsc.Abstract/Blogspot/IBlog.cs b/src/Yavsc.Abstract/Blogspot/IBlog.cs
index 511a9870..86efc8e3 100644
--- a/src/Yavsc.Abstract/Blogspot/IBlog.cs
+++ b/src/Yavsc.Abstract/Blogspot/IBlog.cs
@@ -7,8 +7,8 @@ namespace Yavsc
{
public interface IBlogPostPayLoad
{
- string? Article { get; set; }
- string? Photo { get; set; }
+ string Article { get; set; }
+ string Photo { get; set; }
}
public interface IBlogPost : IBlogPostPayLoad, ITrackedEntity, IIdentified, ITitle
diff --git a/src/Yavsc.Abstract/FileSystem/MoveFileQuery.cs b/src/Yavsc.Abstract/FileSystem/MoveFileQuery.cs
index c0f97050..84d13540 100644
--- a/src/Yavsc.Abstract/FileSystem/MoveFileQuery.cs
+++ b/src/Yavsc.Abstract/FileSystem/MoveFileQuery.cs
@@ -7,10 +7,12 @@ namespace Yavsc.Models.FileSystem
{
[ValidRemoteUserFilePath]
[StringLength(512)]
+ [Required]
public required string Id { get; set; }
[StringLength(512)]
[ValidRemoteUserFilePath]
+ [Required]
public required string To { get; set; }
}
diff --git a/src/Yavsc.Abstract/IT/CiBuildSettings.cs b/src/Yavsc.Abstract/IT/CiBuildSettings.cs
index 537aca1a..ea9b75f4 100644
--- a/src/Yavsc.Abstract/IT/CiBuildSettings.cs
+++ b/src/Yavsc.Abstract/IT/CiBuildSettings.cs
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
-using Newtonsoft.Json;
+using System.Text.Json.Serialization;
namespace Yavsc.Abstract.IT {
@@ -10,7 +10,7 @@ public class CiBuildSettings
/// The global process environment variables
///
///
- [JsonProperty("env")]
+ [JsonPropertyName("env")]
public string[] Environment { get; set; }
///
@@ -18,7 +18,7 @@ public class CiBuildSettings
///
///
[Required]
- [JsonPropertyAttribute("build")]
+ [JsonPropertyName("build")]
public CommandPipe Build { get; set; }
///
@@ -27,7 +27,7 @@ public class CiBuildSettings
/// must end ok in order to launch the build.
///
///
- [JsonPropertyAttribute("prepare")]
+ [JsonPropertyName("prepare")]
public CommandPipe Prepare { get; set; }
///
@@ -37,14 +37,14 @@ public class CiBuildSettings
/// only fired on successful build.
///
///
- [JsonPropertyAttribute("post_build")]
+ [JsonPropertyName("post_build")]
public CommandPipe PostBuild { get; set; }
///
/// Additional emails, as dest of notifications
///
///
- [JsonPropertyAttribute("emails")]
+ [JsonPropertyName("emails")]
public string[] Emails { get; set; }
}
diff --git a/src/Yavsc.Abstract/IT/Command.cs b/src/Yavsc.Abstract/IT/Command.cs
index 6d299b05..2260fb97 100644
--- a/src/Yavsc.Abstract/IT/Command.cs
+++ b/src/Yavsc.Abstract/IT/Command.cs
@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
-using Newtonsoft.Json;
+using System.Text.Json.Serialization;
namespace Yavsc.Abstract.IT
{
@@ -13,17 +13,17 @@ namespace Yavsc.Abstract.IT
public class Command
{
[Required]
- [JsonPropertyAttribute("path")]
+ [JsonPropertyName("path")]
public string Path { get; set; }
- [JsonPropertyAttribute("args")]
+ [JsonPropertyName("args")]
public string[] Args { get; set; }
///
/// Specific variables for this process
///
///
- [JsonPropertyAttribute("env")]
+ [JsonPropertyName("env")]
public string[] Environment { get; set; }
public virtual Process Start(string workingDir=null, bool redirectInput=false, bool redirectOutput=false)
diff --git a/src/Yavsc.Abstract/IT/CommandPipe.cs b/src/Yavsc.Abstract/IT/CommandPipe.cs
index 0e2a5b14..f4aeac86 100644
--- a/src/Yavsc.Abstract/IT/CommandPipe.cs
+++ b/src/Yavsc.Abstract/IT/CommandPipe.cs
@@ -1,8 +1,6 @@
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+
using System.Diagnostics;
-using System.Threading.Tasks;
-using Newtonsoft.Json;
+using System.Text.Json.Serialization;
namespace Yavsc.Abstract.IT
{
@@ -10,11 +8,11 @@ namespace Yavsc.Abstract.IT
{
- [JsonPropertyAttribute("pipe")]
+ [JsonPropertyName("pipe")]
public Command[] Pipe { get; set; }
- [JsonPropertyAttribute("working_dir")]
+ [JsonPropertyName("working_dir")]
public string WorkingDir { get; set; }
public virtual int Run()
diff --git a/src/Yavsc.Abstract/IT/Fixing/Bug.cs b/src/Yavsc.Abstract/IT/Fixing/Bug.cs
index 2860783f..f0b403bb 100644
--- a/src/Yavsc.Abstract/IT/Fixing/Bug.cs
+++ b/src/Yavsc.Abstract/IT/Fixing/Bug.cs
@@ -20,7 +20,7 @@ namespace Yavsc.Models.IT.Fixing
ErrorMessageResourceName="TitleSizeError")]
public string Title { get; set; }
- [YaStringLength(10240,
+ [StringLength(10240,
ErrorMessageResourceType=typeof(Yavsc.Models.IT.Fixing.Bug),
ErrorMessageResourceName="DescSizeError")]
public string Description { get; set; }
diff --git a/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs b/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs
index f87d9ef4..f544f654 100644
--- a/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs
+++ b/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs
@@ -5,8 +5,8 @@ namespace Yavsc
public interface ITrackedEntity
{
DateTime DateCreated { get; set; }
- string? UserCreated { get; set; }
+ string UserCreated { get; set; }
DateTime DateModified { get; set; }
- string? UserModified { get; set; }
+ string UserModified { get; set; }
}
}
diff --git a/src/Yavsc.Abstract/Yavsc.Abstract.csproj b/src/Yavsc.Abstract/Yavsc.Abstract.csproj
index b2a9fa63..97b2bb26 100644
--- a/src/Yavsc.Abstract/Yavsc.Abstract.csproj
+++ b/src/Yavsc.Abstract/Yavsc.Abstract.csproj
@@ -1,6 +1,6 @@
- net9.0
+ net10.0
enable
A shared model for a little client/server app, dealing about establishing some contract, between some human client and provider.
@@ -8,8 +8,6 @@
https://github.com/pazof/yavsc
true
true
+ latest
-
-
-
diff --git a/src/cli/Commands/AuthCommander.cs b/src/cli/Commands/AuthCommander.cs
index f895b56f..45b060dc 100644
--- a/src/cli/Commands/AuthCommander.cs
+++ b/src/cli/Commands/AuthCommander.cs
@@ -40,7 +40,7 @@ namespace cli.Commands
});
loginCommand.OnExecute(async () =>
{
- string? authHostName = Program.AppConfiguration.GetRequiredSection("ConnectionSettings:ServerApi")["Authority"];
+ string authHostName = Program.AppConfiguration.GetRequiredSection("ConnectionSettings:ServerApi")["Authority"];
throw new NotImplementedException();
/*
diff --git a/src/cli/Program.cs b/src/cli/Program.cs
index 4be09d05..a94ef648 100644
--- a/src/cli/Program.cs
+++ b/src/cli/Program.cs
@@ -5,7 +5,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
internal class Program
{
- public static IHost? AppHost { get; private set; }
+ public static IHost AppHost { get; private set; }
public static IConfigurationRoot AppConfiguration { get; private set; }
public static IHostEnvironment AppEnvironment { get; private set; }
diff --git a/src/cli/cli.csproj b/src/cli/cli.csproj
index 1e6fff4f..becf7c67 100644
--- a/src/cli/cli.csproj
+++ b/src/cli/cli.csproj
@@ -13,10 +13,9 @@
-
-
\ No newline at end of file
+
diff --git a/test/yavscTests/NonRegression/PostItViewModelTests.cs b/test/yavscTests/NonRegression/PostItViewModelTests.cs
index cbc7fea0..f64ab00b 100644
--- a/test/yavscTests/NonRegression/PostItViewModelTests.cs
+++ b/test/yavscTests/NonRegression/PostItViewModelTests.cs
@@ -18,7 +18,7 @@ public class PostItViewModelTests
[Fact]
public void SearchCommand_filters_posts_by_title_article_or_author()
{
- var viewModel = new MainViewModel();
+ var viewModel = new MainPageViewModel();
viewModel.Posts.Add(new BlogPost { Id = 1, Title = "First post", Article = "Hello world", AuthorId = "alice" });
viewModel.Posts.Add(new BlogPost { Id = 2, Title = "Second post", Article = "Nothing here", AuthorId = "bob" });
diff --git a/test/yavscTests/yavscTests.csproj b/test/yavscTests/yavscTests.csproj
index fcc349d9..de7ce4f9 100644
--- a/test/yavscTests/yavscTests.csproj
+++ b/test/yavscTests/yavscTests.csproj
@@ -21,7 +21,6 @@
-