diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 09d9757a..3d4fc0ac 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -194,7 +194,7 @@ jobs: # la racine du checkout pour que l'étape d'upload le trouve. run: | cd /src/_src - APK=src/PostIt/PostIt.Android/bin/Release/net10.0-android/android-arm64/fr.pschneider.PostIt-Signed.apk + APK=src/PostIt/PostIt.Android/bin/Release/net10.0-android/android-arm64/com.CompanyName.PostIt-Signed.apk if [[ ! -f "$APK" ]]; then echo "::error::APK not found at $APK" ls -la src/PostIt/PostIt.Android/bin/Release/net10.0-android/ 2>/dev/null || true diff --git a/.github/workflows/docker-publish-android.yml b/.github/workflows/docker-publish-android.yml index d560b216..b9ee364c 100644 --- a/.github/workflows/docker-publish-android.yml +++ b/.github/workflows/docker-publish-android.yml @@ -40,7 +40,7 @@ jobs: - name: Extraire l'APK du conteneur Docker run: | docker create --name extractor postit-android - docker cp extractor:/src/src/PostIt/PostIt.Android/bin/Release/net10.0-android/android-arm64/fr.pschneider.PostIt-Signed.apk ./PostIt.Android.apk + docker cp extractor:/src/src/PostIt/PostIt.Android/bin/Release/net10.0-android/android-arm64/com.CompanyName.PostIt-Signed.apk ./PostIt.Android.apk docker rm extractor - name: Téléverser l'APK en tant qu'Artéfact GitHub diff --git a/.gitignore b/.gitignore index b7813f60..a94475e3 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,3 @@ DataDir/ *.tests.trx *.tests.html - -*.log - diff --git a/.vscode/launch.json b/.vscode/launch.json index 42be176a..76dc08d5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,21 +4,6 @@ // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "name": "Debug - Android", - "type": "mono", - "preLaunchTask": "run-debug-android", - "request": "attach", - "address": "localhost", - "port": 10000 - }, - { - "name": "Attach - Android", - "type": "mono", - "request": "attach", - "address": "localhost", - "port": 10000 - }, { "name": "API", "type": "dotnet", @@ -43,17 +28,6 @@ "request": "launch", "projectPath": "${workspaceFolder}/src/PostIt/PostIt.Desktop/PostIt.Desktop.csproj", - }, - { - "name": "Test PostIt.Android launch (Xamarin.UITest)", - "type": "coreclr", - "request": "launch", - "program": "${workspaceFolder}/src/PostIt/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests.dll", - "args": [ - ], - "cwd": "${workspaceFolder}/src/PostIt/PostIt.Tests", - "console": "integratedTerminal", - "stopAtEntry": false } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c900fa6a..e45a9921 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,29 +1,6 @@ { "version": "2.0.0", "tasks": [ - { - "label": "run-debug-android", - "command": "dotnet", - "type": "shell", - "options": { - "cwd": "${workspaceFolder}/src/PostIt/PostIt.Android", - "env": { - "DOTNET_HOST_PATH": "/usr/share/dotnet", - "ANDROID_HOME": "/opt/android-sdk", - "JAVA_HOME": "/usr/lib/jvm/java-1.21.0-openjdk-amd64" - } - }, - "args": [ - "build" - "-t:run", - "-p:TargetFramework=net10.0-android", - "-p:Configuration=Debug", - "-p:AndroidAttachDebugger=true", - "-p:AndroidSdbHostPort=10000", - "-p:AndroidSdbTargetPort=10000" - ], - "problemMatcher": "$msCompile" - }, { "label": "build", "command": "dotnet", diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a4a88f..e2a446a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,22 +16,6 @@ Cette convention est partagée avec le dépôt [`postit-debian`](https://forgejo.pschneider.fr/notazof/postit-debian) pour la production des paquets `.deb`. -## [1.0.8-rc3] - unstable - -### Added - -* a code cleanup -* a failling a disabled test ala Xamarin.UITest : the Android app stil doesn't starts -- Android app does not crash any more, but still no home page, only the splash screnn - -### Changed - -mostly nothing - -### Fixed - -mostly nothing - ## [1.0.8-rc1] - unstable ### Added diff --git a/Makefile b/Makefile index 05aa5df2..fa9d4ecf 100644 --- a/Makefile +++ b/Makefile @@ -121,169 +121,4 @@ release: git push -u origin "$$BRANCH"; \ echo "==> Terminé. Branche $$BRANCH live sur origin." -# Cibles pour installer PostIt.Android en Debug sur l'AVD qemu. -# -# Usage typique : -# make qemu # lance l'AVD, attend le boot, build l'APK, l'installe -# make qemu-install # (re)build l'APK et l'installe (AVD doit tourner) -# make qemu-build # build l'APK seul (sans install) -# make qemu-run # démarre l'AVD en background -# make qemu-stop # arrête l'émulateur -# make qemu-wait-boot # attend que l'AVD ait fini de booter -# -# Variables surchargeables (make VAR=valeur) : -# AVD_NAME default: postit_test_avd -# (l'AVD doit être listé par `avdmanager list avd`) -# ADB_SERIAL default: emulator-5554 -# (port standard du premier émulateur lancé) -# ANDROID_HOME default: /opt/android-sdk -# (le SDK Android local; doit contenir -# emulator/emulator et platform-tools/adb) -# POSTIT_RID default: android-x64 -# (doit matcher l'ABI de l'AVD; `avdmanager list avd` -# affiche la ligne Tag/ABI) -# EMU_HEADLESS default: 0 -# (1 = lancer l'émulateur sans fenêtre, pour scripter) -# CONFIG surcharge la variable CONFIG globale (Debug par -# défaut dans ce Makefile). Passer à Release pour -# un APK optimisé et signé release. -# LOGCAT_LINES default: 200 -# (nombre de lignes dumpées par `make qemu-logcat`) -# LOGCAT_FOLLOW default: 0 -# (1 = stream live via `make qemu-logcat`, -# sinon dump one-shot des N dernières lignes) -# LOGCAT_BOOT_WAIT default: 30 -# (secondes d'attente entre le clear du buffer, -# le `am start`, et le dump final dans -# `make qemu-logcat-boot`) -AVD_NAME ?= postit_test_avd -ADB_SERIAL ?= emulator-5554 -ANDROID_HOME ?= /opt/android-sdk -POSTIT_RID ?= android-x64 -EMU_HEADLESS ?= 0 -LOGCAT_LINES ?= 600 -LOGCAT_FOLLOW ?= 0 -LOGCAT_BOOT_WAIT ?= 30 - -ANDROID_PACKAGE_NAME = fr.pschneider.PostIt -POSTIT_ANDROID_CSPROJ := src/PostIt/PostIt.Android/PostIt.Android.csproj -POSTIT_APK_DIR := src/PostIt/PostIt.Android/bin/$(CONFIG)/net10.0-android/$(POSTIT_RID) -POSTIT_APK := $(POSTIT_APK_DIR)/$(ANDROID_PACKAGE_NAME)-Signed.apk - -qemu-run: - @echo " Starting AVD $(AVD_NAME) on $(ADB_SERIAL)..." - @mkdir -p /tmp/yavsc-emu - @EMU_ARGS=""; \ - if [ "$(EMU_HEADLESS)" = "1" ]; then EMU_ARGS="-no-window -no-audio"; fi; \ - $(ANDROID_HOME)/emulator/emulator -avd $(AVD_NAME) $$EMU_ARGS \ - >/tmp/yavsc-emu/$(AVD_NAME).log 2>&1 & \ - echo " emulator PID: $$!" - -qemu-stop: - adb -s $(ADB_SERIAL) emu kill - -qemu-wait-boot: - @echo " Waiting for $(ADB_SERIAL) to finish booting..." - adb -s $(ADB_SERIAL) wait-for-device - @for i in $$(seq 1 180); do \ - BOOTED=$$(adb -s $(ADB_SERIAL) shell getprop sys.boot_completed 2>/dev/null | tr -d '\r\n'); \ - if [ "$$BOOTED" = "1" ]; then \ - echo " ✓ booted in $${i}s"; \ - exit 0; \ - fi; \ - sleep 1; \ - done; \ - echo " ERROR: device did not boot within 180s." >&2; \ - echo " Logs: /tmp/yavsc-emu/$(AVD_NAME).log" >&2; \ - exit 1 - -qemu-build: - # EmbedAssembliesIntoApk=true: without this, the Debug APK ships - # without the managed assemblies in it (they are pushed at runtime - # via `adb push`, "Fast Deployment"). On the qemu emulator, the - # runtime cannot find them in `files/.__override__//` and - # aborts at startup with "No assemblies found in '.__override__'" - # (monodroid-glue.cc:757, SIGABRT). Forcing this property on - # packages the .dlls into the APK as `assemblies//` so the - # runtime reads them directly. - # - # The Xamarin.Android SDK property is `EmbedAssembliesIntoApk`, - # not `AndroidEnableFastDeployment` (which exists in older - # templates but is a no-op in the .NET 10 SDK). - dotnet build $(POSTIT_ANDROID_CSPROJ) \ - -c $(CONFIG) \ - -p:RuntimeIdentifier=$(POSTIT_RID) \ - -p:EmbedAssembliesIntoApk=true \ - --nologo - @if [ ! -f "$(POSTIT_APK)" ]; then \ - echo " APK not found at $(POSTIT_APK)." >&2; \ - echo " Files in $(POSTIT_APK_DIR):" >&2; \ - ls -la "$(POSTIT_APK_DIR)" 2>/dev/null || echo " (directory does not exist)" >&2; \ - exit 1; \ - fi - - -qemu-install: qemu-build - @echo " Installing $(POSTIT_APK) on $(ADB_SERIAL)..." - adb -s $(ADB_SERIAL) install -r "$(POSTIT_APK)" -r - -qemu-uninstall: - adb -s $(ADB_SERIAL) uninstall $(ANDROID_PACKAGE_NAME) - -# Dump recent logcat output for the running PostIt.Android process. -# By default, prints the last $(LOGCAT_LINES) lines (one-shot, with -# `-d`). Set LOGCAT_FOLLOW=1 to follow the stream live instead. -# Filtering is by PID (pidof $(ANDROID_PACKAGE_NAME)), not by tag, -# because Mono/Xamarin can emit logs under several tags -# (mono, PostIt.Android, Avalonia.Android) and tag-based filtering -# would miss the ones not matching. PID-based filtering is exact. -# If the app is not running, pidof returns empty and logcat exits -# silently with no output; that is the expected behaviour for -# "no logs yet". -qemu-logcat: - @PID=$$(adb -s $(ADB_SERIAL) shell pidof $(ANDROID_PACKAGE_NAME) 2>/dev/null | tr -d '\r\n'); \ - if [ -z "$$PID" ]; then \ - echo " $(ANDROID_PACKAGE_NAME) is not running on $(ADB_SERIAL)."; \ - echo " Start the app first (am start -n $(ANDROID_PACKAGE_NAME)/PostIt.Android.PostItMainActivity)"; \ - exit 1; \ - fi; \ - echo " Following PID $$PID (LOGCAT_FOLLOW=$(LOGCAT_FOLLOW), LOGCAT_LINES=$(LOGCAT_LINES))"; \ - if [ "$(LOGCAT_FOLLOW)" = "1" ]; then \ - adb -s $(ADB_SERIAL) logcat -v time --pid=$$PID $(ANDROID_PACKAGE_NAME); \ - else \ - adb -s $(ADB_SERIAL) logcat -d -v time -t $(LOGCAT_LINES) --pid=$$PID $(ANDROID_PACKAGE_NAME); \ - fi - -# Clear logcat, launch PostIt.Android, then dump everything that was -# emitted during the startup window. Targets the "démarrage KO" case -# where the process starts but Avalonia never renders a frame — the -# logcat trace from process start to first frame is what diagnoses it. -# -# Override LOGCAT_BOOT_WAIT to extend the post-launch wait -# (default 15s; raise to 30+ if the device is slow to boot Avalonia). -LOGCAT_BOOT_WAIT ?= 15 -qemu-logcat-boot: - @echo " Clearing logcat buffer..." - adb -s $(ADB_SERIAL) logcat -c - @echo " Launching $(ANDROID_PACKAGE_NAME)..." - adb -s $(ADB_SERIAL) shell am start \ - -n $(ANDROID_PACKAGE_NAME)/PostIt.Android.PostItMainActivity - @echo " Waiting $(LOGCAT_BOOT_WAIT)s for the app to start rendering..." - @sleep $(LOGCAT_BOOT_WAIT) - - @echo " Dumping logcat (PostIt PID + system buffer):" - @PID=$$(adb -s $(ADB_SERIAL) shell pidof $(ANDROID_PACKAGE_NAME) 2>/dev/null | tr -d '\r\n'); \ - if [ -n "$$PID" ]; then \ - echo " ✅ (PID $$PID at dump time)"; \ - sleep 10; \ - adb -s $(ADB_SERIAL) logcat -d -v time -t $(LOGCAT_LINES) --pid=$$PID; \ - else \ - echo " 👿 (PostIt process not running at dump time — dumping last $(LOGCAT_LINES) lines unfiltered)"; \ - adb -s $(ADB_SERIAL) logcat -d -v time -t $(LOGCAT_LINES); \ - exit 1; \ - fi - -qemu: qemu-run qemu-wait-boot qemu-install - @echo " ✓ PostIt.Android installed on $(ADB_SERIAL)" - -.PHONY: test release qemu qemu-run qemu-stop qemu-wait-boot qemu-build qemu-install qemu-logcat qemu-logcat-boot +.PHONY: test release diff --git a/external/dotnet-android-build-image b/external/dotnet-android-build-image new file mode 160000 index 00000000..0695a6c1 --- /dev/null +++ b/external/dotnet-android-build-image @@ -0,0 +1 @@ +Subproject commit 0695a6c1fea6508f1a88f7ad0ad9cb93733aa52d diff --git a/src/PostIt/PostIt.Tests/AddCircleMemberDialogTests.cs b/src/PostIt.Tests/AddCircleMemberDialogTests.cs similarity index 97% rename from src/PostIt/PostIt.Tests/AddCircleMemberDialogTests.cs rename to src/PostIt.Tests/AddCircleMemberDialogTests.cs index 91413ca0..289ff727 100644 --- a/src/PostIt/PostIt.Tests/AddCircleMemberDialogTests.cs +++ b/src/PostIt.Tests/AddCircleMemberDialogTests.cs @@ -1,8 +1,8 @@ using Avalonia; +using Avalonia.Controls; using Avalonia.Headless.XUnit; using Microsoft.Extensions.DependencyInjection; -using PostIt.Helpers; using PostIt.Services; using PostIt.ViewModels; using PostIt.Views; @@ -100,6 +100,8 @@ public class AddCircleMemberDialogTests context.Window = new MainWindow(); context.App = (PostIt.App)Application.Current!; + context.App.DataTemplates.Clear(); + context.App.DataTemplates.Add(new ViewLocator(sp)); context.App.AttachMainWindow(context.Window); context.Window.Show(); diff --git a/src/PostIt/PostIt.Tests/BearerScopeTests.cs b/src/PostIt.Tests/BearerScopeTests.cs similarity index 98% rename from src/PostIt/PostIt.Tests/BearerScopeTests.cs rename to src/PostIt.Tests/BearerScopeTests.cs index c6bf7d56..fbccb606 100644 --- a/src/PostIt/PostIt.Tests/BearerScopeTests.cs +++ b/src/PostIt.Tests/BearerScopeTests.cs @@ -1,8 +1,18 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Net; +using System.Net.Http; using System.Text; using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Yavsc.Blogspot; using Yavsc.Api.Client; using PostIt.Services; +using PostIt.Services; +using Xunit; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/BlogApiTestFakes.cs b/src/PostIt.Tests/BlogApiTestFakes.cs similarity index 99% rename from src/PostIt/PostIt.Tests/BlogApiTestFakes.cs rename to src/PostIt.Tests/BlogApiTestFakes.cs index 4f102be2..4b541e42 100644 --- a/src/PostIt/PostIt.Tests/BlogApiTestFakes.cs +++ b/src/PostIt.Tests/BlogApiTestFakes.cs @@ -1,6 +1,7 @@ using Yavsc.Blogspot; using PostIt.Services; using PostIt.ViewModels; +using Yavsc.Models; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/BlogPostAuthorDtoTests.cs b/src/PostIt.Tests/BlogPostAuthorDtoTests.cs similarity index 100% rename from src/PostIt/PostIt.Tests/BlogPostAuthorDtoTests.cs rename to src/PostIt.Tests/BlogPostAuthorDtoTests.cs diff --git a/src/PostIt.Tests/Directory.Packages.props b/src/PostIt.Tests/Directory.Packages.props new file mode 100644 index 00000000..15c4e24b --- /dev/null +++ b/src/PostIt.Tests/Directory.Packages.props @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/PostIt/PostIt.Tests/FakeAuthorizingBrowser.cs b/src/PostIt.Tests/FakeAuthorizingBrowser.cs similarity index 98% rename from src/PostIt/PostIt.Tests/FakeAuthorizingBrowser.cs rename to src/PostIt.Tests/FakeAuthorizingBrowser.cs index 88dd5856..4748425a 100644 --- a/src/PostIt/PostIt.Tests/FakeAuthorizingBrowser.cs +++ b/src/PostIt.Tests/FakeAuthorizingBrowser.cs @@ -1,3 +1,6 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; using IdentityModel.OidcClient.Browser; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/MainPageButtonsTests.cs b/src/PostIt.Tests/MainPageButtonsTests.cs similarity index 95% rename from src/PostIt/PostIt.Tests/MainPageButtonsTests.cs rename to src/PostIt.Tests/MainPageButtonsTests.cs index cd3684ef..767f9c2e 100644 --- a/src/PostIt/PostIt.Tests/MainPageButtonsTests.cs +++ b/src/PostIt.Tests/MainPageButtonsTests.cs @@ -1,6 +1,9 @@ using Avalonia; using Avalonia.Controls; +using Avalonia.Headless; using Avalonia.Headless.XUnit; +using Avalonia.Input; +using Avalonia.Interactivity; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; using Yavsc.Api.Client; @@ -72,7 +75,7 @@ public class MainPageButtonsTests { } } - private static MainViewModel MakeViewModel(BlogPostDto? selectedPost = null) + private static MainPageViewModel MakeViewModel(BlogPostDto? selectedPost = null) { var api = new ThrowingApi(); var blog = new BlogApiClient(api, "http://localhost/"); @@ -93,7 +96,7 @@ public class MainPageButtonsTests services.AddTransient(); services.AddTransient(); services.AddTransient(); - var vm = new MainViewModel(blog, services: services.BuildServiceProvider()); + var vm = new MainPageViewModel(blog, services: services.BuildServiceProvider()); if (selectedPost is not null) vm.SelectedPost = selectedPost; return vm; } @@ -109,11 +112,16 @@ public class MainPageButtonsTests /// realised and KeyPressQwerty has a real /// to dispatch against. /// - private static (MainWindow window, MainPage page) MountMainPage(MainViewModel vm) + private static (MainWindow window, MainPage page) MountMainPage(MainPageViewModel vm) { var window = new MainWindow(); var page = new MainPage { DataContext = vm }; var app = (PostIt.App)Application.Current!; + if (vm.Services is not null) + { + app.DataTemplates.Clear(); + app.DataTemplates.Add(new ViewLocator(vm.Services)); + } app.AttachMainWindow(window); window.Show(); window.NavRoot.PushAsync(page).GetAwaiter().GetResult(); diff --git a/src/PostIt/PostIt.Tests/MainPageSaveTests.cs b/src/PostIt.Tests/MainPageSaveTests.cs similarity index 97% rename from src/PostIt/PostIt.Tests/MainPageSaveTests.cs rename to src/PostIt.Tests/MainPageSaveTests.cs index 5baae658..b6bf963a 100644 --- a/src/PostIt/PostIt.Tests/MainPageSaveTests.cs +++ b/src/PostIt.Tests/MainPageSaveTests.cs @@ -1,8 +1,10 @@ +using Avalonia; using Avalonia.Controls; using Avalonia.Headless.XUnit; using Avalonia.VisualTree; using Yavsc.Blogspot; using Yavsc.Api.Client; +using PostIt.Services; using PostIt.ViewModels; using PostIt.Views; namespace PostIt.Tests; @@ -40,7 +42,7 @@ public class MainPageSaveTests var recorder = new CallRecorder(); var api = new RecordingYavscApiClient(recorder); var blog = new BlogApiClient(api, "http://localhost/"); - var viewModel = new MainViewModel(blog); + var viewModel = new MainPageViewModel(blog); var page = new MainPage { DataContext = viewModel }; // MainPage is a ContentPage (a Page, not a Control), so it diff --git a/src/PostIt/PostIt.Tests/OidcStubAuthority.cs b/src/PostIt.Tests/OidcStubAuthority.cs similarity index 98% rename from src/PostIt/PostIt.Tests/OidcStubAuthority.cs rename to src/PostIt.Tests/OidcStubAuthority.cs index 4bb25097..3c6552fb 100644 --- a/src/PostIt/PostIt.Tests/OidcStubAuthority.cs +++ b/src/PostIt.Tests/OidcStubAuthority.cs @@ -1,8 +1,13 @@ +using System; +using System.Collections.Generic; +using System.IO; using System.Net; using System.Net.Sockets; using System.Security.Cryptography; using System.Text; using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/PostAclDialogTests.cs b/src/PostIt.Tests/PostAclDialogTests.cs similarity index 96% rename from src/PostIt/PostIt.Tests/PostAclDialogTests.cs rename to src/PostIt.Tests/PostAclDialogTests.cs index d13468f0..95576778 100644 --- a/src/PostIt/PostIt.Tests/PostAclDialogTests.cs +++ b/src/PostIt.Tests/PostAclDialogTests.cs @@ -1,14 +1,21 @@ +using System; +using System.Collections.Generic; using System.Net; +using System.Net.Http; using System.Text; using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; using Avalonia; +using Avalonia.Controls; using Avalonia.Headless.XUnit; using Microsoft.Extensions.DependencyInjection; -using PostIt.Helpers; using PostIt.Services; using PostIt.ViewModels; using PostIt.Views; +using Yavsc.Abstract.Identity.Security; using Yavsc.Api.Client; +using Yavsc.Api.Client.Dtos; using Yavsc.Blogspot; namespace PostIt.Tests; @@ -140,6 +147,8 @@ public class PostAclDialogTests var window = new MainWindow(); var app = (App)Application.Current!; + app.DataTemplates.Clear(); + app.DataTemplates.Add(new ViewLocator(sp)); app.AttachMainWindow(window); window.Show(); diff --git a/src/PostIt/PostIt.Tests/PostIt.Tests.csproj b/src/PostIt.Tests/PostIt.Tests.csproj similarity index 77% rename from src/PostIt/PostIt.Tests/PostIt.Tests.csproj rename to src/PostIt.Tests/PostIt.Tests.csproj index 663bdd12..b12c536e 100644 --- a/src/PostIt/PostIt.Tests/PostIt.Tests.csproj +++ b/src/PostIt.Tests/PostIt.Tests.csproj @@ -8,26 +8,24 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 - - - - + + - + \ No newline at end of file diff --git a/src/PostIt/PostIt.Tests/PostItViewModelTests.cs b/src/PostIt.Tests/PostItViewModelTests.cs similarity index 96% rename from src/PostIt/PostIt.Tests/PostItViewModelTests.cs rename to src/PostIt.Tests/PostItViewModelTests.cs index d2c5d78e..2dee4604 100644 --- a/src/PostIt/PostIt.Tests/PostItViewModelTests.cs +++ b/src/PostIt.Tests/PostItViewModelTests.cs @@ -16,7 +16,7 @@ public class PostItViewModelTests // throws on any call (we never call the API in this test). var fakeApi = new ThrowingYavscApiClient(); var blog = new BlogApiClient(fakeApi, "http://localhost/"); - var viewModel = new MainViewModel(blog); + var viewModel = new MainPageViewModel(blog); viewModel.Posts.Add(new BlogPostDto { Id = 1, Title = "First post", Article = "Hello world", AuthorId = "alice" }); viewModel.Posts.Add(new BlogPostDto { Id = 2, Title = "Second post", Article = "Nothing here", AuthorId = "bob" }); @@ -49,7 +49,7 @@ public class PostItViewModelTests var api = new StubYavscApiClient(expected); var blog = new BlogApiClient(api, "http://localhost/"); - var posts = await blog.GetPostsAsync(ct: TestContext.Current.CancellationToken); + var posts = await blog.GetPostsAsync(); Assert.Equal(2, posts.Count); Assert.Equal("Hello", posts[0].Title); diff --git a/src/PostIt/PostIt.Tests/SchemeUrlDetectorTests.cs b/src/PostIt.Tests/SchemeUrlDetectorTests.cs similarity index 99% rename from src/PostIt/PostIt.Tests/SchemeUrlDetectorTests.cs rename to src/PostIt.Tests/SchemeUrlDetectorTests.cs index 78b67463..f5983cb3 100644 --- a/src/PostIt/PostIt.Tests/SchemeUrlDetectorTests.cs +++ b/src/PostIt.Tests/SchemeUrlDetectorTests.cs @@ -1,4 +1,5 @@ using PostIt.Services; +using Xunit; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs b/src/PostIt.Tests/SessionStatusBannerTests.cs similarity index 99% rename from src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs rename to src/PostIt.Tests/SessionStatusBannerTests.cs index e1a5dd19..d35529db 100644 --- a/src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs +++ b/src/PostIt.Tests/SessionStatusBannerTests.cs @@ -1,5 +1,7 @@ +using Avalonia; using Avalonia.Controls; using Avalonia.Headless.XUnit; +using Avalonia.Media; using Avalonia.Styling; using Avalonia.VisualTree; using PostIt.ViewModels; diff --git a/src/PostIt/PostIt.Tests/SettingsLoadTests.cs b/src/PostIt.Tests/SettingsLoadTests.cs similarity index 96% rename from src/PostIt/PostIt.Tests/SettingsLoadTests.cs rename to src/PostIt.Tests/SettingsLoadTests.cs index dc58e9fc..a9dd01d4 100644 --- a/src/PostIt/PostIt.Tests/SettingsLoadTests.cs +++ b/src/PostIt.Tests/SettingsLoadTests.cs @@ -1,3 +1,9 @@ +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + namespace PostIt.Tests; public class SettingsLoadTests @@ -103,7 +109,7 @@ public class SettingsLoadTests { failures.Add(ex); } - }, TestContext.Current.CancellationToken); + }); } await Task.WhenAll(tasks); @@ -123,7 +129,7 @@ public class SettingsLoadTests /// and checking that Loaded flips exactly once (no torn reads). /// [Fact] - public async Task Load_is_idempotent_under_concurrent_calls() + public void Load_is_idempotent_under_concurrent_calls() { var settings = new PostIt.ViewModels.Settings { @@ -143,9 +149,9 @@ public class SettingsLoadTests { barrier.SignalAndWait(); settings.Load(); - }, TestContext.Current.CancellationToken); + }); } - await Task.WhenAll(tasks); + Task.WaitAll(tasks); Assert.True(settings.Loaded); } diff --git a/src/PostIt/PostIt.Tests/SignaturePadControlTests.cs b/src/PostIt.Tests/SignaturePadControlTests.cs similarity index 99% rename from src/PostIt/PostIt.Tests/SignaturePadControlTests.cs rename to src/PostIt.Tests/SignaturePadControlTests.cs index c03e6850..691ae547 100644 --- a/src/PostIt/PostIt.Tests/SignaturePadControlTests.cs +++ b/src/PostIt.Tests/SignaturePadControlTests.cs @@ -1,5 +1,8 @@ +using System; +using System.Linq; using PostIt.Controls; using PostIt.Models; +using Xunit; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/SignaturePageViewModelTests.cs b/src/PostIt.Tests/SignaturePageViewModelTests.cs similarity index 98% rename from src/PostIt/PostIt.Tests/SignaturePageViewModelTests.cs rename to src/PostIt.Tests/SignaturePageViewModelTests.cs index 494df9ab..37f17a58 100644 --- a/src/PostIt/PostIt.Tests/SignaturePageViewModelTests.cs +++ b/src/PostIt.Tests/SignaturePageViewModelTests.cs @@ -1,6 +1,10 @@ +using System; +using System.IO; using System.Text.Json; +using System.Threading.Tasks; using PostIt.Controls; using PostIt.ViewModels; +using Xunit; namespace PostIt.Tests; diff --git a/src/PostIt/PostIt.Tests/TestApp.cs b/src/PostIt.Tests/TestApp.cs similarity index 100% rename from src/PostIt/PostIt.Tests/TestApp.cs rename to src/PostIt.Tests/TestApp.cs diff --git a/src/PostIt/PostIt.Tests/TestAppContext.cs b/src/PostIt.Tests/TestAppContext.cs similarity index 100% rename from src/PostIt/PostIt.Tests/TestAppContext.cs rename to src/PostIt.Tests/TestAppContext.cs diff --git a/src/PostIt/PostIt.Tests/UnitTest1.cs b/src/PostIt.Tests/UnitTest1.cs similarity index 91% rename from src/PostIt/PostIt.Tests/UnitTest1.cs rename to src/PostIt.Tests/UnitTest1.cs index aa053281..96990865 100644 --- a/src/PostIt/PostIt.Tests/UnitTest1.cs +++ b/src/PostIt.Tests/UnitTest1.cs @@ -1,4 +1,5 @@ using Avalonia.Headless.XUnit; +using Avalonia.Controls; using PostIt.Views; namespace PostIt.Tests; @@ -12,4 +13,4 @@ public class MainPageTests window.Show(); Assert.NotNull(window); } -} +} \ No newline at end of file diff --git a/src/PostIt/PostIt.Tests/YavscApiClientTests.cs b/src/PostIt.Tests/YavscApiClientTests.cs similarity index 98% rename from src/PostIt/PostIt.Tests/YavscApiClientTests.cs rename to src/PostIt.Tests/YavscApiClientTests.cs index 21c0dd00..e54bc541 100644 --- a/src/PostIt/PostIt.Tests/YavscApiClientTests.cs +++ b/src/PostIt.Tests/YavscApiClientTests.cs @@ -1,10 +1,22 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Net; +using System.Net.Http; using System.Net.Sockets; using System.Text; using System.Text.Json; +using System.Threading; +using Yavsc.Blogspot; +using Yavsc.Api.Client; using PostIt.Services; +using System.Threading.Tasks; +using IdentityModel.OidcClient; using IdentityModel.OidcClient.Browser; +using PostIt.Services; using PostIt.ViewModels; +using Xunit; namespace PostIt.Tests; diff --git a/src/PostIt.Tests/pslist b/src/PostIt.Tests/pslist new file mode 100644 index 00000000..0f1d73da --- /dev/null +++ b/src/PostIt.Tests/pslist @@ -0,0 +1,94 @@ +UID PID PPID C STIME TTY TIME CMD +paul 1155 1 0 13:18 ? 00:00:00 /usr/lib/systemd/systemd --user +paul 1168 1155 0 13:18 ? 00:00:00 (sd-pam) +paul 1361 1155 0 13:18 ? 00:00:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only +paul 1364 1155 1 13:18 ? 00:01:19 /home/paul/.nvm/versions/node/v22.23.0/bin/node /home/paul/.nvm/versions/node/v22.23.0/lib/node_modules/openclaw/dist/index.js gateway --port 18789 +paul 1367 1155 0 13:18 ? 00:00:00 /usr/bin/pipewire +paul 1372 1155 0 13:18 ? 00:00:00 /usr/bin/pipewire -c filter-chain.conf +paul 1373 1155 0 13:18 ? 00:00:00 /usr/bin/wireplumber +paul 1374 1155 0 13:18 ? 00:00:00 /usr/bin/pipewire-pulse +paul 1444 1155 0 13:18 ? 00:00:00 /usr/bin/mpris-proxy +paul 2593 1155 0 13:19 ? 00:00:00 /usr/bin/gnome-keyring-daemon --foreground --components=pkcs11,secrets --control-directory=/run/user/1000/keyring +paul 2608 2487 0 13:19 tty2 00:00:00 /usr/libexec/gdm-x-session --run-script /usr/bin/gnome-session +paul 2617 2608 1 13:19 tty2 00:01:12 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -novtswitch -verbose 3 +paul 2647 2608 0 13:19 tty2 00:00:00 /usr/libexec/gnome-session-binary +paul 2785 1155 0 13:19 ? 00:00:00 /usr/libexec/at-spi-bus-launcher +paul 2792 2785 0 13:19 ? 00:00:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 11 --address=unix:path=/run/user/1000/at-spi/bus_1 +paul 2802 1155 0 13:19 ? 00:00:00 /usr/libexec/gcr-ssh-agent --base-dir /run/user/1000/gcr +paul 2803 1155 0 13:19 ? 00:00:00 /usr/libexec/gnome-session-ctl --monitor +paul 2804 1155 0 13:19 ? 00:00:00 /usr/bin/ssh-agent -D +paul 2814 1155 0 13:19 ? 00:00:00 /usr/libexec/gvfsd +paul 2828 1155 0 13:19 ? 00:00:00 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f +paul 2838 1155 0 13:19 ? 00:00:00 /usr/libexec/gnome-session-binary --systemd-service --session=gnome +paul 2874 1155 3 13:19 ? 00:02:13 /usr/bin/gnome-shell +paul 2896 2874 0 13:19 ? 00:00:01 /usr/libexec/mutter-x11-frames +paul 2902 1155 0 13:19 ? 00:00:00 /usr/libexec/at-spi2-registryd --use-gnome-session +paul 2918 1155 0 13:19 ? 00:00:00 /usr/libexec/xdg-desktop-portal +paul 2933 1155 0 13:19 ? 00:00:00 /usr/libexec/xdg-permission-store +paul 2938 1155 0 13:19 ? 00:00:00 /usr/libexec/xdg-document-portal +paul 2971 1155 0 13:19 ? 00:00:00 /usr/libexec/gnome-shell-calendar-server +paul 2976 1155 0 13:19 ? 00:00:00 /usr/libexec/dconf-service +paul 2992 1155 0 13:19 ? 00:00:00 /usr/libexec/evolution-source-registry +paul 2994 1155 0 13:19 ? 00:00:00 /usr/bin/gjs -m /usr/share/gnome-shell/org.gnome.Shell.Notifications +paul 3012 1155 0 13:19 ? 00:00:12 /usr/bin/ibus-daemon --panel disable --xim +paul 3013 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-a11y-settings +paul 3014 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-color +paul 3015 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-datetime +paul 3016 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-housekeeping +paul 3018 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-keyboard +paul 3024 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-media-keys +paul 3025 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-power +paul 3027 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-print-notifications +paul 3029 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-rfkill +paul 3030 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-screensaver-proxy +paul 3035 2838 0 13:19 ? 00:00:05 /usr/bin/gnome-software --gapplication-service +paul 3037 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-sharing +paul 3042 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-smartcard +paul 3048 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-sound +paul 3054 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-usb-protection +paul 3057 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-wacom +paul 3058 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-xsettings +paul 3059 2838 0 13:19 ? 00:00:00 /usr/libexec/evolution-data-server/evolution-alarm-notify +paul 3064 2838 0 13:19 ? 00:00:00 /usr/bin/kalendarac +paul 3070 2838 0 13:19 ? 00:00:00 /usr/libexec/gsd-disk-utility-notify +paul 3088 2838 0 13:19 ? 00:00:00 /usr/bin/kdeconnectd +paul 3168 1155 0 13:19 ? 00:00:00 /usr/bin/gjs -m /usr/share/gnome-shell/org.gnome.ScreenSaver +paul 3172 1155 0 13:19 ? 00:00:00 /usr/libexec/gsd-printer +paul 3207 3012 0 13:19 ? 00:00:00 /usr/libexec/ibus-memconf +paul 3208 3012 0 13:19 ? 00:00:06 /usr/libexec/ibus-extension-gtk3 +paul 3214 1155 0 13:19 ? 00:00:00 /usr/libexec/ibus-x11 --kill-daemon +paul 3216 1155 0 13:19 ? 00:00:00 /usr/libexec/ibus-portal +paul 3218 1155 0 13:19 ? 00:00:00 /usr/libexec/localsearch-3 +paul 3219 1155 0 13:19 ? 00:00:00 /usr/libexec/xdg-desktop-portal-gnome +paul 3241 1155 0 13:19 ? 00:00:00 /usr/libexec/gvfs-udisks2-volume-monitor +paul 3251 1155 0 13:19 ? 00:00:00 /usr/libexec/gvfs-mtp-volume-monitor +paul 3259 1155 0 13:19 ? 00:00:00 /usr/libexec/gvfs-gphoto2-volume-monitor +paul 3265 1155 0 13:20 ? 00:00:00 /usr/libexec/gvfs-goa-volume-monitor +paul 3271 1155 0 13:20 ? 00:00:00 /usr/libexec/goa-daemon +paul 3280 1155 0 13:20 ? 00:00:00 /usr/libexec/goa-identity-service +paul 3287 1155 0 13:20 ? 00:00:00 /usr/libexec/gvfs-afc-volume-monitor +paul 3303 3012 0 13:20 ? 00:00:02 /usr/libexec/ibus-engine-simple +paul 3372 1155 0 13:20 ? 00:00:00 /usr/libexec/xdg-desktop-portal-gtk +paul 3441 1155 0 13:20 ? 00:00:00 /usr/libexec/gvfsd-metadata +paul 3453 1155 0 13:20 ? 00:00:00 /usr/libexec/evolution-calendar-factory +paul 3495 1155 0 13:20 ? 00:00:00 /usr/libexec/evolution-addressbook-factory +paul 4798 1155 0 13:26 ? 00:00:09 /usr/libexec/gnome-terminal-server +paul 4810 4798 0 13:26 pts/0 00:00:00 bash +paul 8614 1155 0 13:29 ? 00:00:01 /usr/bin/speech-dispatcher -s -t 0 +paul 8656 8614 0 13:29 ? 00:00:00 [sd_espeak-ng-mb] +paul 8709 8614 0 13:29 ? 00:00:00 /usr/lib/speech-dispatcher-modules/sd_espeak-ng /etc/speech-dispatcher/modules/espeak-ng.conf +paul 8785 8614 0 13:29 ? 00:00:00 /usr/lib/speech-dispatcher-modules/sd_dummy /etc/speech-dispatcher/modules/dummy.conf +paul 8799 8614 0 13:29 ? 00:00:00 /usr/lib/speech-dispatcher-modules/sd_espeak-ng /etc/speech-dispatcher/modules/ +paul 10028 1155 0 13:31 ? 00:00:00 adb -L tcp:5037 fork-server server --reply-fd 4 +paul 69578 2814 0 13:53 ? 00:00:00 /usr/libexec/gvfsd-http --spawner :1.22 /org/gtk/gvfs/exec_spaw/0 +paul 108341 1155 3 14:06 ? 00:00:48 /home/paul/.nvm/versions/node/v22.23.0/bin/node /home/paul/.nvm/versions/node/v22.23.0/lib/node_modules/acpx/dist/cli.js __queue-owner +paul 108416 108341 0 14:06 ? 00:00:00 openclaw +paul 108458 108416 2 14:06 ? 00:00:37 openclaw-acp +paul 143553 1155 0 14:19 ? 00:00:05 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmpI2JxLw.tmp +paul 149205 1155 0 14:21 ? 00:00:05 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmpitRyQG.tmp +paul 151724 1155 0 14:22 ? 00:00:04 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmpJEsOZV.tmp +paul 157447 1155 1 14:24 ? 00:00:05 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmpyM92DV.tmp +paul 165231 1155 0 14:26 ? 00:00:01 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmp5CKC19.tmp +paul 168472 1155 4 14:27 ? 00:00:09 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmpuRJsnQ.tmp +paul 172147 1155 4 14:29 pts/0 00:00:05 /home/paul/Workspace/yavsc/src/PostIt.Tests/bin/Debug/net10.0/PostIt.Tests @@ /tmp/tmpxT8nje.tmp +paul 172435 4810 99 14:31 pts/0 00:00:00 ps -fu paul diff --git a/src/PostIt/Directory.Packages.props b/src/PostIt/Directory.Packages.props index 69e8a896..88e06195 100644 --- a/src/PostIt/Directory.Packages.props +++ b/src/PostIt/Directory.Packages.props @@ -1,37 +1,21 @@ - + + - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/PostIt/PostIt.Android/Application.cs b/src/PostIt/PostIt.Android/Application.cs index f5a7908d..fb6b08d3 100644 --- a/src/PostIt/PostIt.Android/Application.cs +++ b/src/PostIt/PostIt.Android/Application.cs @@ -2,12 +2,6 @@ using Android.Runtime; using Avalonia; using Avalonia.Android; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Avalonia.Controls; -using Avalonia.Styling; -using Yavsc.Api.Client; namespace PostIt.Android { diff --git a/src/PostIt/PostIt.Android/MainActivity.cs b/src/PostIt/PostIt.Android/MainActivity.cs index 62c29e10..86ce394a 100644 --- a/src/PostIt/PostIt.Android/MainActivity.cs +++ b/src/PostIt/PostIt.Android/MainActivity.cs @@ -1,6 +1,6 @@ -using Android.App; -using Android.Content; +using Android.App; using Android.Content.PM; +using Android.Content; using Avalonia; using Avalonia.Android; @@ -12,10 +12,11 @@ namespace PostIt.Android; Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", MainLauncher = true, + LaunchMode = LaunchMode.SingleTask, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] public class MainActivity : AvaloniaMainActivity { - /// + /// /// Strongly-typed handle to the current MainActivity instance, set in /// and consumed by platform services such as /// which need to launch @@ -29,7 +30,8 @@ public class MainActivity : AvaloniaMainActivity PlatformBootstrap.EnsureInitialized(); Current = this; } - /// + + /// /// Receives the deep-link Intent fired by the system browser after the /// user completes the OIDC login on https://yavsc.pschneider.fr. The /// Intent URI has the shape android://postit-signin?code=...&state=.... @@ -61,4 +63,4 @@ public class MainActivity : AvaloniaMainActivity tcs?.TrySetResult(intent?.Data?.ToString() ?? string.Empty); } } -} +} \ No newline at end of file diff --git a/src/PostIt/PostIt.Android/PostIt.Android.csproj b/src/PostIt/PostIt.Android/PostIt.Android.csproj index a4af1eb2..b34b88d4 100644 --- a/src/PostIt/PostIt.Android/PostIt.Android.csproj +++ b/src/PostIt/PostIt.Android/PostIt.Android.csproj @@ -2,32 +2,35 @@ Exe net10.0-android - 23 + + android-arm64;android-x64 + 23.0.0 enable - fr.pschneider.PostIt + com.CompanyName.PostIt 1 1.0 apk - false - SdkOnly - partial + false + android-arm;android-arm64;android-x86;android-x64 + 1.1.0.0 + 1.1.0.0 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 + 1.1.0-beta.1 - Resources\drawable\Icon.png - - - - + + + diff --git a/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml b/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml index 91b61d05..2472d06d 100644 --- a/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml +++ b/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml @@ -1,7 +1,7 @@ - + - + + x:Class="PostIt.App"> - - - + - + - + + diff --git a/src/PostIt/PostIt/App.axaml.cs b/src/PostIt/PostIt/App.axaml.cs index 3b7370f9..d2399873 100644 --- a/src/PostIt/PostIt/App.axaml.cs +++ b/src/PostIt/PostIt/App.axaml.cs @@ -1,16 +1,16 @@ using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; using Avalonia.Styling; -using Microsoft.Extensions.DependencyInjection; using PostIt.Services; +using Yavsc.Api.Client; using PostIt.ViewModels; using PostIt.Views; -using PostIt.Helpers; namespace PostIt; @@ -27,71 +27,198 @@ public partial class App : Application /// DataValidationErrors.SetErrors. /// public IServiceProvider? ServiceProvider { get; private set; } - - public MainWindow? Window { get; private set; } + private MainWindow window; + public App() + { + } public override void Initialize() { AvaloniaXamlLoader.Load(this); -#if DEBUG - this.AttachDeveloperTools(); -#endif } public override void OnFrameworkInitializationCompleted() { + // Belt-and-braces 2nd-instance guard. The primary check now + // lives in PostIt.Desktop.Program.Main and exits before + // Avalonia boots — preventing a flash of the MainWindow on + // every postit://callback launch. This block is kept for any + // entry point that bypasses Program.Main (PostIt.Browser, + // PostIt.Android's process lifecycle, ad-hoc tests that build + // App directly) and as defence-in-depth in case the Desktop + // build is ever reconfigured to skip the early check. if (TryHandOffCustomSchemeUrl()) return; - this.ServiceProvider = new ServiceCollection().BuildServices(); + this.ServiceProvider = BuildServices(new ServiceCollection()); + AttachServiceProvider(ServiceProvider); var settings = ServiceProvider.GetRequiredService(); + var sessionStatus = ServiceProvider.GetRequiredService(); + var api = ServiceProvider.GetRequiredService(); + + DataTemplates.Clear(); + DataTemplates.Add(new ViewLocator(ServiceProvider)); + + // Wire the Settings singleton onto the SettingsPage singleton + // once, at composition time. The page is registered as a + // singleton (see above) precisely so this binding is stable + // for the lifetime of the app: every push to / pop from the + // navigation stack finds the same ContentPage with the same + // DataContext, and the TwoWay bindings inside the page keep + // mutating the same in-memory Settings instance that the rest + // of the app reads (OidcClientOptions construction, etc.). + ServiceProvider.GetRequiredService().DataContext = settings; + + // Settings.DarkMode was previously a dead field: it round- + // tripped through the settings file and the SettingsPage + // CheckBox, but no consumer ever read it. Wire it here to + // Application.RequestedThemeVariant so the toggle takes + // effect immediately, and seed the initial theme from the + // value Load() just populated (so a dark-mode user lands on + // a dark window on first launch, not on a default-light + // window that flips after the user touches the toggle). + ApplyDarkMode(settings); + settings.PropertyChanged += (_, e) => + { + if (e.PropertyName == nameof(Settings.DarkMode)) + { + ApplyDarkMode(settings); + } + }; if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - desktop.MainWindow = Window = CreateMainWindow(); - ApplyDarkMode(settings); - } - else if (ApplicationLifetime is IActivityApplicationLifetime singleViewFactoryApplicationLifetime) - { - singleViewFactoryApplicationLifetime.MainViewFactory = - () => - { - Window = CreateMainWindow(); - ApplyDarkMode(settings); - Window.Show(); - return Window; - }; - } - else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) - { - singleViewPlatform.MainView = Window = CreateMainWindow(); - ApplyDarkMode(settings); - } - var mainVm = ServiceProvider!.GetRequiredService(); + var homeVm = ServiceProvider.GetRequiredService(); - base.OnFrameworkInitializationCompleted(); - this.PushPageAsync(mainVm).Wait(); + window = new MainWindow(); + window.SessionBanner.DataContext = sessionStatus; + + // Build the navigation stack from scratch: HomePage is the + // root in both cases. App.BootAsync will push MainPage on + // top if the silent refresh succeeds. + desktop.MainWindow = window; + _ = PushPageAsync(homeVm); + + // When the user logs out, route back to HomePage. We + // ReplaceAsync the current top so we don't grow the stack + // on every logout — otherwise repeated login/logout would + // eventually balloon the back history. + sessionStatus.LogoutCompleted += () => + { + var w = (MainWindow)((IClassicDesktopStyleApplicationLifetime)ApplicationLifetime!).MainWindow!; + var nav = w.NavRoot; + _ = nav.PopToRootAsync(); + }; + + // When the user signs in interactively (Login button on + // the session banner), push MainPage on top of HomePage. + sessionStatus.LoginSucceeded += () => + { + var w = (MainWindow)((IClassicDesktopStyleApplicationLifetime)ApplicationLifetime!).MainWindow!; + _ = PushMainPageAsync(); + }; + + window.Opened += async (_, _) => await BootAsync(this.ServiceProvider, api); + } + else if (ApplicationLifetime is ISingleViewApplicationLifetime singleView) + { + singleView.MainView = new MainWindow + { + DataContext = ServiceProvider.GetRequiredService() + }; + } } - - - private MainWindow CreateMainWindow() + /// + /// Build the DI container the app uses. Pulled out of + /// so headless + /// tests can construct the same container at TestApp boot + /// without going through the full Avalonia desktop lifetime + /// (which never runs in a unit test). The container returned is + /// the exact one production uses — no test-only fakes, no + /// trimmed service list — so a test that exercises a VM, page, + /// or service resolves through the same wiring the real app + /// does, and a green test is a green contract for prod. + /// + internal static IServiceProvider BuildServices(ServiceCollection services) { - Window = new MainWindow(); - var api = ServiceProvider!.GetRequiredService(); - Window.Opened += async (_, _) => await BootAsync(this.ServiceProvider!, api); - var sessionStatus = ServiceProvider!.GetRequiredService(); - sessionStatus.LogoutCompleted += () => - { - Window.NavRoot.PopToRootAsync(); - }; + var settings = new Settings(); + settings.Load(); - sessionStatus.LoginSucceeded += () => - { - PushMainPageAsync(); - }; + var tokenStore = new TokenStore(System.IO.Path.Combine( + System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), + "PostIt", "tokens.json")); - Window.SessionBanner.DataContext = sessionStatus; - return Window; + var api = new YavscApiClient(settings, tokenStore); + var client = new BlogApiClient(api, settings.BlogsApiUrl); + var circleClient = new CircleApiClient(api, settings.BlogsApiUrl); + var blogAclClient = new BlogAclApiClient(api, settings.BlogsApiUrl); + var userSearchClient = new UserSearchClient(api, settings.BlogsApiUrl); + var contactService = new ContactService(); + var userDirectory = new UserDirectory(userSearchClient); + + + // Vues + services.AddTransient(); + // SettingsPage is a singleton: there must be one and only one + // instance of the settings UI for the lifetime of the app. + // This guarantees that (a) the bindings always reflect the + // current in-memory Settings state, (b) the page already has + // its DataContext wired up at composition-root time (see + // below), and (c) PushPageAsync's anti-empilement guard sees + // the same instance across pushes, so a second Settings tap + // is a no-op rather than re-pushing the page. Transient would + // let the user accumulate stale SettingsPage instances on + // the navigation stack, each bound to a fresh + // SettingsViewModel and missing any in-flight edits. + services.AddSingleton(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + // Dialogs (modal-light pages): the ViewLocator resolves + // them when a caller pushes a PostAclDialogViewModel or + // AddCircleMemberDialogViewModel via App.PushPageAsync. + // App.PushPageAsync overwrites the page's DataContext with + // the caller-built VM, so the parameterless ctor is enough + // here — the parametrised ctors stay for direct test wiring. + services.AddTransient(); + services.AddTransient(); + // ViewModels + services.AddSingleton(settings); + services.AddSingleton(api); + services.AddSingleton(api); + services.AddSingleton(client); + services.AddSingleton(circleClient); + services.AddSingleton(blogAclClient); + services.AddSingleton(userSearchClient); + services.AddSingleton(contactService); + services.AddSingleton(userDirectory); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + // Persistent session banner: one instance for the lifetime of + // the app so the same VM survives page navigation. + var sessionStatus = new SessionStatusViewModel { Api = api }; + sessionStatus.Refresh(); + services.AddSingleton(sessionStatus); + services.AddTransient(); + + return services.BuildServiceProvider(); + } + + /// + /// Attach a pre-built DI container to this + /// instance. Used by headless tests after + /// ; in production this happens + /// implicitly via . + /// Idempotent w.r.t. : + /// re-binding from a second App boot is a no-op. + /// + internal void AttachServiceProvider(IServiceProvider sp) + { + ServiceProvider = sp; + Settings.BindToServiceProvider(sp); } /// @@ -102,7 +229,7 @@ public partial class App : Application /// internal void AttachMainWindow(MainWindow mainWindow) { - Window = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow)); + window = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow)); } private static void ApplyDarkMode(Settings settings) @@ -139,11 +266,11 @@ public partial class App : Application /// (interactive login from the banner). Pulled out as a helper so /// the two callers can't drift apart. /// - public static async Task PushMainPageAsync() + public static Task PushMainPageAsync() { - var app = (App)Current!; - var mainVm = app.ServiceProvider!.GetRequiredService(); - await app.PushPageAsync(mainVm); + var app = (App)Current; + var mainVm = app.ServiceProvider.GetRequiredService(); + return app.PushPageAsync(mainVm); } private bool TryHandOffCustomSchemeUrl() @@ -178,8 +305,53 @@ public partial class App : Application return true; } + internal void PushPage(ViewModelBase vm) + { + _ = PushPageAsync(vm); + } + + internal Task PushPageAsync(ViewModelBase vm) + { + if (window is null) + { + throw new InvalidOperationException("MainWindow is not initialized yet."); + } + + var template = DataTemplates.FirstOrDefault(t => t.Match(vm)); + if (template is null) + { + throw new InvalidOperationException($"No IDataTemplate found for {vm.GetType().Name}."); + } + + var view = template.Build(vm); + if (view is null) + { + throw new InvalidOperationException( + $"Template for {vm.GetType().Name} returned ."); + } + + var page = view as Page; + if (page is null) + { + // NavigationPage expects Page instances. Wrap any fallback control + // (e.g. ViewLocator error TextBlock) into a ContentPage so it can render. + page = new ContentPage { Content = view }; + } + + page.DataContext = vm; + + // Avoid stacking the same singleton page twice (e.g. SettingsPage). + var stack = window.NavRoot.NavigationStack; + if (stack.Count > 0 && ReferenceEquals(stack[stack.Count - 1], page)) + { + return Task.CompletedTask; + } + + return window.NavRoot.PushAsync(page); + } + internal async Task GoBackAsync() { - await Window!.NavRoot.PopAsync(); + await window.NavRoot.PopAsync(); } } diff --git a/src/PostIt/PostIt/Assets/avalonia-logo.ico b/src/PostIt/PostIt/Assets/avalonia-logo.ico deleted file mode 100644 index f7da8bb5..00000000 Binary files a/src/PostIt/PostIt/Assets/avalonia-logo.ico and /dev/null differ diff --git a/src/PostIt/PostIt/Helpers/ServiceCollectionHelpers.cs b/src/PostIt/PostIt/Helpers/ServiceCollectionHelpers.cs deleted file mode 100644 index fae24fa6..00000000 --- a/src/PostIt/PostIt/Helpers/ServiceCollectionHelpers.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using Microsoft.Extensions.DependencyInjection; -using PostIt.Services; -using PostIt.ViewModels; -using PostIt.Views; -using Yavsc.Api.Client; - -namespace PostIt.Helpers; - -public static class ServiceCollectionHelpers -{ - public static IServiceProvider BuildServices(this ServiceCollection services) - { - var settings = new Settings(); - settings.Load(); - - var tokenStore = new TokenStore(System.IO.Path.Combine( - System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), - "PostIt", "tokens.json")); - - var api = new YavscApiClient(settings, tokenStore); - var client = new BlogApiClient(api, settings.BlogsApiUrl); - var circleClient = new CircleApiClient(api, settings.BlogsApiUrl); - var blogAclClient = new BlogAclApiClient(api, settings.BlogsApiUrl); - var userSearchClient = new UserSearchClient(api, settings.BlogsApiUrl); - var contactService = new ContactService(); - var userDirectory = new UserDirectory(userSearchClient); - - // Vues - services.AddTransient(); - // SettingsPage is a singleton: there must be one and only one - // instance of the settings UI for the lifetime of the app. - // This guarantees that (a) the bindings always reflect the - // current in-memory Settings state, (b) the page already has - // its DataContext wired up at composition-root time (see - // below), and (c) PushPageAsync's anti-empilement guard sees - // the same instance across pushes, so a second Settings tap - // is a no-op rather than re-pushing the page. Transient would - // let the user accumulate stale SettingsPage instances on - // the navigation stack, each bound to a fresh - // SettingsViewModel and missing any in-flight edits. - services.AddSingleton(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - // Dialogs (modal-light pages): the ViewLocator resolves - // them when a caller pushes a PostAclDialogViewModel or - // AddCircleMemberDialogViewModel via App.PushPageAsync. - // App.PushPageAsync overwrites the page's DataContext with - // the caller-built VM, so the parameterless ctor is enough - // here — the parametrised ctors stay for direct test wiring. - services.AddTransient(); - services.AddTransient(); - // ViewModels - services.AddSingleton(settings); - services.AddSingleton(api); - services.AddSingleton(client); - services.AddSingleton(circleClient); - services.AddSingleton(blogAclClient); - services.AddSingleton(userSearchClient); - services.AddSingleton(contactService); - services.AddSingleton(userDirectory); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - - // Persistent session banner: one instance for the lifetime of - // the app so the same VM survives page navigation. - var sessionStatus = new SessionStatusViewModel { Api = api }; - sessionStatus.Refresh(); - services.AddSingleton(sessionStatus); - services.AddTransient(); - - return services.BuildServiceProvider(); - } -} diff --git a/src/PostIt/PostIt/Helpers/ViewModelBaseHelpers.cs b/src/PostIt/PostIt/Helpers/ViewModelBaseHelpers.cs deleted file mode 100644 index 3cb00301..00000000 --- a/src/PostIt/PostIt/Helpers/ViewModelBaseHelpers.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using Avalonia.Controls; -using PostIt.ViewModels; - -namespace PostIt.Helpers; - -public static class ViewModelBaseHelpers -{ - public static async Task PushPageAsync(this App app, ViewModelBase vm) - { - var window = app.Window; - if (window is null) - { - throw new InvalidOperationException("MainWindow is not initialized yet."); - } - - var template = app.DataTemplates.FirstOrDefault(t => t.Match(vm)); - if (template is null) - { - throw new InvalidOperationException($"No IDataTemplate found for {vm.GetType().Name}."); - } - - var view = template.Build(vm); - if (view is null) - { - throw new InvalidOperationException( - $"Template for {vm.GetType().Name} returned ."); - } - - var page = view as Page; - if (page is null) - { - // NavigationPage expects Page instances. Wrap any fallback control - // (e.g. ViewLocator error TextBlock) into a ContentPage so it can render. - page = new ContentPage { Content = view }; - } - - page.DataContext = vm; - - // Avoid stacking the same singleton page twice (e.g. SettingsPage). - var stack = window.NavRoot.NavigationStack; - if (stack.Count > 0 && ReferenceEquals(stack[stack.Count - 1], page)) - { - return; - } - - await window.NavRoot.PushAsync(page); - } -} diff --git a/src/PostIt/PostIt/PostIt.csproj b/src/PostIt/PostIt/PostIt.csproj index 70bd72ca..163a6a77 100644 --- a/src/PostIt/PostIt/PostIt.csproj +++ b/src/PostIt/PostIt/PostIt.csproj @@ -1,14 +1,32 @@ - + net10.0 enable latest + true + 1.1.0.0 + 1.1.0.0 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 + 1.1.0-beta.1 - - + + + + + + + None + All + + + + + + + PreserveNewest @@ -20,21 +38,6 @@ - - - - - None - All - - - - - + - - - - - - + \ No newline at end of file diff --git a/src/PostIt/PostIt/Services/YavscApiClient.cs b/src/PostIt/PostIt/Services/YavscApiClient.cs index 726b3f4f..b611fe02 100644 --- a/src/PostIt/PostIt/Services/YavscApiClient.cs +++ b/src/PostIt/PostIt/Services/YavscApiClient.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Net.Http.Json; +using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; diff --git a/src/PostIt/PostIt/Settings/AuthenticationSettings.cs b/src/PostIt/PostIt/Settings/AuthenticationSettings.cs index 99358cfb..ad71063b 100644 --- a/src/PostIt/PostIt/Settings/AuthenticationSettings.cs +++ b/src/PostIt/PostIt/Settings/AuthenticationSettings.cs @@ -21,9 +21,6 @@ public partial class AuthenticationSettings : ObservableObject public static string DefaultAuthority { get; internal set; } = "https://yavsc.pschneider.fr"; public static string DefaultClientId { get; internal set; } = "postit"; - - public static string[] DefaultScopes { get; set; } = { "blogs"} ; - [ObservableProperty] public partial string Authority { get; set; } diff --git a/src/PostIt/PostIt/ViewLocator.cs b/src/PostIt/PostIt/ViewLocator.cs index 3543a9c9..fd92c802 100644 --- a/src/PostIt/PostIt/ViewLocator.cs +++ b/src/PostIt/PostIt/ViewLocator.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; using Avalonia.Controls; using Avalonia.Controls.Templates; using Microsoft.Extensions.DependencyInjection; @@ -11,13 +10,17 @@ 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 { + private readonly IServiceProvider _services; - public Control Build(object? data) + public ViewLocator(IServiceProvider services) + { + _services = services; + } + + public Control Build(object? data) { try { @@ -29,24 +32,21 @@ public class ViewLocator : IDataTemplate } } - private Control BuildCore(object? data) { - var app = App.Current as App; - var services = app!.ServiceProvider!; return data switch { - MainViewModel => services.GetRequiredService(), - Settings => services.GetRequiredService(), - HomePageViewModel => services.GetRequiredService(), - SignaturePageViewModel => services.GetRequiredService(), - AddCircleMemberDialogViewModel => services.GetRequiredService(), - CirclesPageViewModel => services.GetRequiredService(), - PostAclDialogViewModel => services.GetRequiredService(), + MainPageViewModel => _services.GetRequiredService(), + Settings => _services.GetRequiredService(), + HomePageViewModel => _services.GetRequiredService(), + SignaturePageViewModel => _services.GetRequiredService(), + AddCircleMemberDialogViewModel => _services.GetRequiredService(), + CirclesPageViewModel => _services.GetRequiredService(), + PostAclDialogViewModel => _services.GetRequiredService(), null => new TextBlock { Text = "No view for " }, _ => new TextBlock { Text = $"No view for {data.GetType().Name}" } }; } - public bool Match(object? data) => data is ViewModelBase; + public bool Match(object? data) => data is ViewModelBase; } diff --git a/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs b/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs index 88d01335..59d6dbed 100644 --- a/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using PostIt.Services; +using PostIt.Views; using Yavsc.Api.Client; namespace PostIt.ViewModels; diff --git a/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs b/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs index 9cee3ea8..33a5bd30 100644 --- a/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs @@ -5,7 +5,6 @@ using Avalonia; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; -using PostIt.Helpers; using PostIt.Services; using Yavsc.Api.Client; using Yavsc.Api.Client.Dtos; diff --git a/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs b/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs index 5d727729..876f862c 100644 --- a/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/HomePageViewModel.cs @@ -1,4 +1,6 @@ using CommunityToolkit.Mvvm.Input; +using Microsoft.Extensions.DependencyInjection; +using PostIt; using PostIt.Services; namespace PostIt.ViewModels; diff --git a/src/PostIt/PostIt/ViewModels/MainViewModel.cs b/src/PostIt/PostIt/ViewModels/MainPageViewModel.cs similarity index 96% rename from src/PostIt/PostIt/ViewModels/MainViewModel.cs rename to src/PostIt/PostIt/ViewModels/MainPageViewModel.cs index 1aa3eee0..e8256df6 100644 --- a/src/PostIt/PostIt/ViewModels/MainViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/MainPageViewModel.cs @@ -8,11 +8,12 @@ using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; using Yavsc.Blogspot; using Yavsc.Api.Client; -using PostIt.Helpers; +using PostIt.Services; +using PostIt.Views; namespace PostIt.ViewModels; -public partial class MainViewModel : ViewModelBase +public partial class MainPageViewModel : ViewModelBase { /// Window/tab title. Cosmetic — bound by /// MainPage.axaml if at all. Not the post title. @@ -121,10 +122,10 @@ public partial class MainViewModel : ViewModelBase } - public MainViewModel() + public MainPageViewModel() { + Init(null); SettingsModel = new Settings(); - Init(SettingsModel); BlogClient = null; } @@ -136,11 +137,6 @@ public partial class MainViewModel : ViewModelBase SelectedPost = null; IsBusy = false; StatusMessage = "Ready"; - Settings = settings ?? new Settings(); - WindowTitle = "PostIt"; - DraftTitle = string.Empty; - DraftArticle = string.Empty; - DraftIsPublished = false; // Production path: DI injects the canonical Settings singleton // and we use it as-is. Test path: tests call this constructor // without a Settings argument; we fall back to a fresh @@ -151,7 +147,11 @@ public partial class MainViewModel : ViewModelBase // sink; that crash is fixed in Settings.OnPropertyChanged // (thread-safe dispatcher marshalling) so the duplicate // instance is now merely wasteful, not dangerous. - + Settings = settings ?? new Settings(); + WindowTitle = "PostIt"; + DraftTitle = string.Empty; + DraftArticle = string.Empty; + DraftIsPublished = false; } /// Save is enabled as soon as the user has typed @@ -171,11 +171,12 @@ public partial class MainViewModel : ViewModelBase /// . Production code uses the /// (Settings, BlogApiClient) overload below. /// - public MainViewModel(BlogApiClient blogClient, Settings? settings = null, IServiceProvider? services = null) + public MainPageViewModel(BlogApiClient blogClient, Settings? settings = null, IServiceProvider? services = null) { SettingsModel = new Settings(); BlogClient = blogClient ?? throw new ArgumentNullException(nameof(blogClient)); ; Services = services; + Init(settings); } @@ -211,7 +212,7 @@ public partial class MainViewModel : ViewModelBase { await ExecuteAsync(async () => { - var posts = await BlogClient!.GetPostsAsync(); + var posts = await BlogClient.GetPostsAsync(); Posts.Clear(); foreach (var post in posts.OrderByDescending(p => p.DateModified)) { @@ -260,7 +261,7 @@ public partial class MainViewModel : ViewModelBase DateCreated = DateTime.UtcNow, DateModified = DateTime.UtcNow, }; - var created = await BlogClient!.CreatePostAsync(draft); + var created = await BlogClient.CreatePostAsync(draft); if (created is not null) { SelectedPost = created; @@ -279,7 +280,7 @@ public partial class MainViewModel : ViewModelBase DateCreated = SelectedPost.DateCreated, DateModified = DateTime.UtcNow, }; - await BlogClient!.UpdatePostAsync(SelectedPost.Id, update); + await BlogClient.UpdatePostAsync(SelectedPost.Id, update); StatusMessage = $"Saved post {SelectedPost.Id}."; } @@ -298,7 +299,7 @@ public partial class MainViewModel : ViewModelBase await ExecuteAsync(async () => { - await BlogClient!.DeletePostAsync(SelectedPost.Id); + await BlogClient.DeletePostAsync(SelectedPost.Id); StatusMessage = $"Deleted post {SelectedPost.Id}."; SelectedPost = null; await RefreshPostsAsync(); @@ -332,7 +333,7 @@ public partial class MainViewModel : ViewModelBase await ExecuteAsync(async () => { var desired = !DraftIsPublished; - await BlogClient!.SetPublishAsync(SelectedPost.Id, desired); + await BlogClient.SetPublishAsync(SelectedPost.Id, desired); DraftIsPublished = desired; // Mirror into the selected post so a subsequent // RefreshPostsAsync() doesn't blow away the @@ -373,7 +374,7 @@ public partial class MainViewModel : ViewModelBase private async Task RefreshPostsAsync() { - var posts = await BlogClient!.GetPostsAsync(); + var posts = await BlogClient.GetPostsAsync(); Posts.Clear(); foreach (var post in posts.OrderByDescending(p => p.DateModified)) { diff --git a/src/PostIt/PostIt/ViewModels/SessionStatusViewModel.cs b/src/PostIt/PostIt/ViewModels/SessionStatusViewModel.cs index f2496b85..a1ad48ce 100644 --- a/src/PostIt/PostIt/ViewModels/SessionStatusViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/SessionStatusViewModel.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; -using PostIt.Helpers; using PostIt.Services; namespace PostIt.ViewModels; @@ -140,7 +139,7 @@ public partial class SessionStatusViewModel : ViewModelBase internal async Task OpenSettings() { var app = (App)App.Current!; - await app.PushPageAsync(app.ServiceProvider!.GetRequiredService()).ConfigureAwait(true); + await app.PushPageAsync(app.ServiceProvider.GetRequiredService()).ConfigureAwait(true); } } diff --git a/src/PostIt/PostIt/ViewModels/Settings.cs b/src/PostIt/PostIt/ViewModels/Settings.cs index 2115a0cd..890ca15c 100644 --- a/src/PostIt/PostIt/ViewModels/Settings.cs +++ b/src/PostIt/PostIt/ViewModels/Settings.cs @@ -47,7 +47,40 @@ public partial class Settings : ViewModelBase /// private static Settings? s_current; - + /// + /// Wire the canonical Settings instance to a DI container. Called + /// exactly once from App.axaml.cs after the singleton has + /// been registered. Subsequent calls are no-ops: the DI container + /// owns the instance lifetime and we don't want a stray + /// BindToServiceProvider in a test fixture to silently + /// rebind the production instance. + /// + public static void BindToServiceProvider(IServiceProvider services) + { + if (services is null) throw new ArgumentNullException(nameof(services)); + Interlocked.CompareExchange(ref s_current, + services.GetService() ?? throw new InvalidOperationException( + "Settings is not registered in the DI container."), + null); + } + + /// + /// Returns the canonical Settings instance previously bound through + /// , or null when called + /// outside a running Avalonia application (tests, CLI tools). + /// + public static Settings? GetCurrent() => Volatile.Read(ref s_current); + + /// + /// Resolve the canonical Settings instance or throw. Use this in + /// production code paths that must not silently fall back to a + /// freshly-constructed (which used to be + /// the root cause of the postit://callback crash: two Settings + /// instances racing on PropertyChanged from different threads). + /// + public static Settings RequireCurrent() => + GetCurrent() ?? throw new InvalidOperationException( + "Settings.Current is not bound. Call App.OnFrameworkInitializationCompleted first."); [ObservableProperty] public partial AuthenticationSettings Authentication { get; set; } = new(); @@ -66,7 +99,7 @@ public partial class Settings : ViewModelBase /// setters above all funnel through here, and we flip /// in lock-step. Sub-property mutations /// (e.g. Authentication.Authority) are caught by the - /// subscription wired up in + /// subscription wired up in /// below. disables the flag during bulk /// hydration so the disk load itself does not count as a user /// edit. @@ -317,14 +350,15 @@ public partial class Settings : ViewModelBase var settings = JsonSerializer.Deserialize(json); if (settings is null) { - UseDefaultSettings(); + Console.Error.WriteLine($"🩎 Settings payload is invalid (source: {source})."); + return; } // Apply under the gate so concurrent Load() callers cannot // see half the new values / half the old ones. The actual // PropertyChanged fan-out is handled by [ObservableProperty]'s // setters which we route through SetProperty → OnPropertyChanged // → our overridden dispatcher-safe marshaller below. - else lock (_mutationGate) + lock (_mutationGate) { this.Authentication = settings.Authentication; this.DarkMode = settings.DarkMode; @@ -337,11 +371,6 @@ public partial class Settings : ViewModelBase AuthenticationSettings.DefaultClientId : settings.Authentication.ClientId; this.Authentication.RedirectUri = string.IsNullOrWhiteSpace(settings.Authentication.RedirectUri) ? AuthenticationSettings.DefaultDesktopRedirectUri : settings.Authentication.RedirectUri; - if (settings.Authentication.Scopes is null || settings.Authentication.Scopes.Length == 0) - { - settings.Authentication.Scopes = AuthenticationSettings.DefaultScopes; - } - else this.Authentication.Scopes = settings.Authentication.Scopes; } } @@ -371,18 +400,6 @@ public partial class Settings : ViewModelBase } } - private void UseDefaultSettings() - { - this.Authentication = new AuthenticationSettings - { - Authority = AuthenticationSettings.DefaultAuthority, - ClientId = AuthenticationSettings.DefaultClientId, - RedirectUri = AuthenticationSettings.DefaultDesktopRedirectUri, - Scopes = AuthenticationSettings.DefaultScopes - }; - this.DarkMode = false; - } - /// /// Persist the current in-memory state to /// ~/.config/PostIt/postit-settings.json (Linux) / diff --git a/src/PostIt/PostIt/ViewModels/ViewModelBase.cs b/src/PostIt/PostIt/ViewModels/ViewModelBase.cs index 4ca69eea..93019360 100644 --- a/src/PostIt/PostIt/ViewModels/ViewModelBase.cs +++ b/src/PostIt/PostIt/ViewModels/ViewModelBase.cs @@ -1,10 +1,12 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using Avalonia.Styling; +using CommunityToolkit.Mvvm.ComponentModel; 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; } diff --git a/src/PostIt/PostIt/Views/AddCircleMemberDialog.axaml.cs b/src/PostIt/PostIt/Views/AddCircleMemberDialog.axaml.cs index 2941c557..6905c85a 100644 --- a/src/PostIt/PostIt/Views/AddCircleMemberDialog.axaml.cs +++ b/src/PostIt/PostIt/Views/AddCircleMemberDialog.axaml.cs @@ -1,10 +1,9 @@ - +using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.Interactivity; using Avalonia.VisualTree; using PostIt.Services; using PostIt.ViewModels; -using System.Threading.Tasks; namespace PostIt.Views; @@ -20,7 +19,7 @@ namespace PostIt.Views; /// circle id. The dialog itself does not know the circle id /// by design. /// -public partial class AddCircleMemberDialog : Avalonia.Controls.ContentPage +public partial class AddCircleMemberDialog : ContentPage { public AddCircleMemberDialog() { @@ -42,9 +41,10 @@ public partial class AddCircleMemberDialog : Avalonia.Controls.ContentPage public AddCircleMemberDialogViewModel? ViewModel => DataContext as AddCircleMemberDialogViewModel; - private async Task OnCloseClicked(object? sender, RoutedEventArgs e) + private void OnCloseClicked(object? sender, RoutedEventArgs e) { - App app = App.Current! as App; - await app!.GoBackAsync(); + var nav = this.FindAncestorOfType(); + if (nav is not null) + _ = nav.PopAsync(); } } diff --git a/src/PostIt/PostIt/Views/CirclesPage.axaml.cs b/src/PostIt/PostIt/Views/CirclesPage.axaml.cs index 3fe7a16c..a2f01fb5 100644 --- a/src/PostIt/PostIt/Views/CirclesPage.axaml.cs +++ b/src/PostIt/PostIt/Views/CirclesPage.axaml.cs @@ -1,5 +1,10 @@ +using System; +using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; +using Microsoft.Extensions.DependencyInjection; +using PostIt.Services; +using PostIt.ViewModels; namespace PostIt.Views; diff --git a/src/PostIt/PostIt/Views/MainPage.axaml b/src/PostIt/PostIt/Views/MainPage.axaml index fd75d403..7eac39ff 100644 --- a/src/PostIt/PostIt/Views/MainPage.axaml +++ b/src/PostIt/PostIt/Views/MainPage.axaml @@ -8,11 +8,11 @@ xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit" mc:Ignorable="d" x:Class="PostIt.Views.MainPage" - x:DataType="vm:MainViewModel" + x:DataType="vm:MainPageViewModel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> - + - - + > - + + + diff --git a/src/PostIt/PostIt/Views/SessionStatusBanner.axaml.cs b/src/PostIt/PostIt/Views/SessionStatusBanner.axaml.cs index ac788ee4..0f240635 100644 --- a/src/PostIt/PostIt/Views/SessionStatusBanner.axaml.cs +++ b/src/PostIt/PostIt/Views/SessionStatusBanner.axaml.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Markup.Xaml; namespace PostIt.Views; diff --git a/src/Yavsc.Abstract/Attributes/ActivityBillingAttribute.cs b/src/Yavsc.Abstract/Attributes/ActivityBillingAttribute.cs index 3930a69f..a3f13d7d 100644 --- a/src/Yavsc.Abstract/Attributes/ActivityBillingAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/ActivityBillingAttribute.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Attributes { public class ActivityBillingAttribute : Attribute diff --git a/src/Yavsc.Abstract/Attributes/ActivitySettingsAttribute.cs b/src/Yavsc.Abstract/Attributes/ActivitySettingsAttribute.cs index 8d9b958f..f91a7279 100644 --- a/src/Yavsc.Abstract/Attributes/ActivitySettingsAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/ActivitySettingsAttribute.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Attributes { public class ActivitySettingsAttribute : Attribute diff --git a/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs b/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs index 33e3f21a..43c44054 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs @@ -1,8 +1,10 @@ + +using System; using System.ComponentModel.DataAnnotations; using Yavsc.Server.Helpers; namespace Yavsc.Attributes.Validation -{ +{ /// /// Valid Remote User Dir Attribute /// @@ -16,7 +18,7 @@ namespace Yavsc.Attributes.Validation { if (ErrorMessageResourceType==null) { ErrorMessageResourceType = typeof(Yavsc.Attributes.Validation.Resources); - ErrorMessageResourceName = "InvalidPath"; + ErrorMessageResourceName = "InvalidPath"; } } diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs b/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs index 92175c36..5bb67326 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs @@ -1,12 +1,14 @@ + +using System; using System.Reflection; namespace Yavsc.Attributes.Validation { - public class YaRegularExpression : System.ComponentModel.DataAnnotations.RegularExpressionAttribute { + public class YaRegularExpression : System.ComponentModel.DataAnnotations.RegularExpressionAttribute { public YaRegularExpression(string pattern): base (pattern) { this.ErrorMessage = "RegularExpression: "+ pattern; - + } public override string FormatErrorMessage(string name) @@ -18,4 +20,4 @@ namespace Yavsc.Attributes.Validation } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaRequiredAttribute.cs b/src/Yavsc.Abstract/Attributes/Validation/YaRequiredAttribute.cs index e3c04be4..9f753c20 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaRequiredAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaRequiredAttribute.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Attributes.Validation { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] @@ -11,13 +13,13 @@ namespace Yavsc.Attributes.Validation public YaRequiredAttribute (string msg) : base(msg) { ErrorMessage = msg; - } + } public YaRequiredAttribute () : base("Required Field") { ErrorMessageResourceType = typeof(Yavsc.Attributes.Validation.Resources); ErrorMessageResourceName = "FieldRequired"; } - + public override bool IsValid(object value) { if (value == null) { return false; @@ -32,5 +34,5 @@ namespace Yavsc.Attributes.Validation return true; } } - -} + +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs b/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs index 91015b24..c4c7b19f 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Attributes.Validation { public partial class YaStringLength: YaValidationAttribute @@ -19,15 +21,15 @@ namespace Yavsc.Attributes.Validation { if (ErrorMessageResourceType==null) { ErrorMessageResourceType = typeof(Yavsc.Attributes.Validation.Resources); - ErrorMessageResourceName = "InvalidStringLength"; + ErrorMessageResourceName = "InvalidStringLength"; } } public override bool IsValid(object value) { - + string stringValue = value as string; if (stringValue==null) return MinimumLength <= 0; - if (MinimumLength>=0) + if (MinimumLength>=0) { if (stringValue.Length< MinimumLength) { return false; diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs b/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs index d8d6070d..827d26ba 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs @@ -1,3 +1,6 @@ +using System; +using System.Reflection; + namespace Yavsc.Attributes.Validation { public class YaValidationAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute @@ -6,7 +9,7 @@ namespace Yavsc.Attributes.Validation { } - + public YaValidationAttribute(Func acr): base(acr) { @@ -42,4 +45,4 @@ namespace Yavsc.Attributes.Validation return GetResourceString(ErrorMessageResourceName); } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Authentication/RegisterModel.cs b/src/Yavsc.Abstract/Authentication/RegisterModel.cs index 2ebb3297..e4285f06 100644 --- a/src/Yavsc.Abstract/Authentication/RegisterModel.cs +++ b/src/Yavsc.Abstract/Authentication/RegisterModel.cs @@ -1,4 +1,7 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; +using Yavsc.Abstract; + using Yavsc; namespace Yavsc.ViewModels.Account { diff --git a/src/Yavsc.Abstract/Billing/IBillable.cs b/src/Yavsc.Abstract/Billing/IBillable.cs index 416dc5be..dfc9ee0f 100644 --- a/src/Yavsc.Abstract/Billing/IBillable.cs +++ b/src/Yavsc.Abstract/Billing/IBillable.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using Yavsc.Services; namespace Yavsc.Billing diff --git a/src/Yavsc.Abstract/Blogspot/IBlogPost.cs b/src/Yavsc.Abstract/Blogspot/IBlogPost.cs index 1ef37180..6090fca2 100644 --- a/src/Yavsc.Abstract/Blogspot/IBlogPost.cs +++ b/src/Yavsc.Abstract/Blogspot/IBlogPost.cs @@ -2,6 +2,7 @@ using Yavsc.Abstract.Identity.Security; +using Yavsc.Interfaces; namespace Yavsc.Blogspot { diff --git a/src/Yavsc.Abstract/Chat/IChatRoom.cs b/src/Yavsc.Abstract/Chat/IChatRoom.cs index 1d6f68dd..665c7126 100644 --- a/src/Yavsc.Abstract/Chat/IChatRoom.cs +++ b/src/Yavsc.Abstract/Chat/IChatRoom.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Yavsc.Abstract.Chat @@ -14,4 +15,4 @@ namespace Yavsc.Abstract.Chat List Moderation { get; } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs b/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs index dd805864..5e571e24 100644 --- a/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs +++ b/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs @@ -1,4 +1,7 @@ -using System.Text; +using System; +using System.IO; +using System.Linq; +using System.Text; using Yavsc.ViewModels.UserFiles; namespace Yavsc.Server.Helpers @@ -39,10 +42,10 @@ namespace Yavsc.Server.Helpers { if (name.Any(c => !ValidFileNameChars.Contains(c))) return false; - + if (!name.Any(c => !AlfaNum.Contains(c))) return false; - + return true; } diff --git a/src/Yavsc.Abstract/FileSystem/RemoteFileInfo.cs b/src/Yavsc.Abstract/FileSystem/RemoteFileInfo.cs index 2a21823c..76cb17eb 100644 --- a/src/Yavsc.Abstract/FileSystem/RemoteFileInfo.cs +++ b/src/Yavsc.Abstract/FileSystem/RemoteFileInfo.cs @@ -1,6 +1,8 @@ -namespace Yavsc.ViewModels +using System; + +namespace Yavsc.ViewModels { - public class RemoteFileInfo + public class RemoteFileInfo { public string Name { get; set; } @@ -9,7 +11,7 @@ public DateTime CreationTime { get; set; } public DateTime LastModified { get; set; } - + } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs b/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs index fa727d0c..cced9397 100644 --- a/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs +++ b/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs @@ -1,3 +1,7 @@ +using System; +using System.IO; +using System.Linq; +using Yavsc.Abstract.FileSystem; using Yavsc.Server.Helpers; namespace Yavsc.ViewModels.UserFiles @@ -9,7 +13,7 @@ namespace Yavsc.ViewModels.UserFiles public RemoteFileInfo [] Files { get; set; } - public DirectoryShortInfo [] SubDirectories { + public DirectoryShortInfo [] SubDirectories {  get; set; } private readonly DirectoryInfo dInfo; @@ -19,7 +23,7 @@ namespace Yavsc.ViewModels.UserFiles { } - + public UserDirectoryInfo(string userReposPath, string userId, string path) { if (string.IsNullOrWhiteSpace(userId)) diff --git a/src/Yavsc.Abstract/Google/Calendar/CalendarEventList.cs b/src/Yavsc.Abstract/Google/Calendar/CalendarEventList.cs index 0b8b0682..095c28be 100644 --- a/src/Yavsc.Abstract/Google/Calendar/CalendarEventList.cs +++ b/src/Yavsc.Abstract/Google/Calendar/CalendarEventList.cs @@ -18,6 +18,8 @@ // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; + namespace Yavsc.Models.Google { diff --git a/src/Yavsc.Abstract/Google/Calendar/CalendarList.cs b/src/Yavsc.Abstract/Google/Calendar/CalendarList.cs index 84ab1bf0..c7caccda 100644 --- a/src/Yavsc.Abstract/Google/Calendar/CalendarList.cs +++ b/src/Yavsc.Abstract/Google/Calendar/CalendarList.cs @@ -19,6 +19,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; + namespace Yavsc.Models.Google.Calendar { /// diff --git a/src/Yavsc.Abstract/Google/Calendar/CalendarListEntry.cs b/src/Yavsc.Abstract/Google/Calendar/CalendarListEntry.cs index 99d9a99b..00a5ffcb 100644 --- a/src/Yavsc.Abstract/Google/Calendar/CalendarListEntry.cs +++ b/src/Yavsc.Abstract/Google/Calendar/CalendarListEntry.cs @@ -19,12 +19,14 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; + namespace Yavsc.Models.Google.Calendar { /// /// Calendar list entry. /// - /// + /// [Obsolete("use GoogleUse.Apis")] public class CalendarListEntry { /// diff --git a/src/Yavsc.Abstract/Google/Calendar/Reminder.cs b/src/Yavsc.Abstract/Google/Calendar/Reminder.cs index d10e6da7..8a48753c 100644 --- a/src/Yavsc.Abstract/Google/Calendar/Reminder.cs +++ b/src/Yavsc.Abstract/Google/Calendar/Reminder.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Models.Google.Calendar { [Obsolete("use GoogleUse.Apis")] diff --git a/src/Yavsc.Abstract/Google/GDate.cs b/src/Yavsc.Abstract/Google/GDate.cs index 3506ba41..e1fe7f5c 100644 --- a/src/Yavsc.Abstract/Google/GDate.cs +++ b/src/Yavsc.Abstract/Google/GDate.cs @@ -18,6 +18,8 @@ // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; + namespace Yavsc.Models.Google { /// diff --git a/src/Yavsc.Abstract/Google/Messaging/MessageWithPayLoad.cs b/src/Yavsc.Abstract/Google/Messaging/MessageWithPayLoad.cs index 344273ad..ed683304 100644 --- a/src/Yavsc.Abstract/Google/Messaging/MessageWithPayLoad.cs +++ b/src/Yavsc.Abstract/Google/Messaging/MessageWithPayLoad.cs @@ -20,6 +20,7 @@ // along with this program. If not, see . using Yavsc.Abstract.Models.Messaging; +using Yavsc.Models.Messaging; namespace Yavsc.Models.Google.Messaging { diff --git a/src/Yavsc.Abstract/IT/CodeFromChars.cs b/src/Yavsc.Abstract/IT/CodeFromChars.cs index ff441568..b8e2f0d6 100644 --- a/src/Yavsc.Abstract/IT/CodeFromChars.cs +++ b/src/Yavsc.Abstract/IT/CodeFromChars.cs @@ -1,4 +1,6 @@ +using System; using System.Collections; +using System.Collections.Generic; namespace Yavsc.Abstract.IT { @@ -11,10 +13,10 @@ namespace Yavsc.Abstract.IT } public CharArray (IList word): base(word) { - + } public CharArray (IEnumerable word): base(word) { - + } public IList Aggregate(char other) @@ -87,10 +89,10 @@ namespace Yavsc.Abstract.IT State = -3; return; } - + State = states[letter]; } } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/IT/ICode.cs b/src/Yavsc.Abstract/IT/ICode.cs index 2661c70c..c190065a 100644 --- a/src/Yavsc.Abstract/IT/ICode.cs +++ b/src/Yavsc.Abstract/IT/ICode.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Yavsc.Abstract.IT { // un code est, parmis les ensembles de suites de signes, @@ -12,7 +14,7 @@ namespace Yavsc.Abstract.IT bool Validate(); /// - /// Defines a new letter in this code, + /// Defines a new letter in this code, /// as an enumerable of TLetter /// /// diff --git a/src/Yavsc.Abstract/IT/IProject.cs b/src/Yavsc.Abstract/IT/IProject.cs index 946ab6e9..e15fb067 100644 --- a/src/Yavsc.Abstract/IT/IProject.cs +++ b/src/Yavsc.Abstract/IT/IProject.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Yavsc.Abstract.IT { public interface IProject diff --git a/src/Yavsc.Abstract/Identity/TokenInfo.cs b/src/Yavsc.Abstract/Identity/TokenInfo.cs index 2c7a4fd4..1847f3a2 100644 --- a/src/Yavsc.Abstract/Identity/TokenInfo.cs +++ b/src/Yavsc.Abstract/Identity/TokenInfo.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Abstract.Identity { public class TokenInfo diff --git a/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs b/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs index f79a596e..f544f654 100644 --- a/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs +++ b/src/Yavsc.Abstract/Interfaces/IBaseTrackedEntity.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc { public interface ITrackedEntity diff --git a/src/Yavsc.Abstract/Interfaces/IBatch.cs b/src/Yavsc.Abstract/Interfaces/IBatch.cs index a31470ec..e3dac450 100644 --- a/src/Yavsc.Abstract/Interfaces/IBatch.cs +++ b/src/Yavsc.Abstract/Interfaces/IBatch.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Abstract.Interfaces { public interface IBatch diff --git a/src/Yavsc.Abstract/Interfaces/IBillingService.cs b/src/Yavsc.Abstract/Interfaces/IBillingService.cs index e11c9c99..3ba7fc59 100644 --- a/src/Yavsc.Abstract/Interfaces/IBillingService.cs +++ b/src/Yavsc.Abstract/Interfaces/IBillingService.cs @@ -1,7 +1,8 @@ namespace Yavsc.Services { - using System.Threading.Tasks; - using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using System.Collections.Generic; using Yavsc.Abstract.Workflow; public interface IBillingService diff --git a/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs b/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs index 2c844f92..6934f3a9 100644 --- a/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs +++ b/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs @@ -1,4 +1,5 @@ -using Yavsc.Abstract.Identity; +using System; +using Yavsc.Abstract.Identity; namespace Yavsc.Interfaces { @@ -10,4 +11,4 @@ namespace Yavsc.Interfaces ILocation Location { get; set; } decimal? Previsionnal { get; set; } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Messaging/IAnnounce.cs b/src/Yavsc.Abstract/Messaging/IAnnounce.cs index 04d16c1b..cd1957af 100644 --- a/src/Yavsc.Abstract/Messaging/IAnnounce.cs +++ b/src/Yavsc.Abstract/Messaging/IAnnounce.cs @@ -1,4 +1,6 @@ -using Yavsc.Interfaces; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Interfaces; namespace Yavsc.Models.Messaging { @@ -6,5 +8,5 @@ namespace Yavsc.Models.Messaging Reason For { get; set; } string Message { get; set; } } - -} + +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Messaging/Notification.cs b/src/Yavsc.Abstract/Messaging/Notification.cs index dbbf735d..8b79e2c8 100644 --- a/src/Yavsc.Abstract/Messaging/Notification.cs +++ b/src/Yavsc.Abstract/Messaging/Notification.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -28,7 +29,7 @@ namespace Yavsc.Abstract.Models.Messaging /// [StringLength(512)] [Display(Name = "Icône")] - public string? icon { get; set; } + public string? icon { get; set; } /// /// The sound. /// diff --git a/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs b/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs index 87125c54..5e9118f3 100644 --- a/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs +++ b/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs @@ -1,3 +1,4 @@ +using System; using Yavsc.Abstract.Identity; using Yavsc.Models.Relationship; diff --git a/src/Yavsc.Abstract/Relationship/Location.cs b/src/Yavsc.Abstract/Relationship/Location.cs index de4beb20..6c7491f6 100644 --- a/src/Yavsc.Abstract/Relationship/Location.cs +++ b/src/Yavsc.Abstract/Relationship/Location.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Abstract/Relationship/Position.cs b/src/Yavsc.Abstract/Relationship/Position.cs index 717ac922..22b03c76 100644 --- a/src/Yavsc.Abstract/Relationship/Position.cs +++ b/src/Yavsc.Abstract/Relationship/Position.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Abstract/Templates/Template.cs b/src/Yavsc.Abstract/Templates/Template.cs index c71fcfbf..ee1a8c8b 100644 --- a/src/Yavsc.Abstract/Templates/Template.cs +++ b/src/Yavsc.Abstract/Templates/Template.cs @@ -1,4 +1,5 @@ using System.Text; +using System.Threading.Tasks; namespace Yavsc.Abstract.Templates { diff --git a/src/Yavsc.Abstract/Workflow/IActivity.cs b/src/Yavsc.Abstract/Workflow/IActivity.cs index 2f06420b..45781b28 100644 --- a/src/Yavsc.Abstract/Workflow/IActivity.cs +++ b/src/Yavsc.Abstract/Workflow/IActivity.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc { public interface IActivity diff --git a/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs b/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs index 6e55ebe5..4f3613e8 100644 --- a/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs +++ b/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs @@ -16,6 +16,8 @@ // along with yavsc. If not, see . // +using System; + namespace Yavsc { public interface IMobileDeviceDeclaration diff --git a/src/Yavsc.Abstract/Workflow/INominativeQuery.cs b/src/Yavsc.Abstract/Workflow/INominativeQuery.cs index 84dcee69..d498e28d 100644 --- a/src/Yavsc.Abstract/Workflow/INominativeQuery.cs +++ b/src/Yavsc.Abstract/Workflow/INominativeQuery.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Abstract.Workflow { public interface IDecidableQuery: ITrackedEntity, IQuery diff --git a/src/Yavsc.Abstract/Workflow/Process/Conjonction.cs b/src/Yavsc.Abstract/Workflow/Process/Conjonction.cs index a45de4e6..bd2125db 100644 --- a/src/Yavsc.Abstract/Workflow/Process/Conjonction.cs +++ b/src/Yavsc.Abstract/Workflow/Process/Conjonction.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Yavsc.Models.Process { public class Conjonction : List, IRequisition diff --git a/src/Yavsc.Abstract/Workflow/Process/Disjonction.cs b/src/Yavsc.Abstract/Workflow/Process/Disjonction.cs index 5c4e0831..416257b7 100644 --- a/src/Yavsc.Abstract/Workflow/Process/Disjonction.cs +++ b/src/Yavsc.Abstract/Workflow/Process/Disjonction.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Yavsc.Models.Process { public class Disjonction : List, IRequisition diff --git a/src/Yavsc.Abstract/Workflow/Tasks/IExecutionData.cs b/src/Yavsc.Abstract/Workflow/Tasks/IExecutionData.cs index 674ed6ac..fbc72a52 100644 --- a/src/Yavsc.Abstract/Workflow/Tasks/IExecutionData.cs +++ b/src/Yavsc.Abstract/Workflow/Tasks/IExecutionData.cs @@ -1,3 +1,7 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + + namespace Yavsc.Abstract.Workflow { public interface IExecutionData diff --git a/src/Yavsc.Abstract/Workflow/Tasks/ITaskMetaData.cs b/src/Yavsc.Abstract/Workflow/Tasks/ITaskMetaData.cs index 9e5365a3..e2371641 100644 --- a/src/Yavsc.Abstract/Workflow/Tasks/ITaskMetaData.cs +++ b/src/Yavsc.Abstract/Workflow/Tasks/ITaskMetaData.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Yavsc.Models; namespace Yavsc.Abstract.Workflow diff --git a/src/Yavsc.Abstract/Workflow/Tasks/TaskManager.cs b/src/Yavsc.Abstract/Workflow/Tasks/TaskManager.cs index 59f23b8b..55c262f7 100644 --- a/src/Yavsc.Abstract/Workflow/Tasks/TaskManager.cs +++ b/src/Yavsc.Abstract/Workflow/Tasks/TaskManager.cs @@ -1,3 +1,6 @@ +using System.Collections.Generic; +using System.Linq; + namespace Yavsc.Abstract.Workflow { public class TaskManager : ITaskRunnerProvider @@ -14,4 +17,4 @@ namespace Yavsc.Abstract.Workflow return runners.Where(r => r.GetType().Name.IndexOf(runnerName.Trim())>=0).ToArray(); } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Yavsc.Abstract.csproj b/src/Yavsc.Abstract/Yavsc.Abstract.csproj index ebbb2d1e..7a4f83ae 100644 --- a/src/Yavsc.Abstract/Yavsc.Abstract.csproj +++ b/src/Yavsc.Abstract/Yavsc.Abstract.csproj @@ -11,10 +11,10 @@ latest 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 - + \ No newline at end of file diff --git a/src/Yavsc.Api.Client/Yavsc.Api.Client.csproj b/src/Yavsc.Api.Client/Yavsc.Api.Client.csproj index 047223a6..ade7ca17 100644 --- a/src/Yavsc.Api.Client/Yavsc.Api.Client.csproj +++ b/src/Yavsc.Api.Client/Yavsc.Api.Client.csproj @@ -17,7 +17,7 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -26,4 +26,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Api/Controllers/Business/ActivityApiController.cs b/src/Yavsc.Api/Controllers/Business/ActivityApiController.cs index 6d91ba82..5aeddc57 100644 --- a/src/Yavsc.Api/Controllers/Business/ActivityApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/ActivityApiController.cs @@ -1,4 +1,9 @@ +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs b/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs index 0d7112ec..7e58b071 100644 --- a/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs @@ -1,6 +1,10 @@ +using System.Collections.Generic; +using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; namespace Yavsc.Controllers { @@ -10,6 +14,7 @@ namespace Yavsc.Controllers using Yavsc.Models.Billing; using Yavsc.Abstract.Identity; using Microsoft.EntityFrameworkCore; + using Yavsc.Helpers; using Yavsc.Server.Helpers; [Produces("application/json")] diff --git a/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs b/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs index 891909f0..902cb038 100644 --- a/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs @@ -1,8 +1,13 @@ +using System; +using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Billing; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/Business/EstimateTemplatesApiController.cs b/src/Yavsc.Api/Controllers/Business/EstimateTemplatesApiController.cs index 3fc91365..81de4cac 100644 --- a/src/Yavsc.Api/Controllers/Business/EstimateTemplatesApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/EstimateTemplatesApiController.cs @@ -1,6 +1,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Billing; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/Business/FrontOfficeApiController.cs b/src/Yavsc.Api/Controllers/Business/FrontOfficeApiController.cs index 91d57d9f..c05da827 100644 --- a/src/Yavsc.Api/Controllers/Business/FrontOfficeApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/FrontOfficeApiController.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Yavsc.Helpers; using Yavsc.Models; diff --git a/src/Yavsc.Api/Controllers/Business/ProductApiController.cs b/src/Yavsc.Api/Controllers/Business/ProductApiController.cs index d9792839..97a60fdb 100644 --- a/src/Yavsc.Api/Controllers/Business/ProductApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/ProductApiController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Market; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/HairCut/BursherProfilesApiController.cs b/src/Yavsc.Api/Controllers/HairCut/BursherProfilesApiController.cs index 00e6e4ea..cd3a561b 100644 --- a/src/Yavsc.Api/Controllers/HairCut/BursherProfilesApiController.cs +++ b/src/Yavsc.Api/Controllers/HairCut/BursherProfilesApiController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Haircut; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs b/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs index bf27d1d9..c1181f54 100644 --- a/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs +++ b/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs @@ -1,4 +1,6 @@ +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; namespace Yavsc.ApiControllers @@ -9,6 +11,7 @@ namespace Yavsc.ApiControllers using System.Security.Claims; using Microsoft.Extensions.Logging; using Models; + using Services; using Models.Haircut; using System.Threading.Tasks; using Helpers; diff --git a/src/Yavsc.Api/Controllers/Musical/DjProfileApiController.cs b/src/Yavsc.Api/Controllers/Musical/DjProfileApiController.cs index 35e97194..050241a7 100644 --- a/src/Yavsc.Api/Controllers/Musical/DjProfileApiController.cs +++ b/src/Yavsc.Api/Controllers/Musical/DjProfileApiController.cs @@ -1,5 +1,6 @@ namespace Yavsc.ApiControllers { + using Models; using Yavsc.Models.Musical.Profiles; public class DjProfileApiController : ProfileApiController diff --git a/src/Yavsc.Api/Controllers/Musical/MusicalPreferencesApiController.cs b/src/Yavsc.Api/Controllers/Musical/MusicalPreferencesApiController.cs index 89d1d265..dc935c14 100644 --- a/src/Yavsc.Api/Controllers/Musical/MusicalPreferencesApiController.cs +++ b/src/Yavsc.Api/Controllers/Musical/MusicalPreferencesApiController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Musical; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/Musical/MusicalTendenciesApiController.cs b/src/Yavsc.Api/Controllers/Musical/MusicalTendenciesApiController.cs index 67c5c2f8..e72090f6 100644 --- a/src/Yavsc.Api/Controllers/Musical/MusicalTendenciesApiController.cs +++ b/src/Yavsc.Api/Controllers/Musical/MusicalTendenciesApiController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Musical; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/PostRateApiController.cs b/src/Yavsc.Api/Controllers/PostRateApiController.cs index 83e2bee1..50d6d2e9 100644 --- a/src/Yavsc.Api/Controllers/PostRateApiController.cs +++ b/src/Yavsc.Api/Controllers/PostRateApiController.cs @@ -1,6 +1,8 @@ +using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/ProfileApiController.cs b/src/Yavsc.Api/Controllers/ProfileApiController.cs index 7ae9f153..93bf2a4e 100644 --- a/src/Yavsc.Api/Controllers/ProfileApiController.cs +++ b/src/Yavsc.Api/Controllers/ProfileApiController.cs @@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Mvc; namespace Yavsc.ApiControllers { + using Models; + /// /// Base class for managing performers profiles /// diff --git a/src/Yavsc.Api/Controllers/Relationship/BlackListApiController.cs b/src/Yavsc.Api/Controllers/Relationship/BlackListApiController.cs index 3a0ca630..32cf8495 100644 --- a/src/Yavsc.Api/Controllers/Relationship/BlackListApiController.cs +++ b/src/Yavsc.Api/Controllers/Relationship/BlackListApiController.cs @@ -2,6 +2,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Access; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/Relationship/ChatRoomApiController.cs b/src/Yavsc.Api/Controllers/Relationship/ChatRoomApiController.cs index d0f712b3..5d59f6bd 100644 --- a/src/Yavsc.Api/Controllers/Relationship/ChatRoomApiController.cs +++ b/src/Yavsc.Api/Controllers/Relationship/ChatRoomApiController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Chat; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/Relationship/ContactsApiController.cs b/src/Yavsc.Api/Controllers/Relationship/ContactsApiController.cs index d7ed4607..96ba03dc 100644 --- a/src/Yavsc.Api/Controllers/Relationship/ContactsApiController.cs +++ b/src/Yavsc.Api/Controllers/Relationship/ContactsApiController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Yavsc.Abstract.Identity; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/ServiceApiController.cs b/src/Yavsc.Api/Controllers/ServiceApiController.cs index 98817eeb..8556fb5a 100644 --- a/src/Yavsc.Api/Controllers/ServiceApiController.cs +++ b/src/Yavsc.Api/Controllers/ServiceApiController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Market; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/accounting/ApplicationUserApiController.cs b/src/Yavsc.Api/Controllers/accounting/ApplicationUserApiController.cs index 837e7f1e..cb565a0d 100644 --- a/src/Yavsc.Api/Controllers/accounting/ApplicationUserApiController.cs +++ b/src/Yavsc.Api/Controllers/accounting/ApplicationUserApiController.cs @@ -1,7 +1,12 @@ +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Yavsc.Abstract.Identity; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Api/Controllers/accounting/ProfileApiController.cs b/src/Yavsc.Api/Controllers/accounting/ProfileApiController.cs index 3b72e1b6..ce90b076 100644 --- a/src/Yavsc.Api/Controllers/accounting/ProfileApiController.cs +++ b/src/Yavsc.Api/Controllers/accounting/ProfileApiController.cs @@ -1,7 +1,11 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using System.Security.Claims; +using System.Threading.Tasks; +using System.Linq; using Yavsc.Models; using Yavsc.Abstract.Identity; +using Yavsc.Helpers; using Yavsc.Server.Helpers; namespace Yavsc.ApiControllers.accounting diff --git a/src/Yavsc.Api/Helpers/RequestHelpers.cs b/src/Yavsc.Api/Helpers/RequestHelpers.cs index d92e765e..0ab687e0 100644 --- a/src/Yavsc.Api/Helpers/RequestHelpers.cs +++ b/src/Yavsc.Api/Helpers/RequestHelpers.cs @@ -1,3 +1,13 @@ +using System.Collections.Generic; + +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Http; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Yavsc.ViewModels; +using Yavsc.Models; +using System.Linq; + namespace Yavsc.Api.Helpers { public static class RequestHelpers diff --git a/src/Yavsc.Api/Program.cs b/src/Yavsc.Api/Program.cs index 3ed20e8d..f7f247cc 100644 --- a/src/Yavsc.Api/Program.cs +++ b/src/Yavsc.Api/Program.cs @@ -15,6 +15,7 @@ using IdentityModel; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection.Extensions; +using Yavsc; using Yavsc.Abstract.Interfaces; using Yavsc.Helpers; using Yavsc.Interface; diff --git a/src/Yavsc.Api/Yavsc.Api.csproj b/src/Yavsc.Api/Yavsc.Api.csproj index 2ddeb72d..5672ab7a 100644 --- a/src/Yavsc.Api/Yavsc.Api.csproj +++ b/src/Yavsc.Api/Yavsc.Api.csproj @@ -7,7 +7,7 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -17,4 +17,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Blogs.Tests/BlogAclApiTests.cs b/src/Yavsc.Blogs.Tests/BlogAclApiTests.cs index 92dd3b2c..49259d05 100644 --- a/src/Yavsc.Blogs.Tests/BlogAclApiTests.cs +++ b/src/Yavsc.Blogs.Tests/BlogAclApiTests.cs @@ -5,6 +5,8 @@ using Microsoft.Extensions.DependencyInjection; using Yavsc.Abstract.BlogSpot; using Yavsc.Models; using Yavsc.Models.Access; +using Yavsc.Models.Blog; +using Yavsc.Models.Relationship; using Yavsc.Tests.Shared; using static Yavsc.Constants; diff --git a/src/Yavsc.Blogs.Tests/BlogApiMappedClaimsTests.cs b/src/Yavsc.Blogs.Tests/BlogApiMappedClaimsTests.cs index f4878860..f02a1b99 100644 --- a/src/Yavsc.Blogs.Tests/BlogApiMappedClaimsTests.cs +++ b/src/Yavsc.Blogs.Tests/BlogApiMappedClaimsTests.cs @@ -79,10 +79,10 @@ public sealed class BlogApiMappedClaimsTests : IClassFixture(TestContext.Current.CancellationToken); + var created = await response.Content.ReadFromJsonAsync(); Assert.NotNull(created); Assert.Equal("mapped-user", created!.AuthorId); } @@ -101,10 +101,10 @@ public sealed class BlogApiMappedClaimsTests : IClassFixture(TestContext.Current.CancellationToken); + var created = await createdResponse.Content.ReadFromJsonAsync(); Assert.NotNull(created); var updateResponse = await http.PutAsJsonAsync($"/api/v1/blog/{created!.Id}", new BlogPost @@ -115,7 +115,7 @@ public sealed class BlogApiMappedClaimsTests : IClassFixture(TestContext.Current.CancellationToken); + var created = await createdResponse.Content.ReadFromJsonAsync(); Assert.NotNull(created); using var otherHttp = NewClient(subject: "mapped-other"); @@ -149,7 +149,7 @@ public sealed class BlogApiMappedClaimsTests : IClassFixture ResetDatabase(); using var http = NewClient(); - var response = await http.GetAsync("/api/v1/blog", - TestContext.Current.CancellationToken); + var response = await http.GetAsync("/api/v1/blog"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var body = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken); + var body = await response.Content.ReadAsStringAsync(); // Empty table → empty JSON array. We compare as a JsonDocument // so a future change in formatting (whitespace, indentation) // doesn't break the assertion. @@ -147,26 +147,20 @@ public sealed class BlogApiTests : IClassFixture DateModified = DateTime.UtcNow }; - var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); + var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft); Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode); // The POST returns the server-issued post (with a real Id). - var created = await postResponse.Content.ReadFromJsonAsync( - TestContext.Current.CancellationToken - ); + var created = await postResponse.Content.ReadFromJsonAsync(); Assert.NotNull(created); Assert.NotEqual(0, created!.Id); Assert.Equal(draft.Title, created.Title); // The list should now contain exactly one entry. - var listResponse = await http.GetAsync("/api/v1/blog", - TestContext.Current.CancellationToken); + var listResponse = await http.GetAsync("/api/v1/blog"); Assert.Equal(HttpStatusCode.OK, listResponse.StatusCode); - using var doc = JsonDocument.Parse(await listResponse.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - )); + using var doc = JsonDocument.Parse(await listResponse.Content.ReadAsStringAsync()); Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind); Assert.Equal(1, doc.RootElement.GetArrayLength()); Assert.Equal(created.Id, doc.RootElement[0].GetProperty("id").GetInt64()); @@ -188,23 +182,17 @@ public sealed class BlogApiTests : IClassFixture DateModified = DateTime.UtcNow }; - var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); + var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft); Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode); - var created = await postResponse.Content.ReadFromJsonAsync( - TestContext.Current.CancellationToken - ); + var created = await postResponse.Content.ReadFromJsonAsync(); Assert.NotNull(created); Assert.Equal("tester", created!.AuthorId); - var listResponse = await http.GetAsync("/api/v1/blog", - TestContext.Current.CancellationToken); + var listResponse = await http.GetAsync("/api/v1/blog"); Assert.Equal(HttpStatusCode.OK, listResponse.StatusCode); - using var doc = JsonDocument.Parse(await listResponse.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - )); + using var doc = JsonDocument.Parse(await listResponse.Content.ReadAsStringAsync()); Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind); Assert.Equal(1, doc.RootElement.GetArrayLength()); Assert.Equal("tester", doc.RootElement[0].GetProperty("authorId").GetString()); @@ -226,27 +214,21 @@ public sealed class BlogApiTests : IClassFixture DateModified = DateTime.UtcNow }; - var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); + var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft); Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode); - var createdPost = await postResponse.Content.ReadFromJsonAsync( - TestContext.Current.CancellationToken - ); + var createdPost = await postResponse.Content.ReadFromJsonAsync(); Assert.NotNull(createdPost); - Thread.Sleep(100); + var commentResponse = await http.PostAsJsonAsync("/api/v1/blogcomments", new { Article = "Premier commentaire", ReceiverId = createdPost!.Id - }, TestContext.Current.CancellationToken); + }); Assert.Equal(HttpStatusCode.Created, commentResponse.StatusCode); - using var doc = JsonDocument.Parse( - await commentResponse.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - )); + using var doc = JsonDocument.Parse(await commentResponse.Content.ReadAsStringAsync()); Assert.True(doc.RootElement.TryGetProperty("id", out var id)); Assert.True(id.GetInt64() > 0); Assert.True(doc.RootElement.TryGetProperty("dateCreated", out _)); @@ -275,8 +257,7 @@ public sealed class BlogApiTests : IClassFixture // the framework returns 401. This is the proof that the // production policy is wired in the test host and not // short-circuited by a test-only auth bypass. - var response = await http.GetAsync("/api/v1/blog", - TestContext.Current.CancellationToken); + var response = await http.GetAsync("/api/v1/blog"); Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); } @@ -303,13 +284,10 @@ public sealed class BlogApiTests : IClassFixture DateCreated = DateTime.UtcNow, DateModified = DateTime.UtcNow }; - var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); + var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft); Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode); - var created = (await postResponse.Content.ReadFromJsonAsync( - TestContext.Current.CancellationToken - ))!; + var created = (await postResponse.Content.ReadFromJsonAsync())!; // PUT with the server-issued Id; the controller rejects // mismatched id/blog.Id with 400, so we keep them aligned. @@ -322,19 +300,13 @@ public sealed class BlogApiTests : IClassFixture DateCreated = created.DateCreated, DateModified = DateTime.UtcNow }; - var putResponse = await http.PutAsJsonAsync($"/api/v1/blog/{created.Id}", - update, - TestContext.Current.CancellationToken); + var putResponse = await http.PutAsJsonAsync($"/api/v1/blog/{created.Id}", update); Assert.Equal(HttpStatusCode.NoContent, putResponse.StatusCode); // The list should now reflect the new title. - var listResponse = await http.GetAsync("/api/v1/blog", - TestContext.Current.CancellationToken); + var listResponse = await http.GetAsync("/api/v1/blog"); Assert.Equal(HttpStatusCode.OK, listResponse.StatusCode); - using var doc = JsonDocument.Parse( - await listResponse.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - )); + using var doc = JsonDocument.Parse(await listResponse.Content.ReadAsStringAsync()); Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind); Assert.Equal(1, doc.RootElement.GetArrayLength()); Assert.Equal("Après", doc.RootElement[0].GetProperty("title").GetString()); @@ -356,23 +328,15 @@ public sealed class BlogApiTests : IClassFixture DateCreated = DateTime.UtcNow, DateModified = DateTime.UtcNow }; - var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); - var created = (await postResponse.Content.ReadFromJsonAsync( - TestContext.Current.CancellationToken - ))!; + var postResponse = await http.PostAsJsonAsync("/api/v1/blog", draft); + var created = (await postResponse.Content.ReadFromJsonAsync())!; - var deleteResponse = await http.DeleteAsync($"/api/v1/blog/{created.Id}", - TestContext.Current.CancellationToken - ); + var deleteResponse = await http.DeleteAsync($"/api/v1/blog/{created.Id}"); Assert.Equal(HttpStatusCode.OK, deleteResponse.StatusCode); // The list should now be empty. - var listResponse = await http.GetAsync("/api/v1/blog", - TestContext.Current.CancellationToken); - String response = await listResponse.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - ); + var listResponse = await http.GetAsync("/api/v1/blog"); + String response = await listResponse.Content.ReadAsStringAsync(); using var doc = JsonDocument.Parse(response); Assert.Equal(0, doc.RootElement.GetArrayLength()); } @@ -411,8 +375,7 @@ public sealed class BlogApiTests : IClassFixture DateModified = DateTime.UtcNow }; - var response = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); + var response = await http.PostAsJsonAsync("/api/v1/blog", draft); // Dump the body on failure so the test name + the response // payload are enough to start a fix; the framework's @@ -420,9 +383,7 @@ public sealed class BlogApiTests : IClassFixture // Created, got BadRequest"). if (response.StatusCode != HttpStatusCode.Created) { - var body = await response.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - ); + var body = await response.Content.ReadAsStringAsync(); Assert.Fail(string.Format("Expected 201 Created, got {0} {1}. Body: {2}", (int)response.StatusCode, response.StatusCode, body)); } } @@ -456,14 +417,11 @@ public sealed class BlogApiTests : IClassFixture DateModified = DateTime.UtcNow }; - var response = await http.PostAsJsonAsync("/api/v1/blog", draft, - TestContext.Current.CancellationToken); + var response = await http.PostAsJsonAsync("/api/v1/blog", draft); if (response.StatusCode != HttpStatusCode.BadRequest) { - var body = await response.Content.ReadAsStringAsync( - TestContext.Current.CancellationToken - ); + var body = await response.Content.ReadAsStringAsync(); Assert.Fail(string.Format("Expected 400 BadRequest (empty Title is invalid), got {0} {1}. Body: {2}", (int)response.StatusCode, response.StatusCode, body)); } } diff --git a/src/Yavsc.Blogs.Tests/CircleMembersApiTests.cs b/src/Yavsc.Blogs.Tests/CircleMembersApiTests.cs index a7c3001b..a2367180 100644 --- a/src/Yavsc.Blogs.Tests/CircleMembersApiTests.cs +++ b/src/Yavsc.Blogs.Tests/CircleMembersApiTests.cs @@ -1,4 +1,5 @@ using System.Net; +using System.Net.Http; using System.Net.Http.Json; using System.Text.Json; using Microsoft.Extensions.DependencyInjection; @@ -113,10 +114,10 @@ public sealed class CircleMembersApiTests : IClassFixture var circleId = SeedCircle("alice", "Famille"); using var http = NewClient("alice"); - var response = await http.GetAsync(MembersUrl(circleId), TestContext.Current.CancellationToken); + var response = await http.GetAsync(MembersUrl(circleId)); Assert.Equal(HttpStatusCode.OK, response.StatusCode); - using var doc = JsonDocument.Parse(await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken)); + using var doc = JsonDocument.Parse(await response.Content.ReadAsStringAsync()); Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind); Assert.Equal(0, doc.RootElement.GetArrayLength()); } @@ -130,14 +131,14 @@ public sealed class CircleMembersApiTests : IClassFixture var postResponse = await http.PostAsJsonAsync( MembersUrl(circleId), - new { userId = "bob" }, TestContext.Current.CancellationToken); + new { userId = "bob" }); Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode); - var getResponse = await http.GetAsync(MembersUrl(circleId), TestContext.Current.CancellationToken); + var getResponse = await http.GetAsync(MembersUrl(circleId)); Assert.Equal(HttpStatusCode.OK, getResponse.StatusCode); - using var doc = JsonDocument.Parse(await getResponse.Content.ReadAsStringAsync(TestContext.Current.CancellationToken)); + using var doc = JsonDocument.Parse(await getResponse.Content.ReadAsStringAsync()); Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind); Assert.Equal(1, doc.RootElement.GetArrayLength()); var member = doc.RootElement[0]; @@ -155,12 +156,12 @@ public sealed class CircleMembersApiTests : IClassFixture var first = await http.PostAsJsonAsync( MembersUrl(circleId), - new { userId = "bob" }, TestContext.Current.CancellationToken); + new { userId = "bob" }); Assert.Equal(HttpStatusCode.Created, first.StatusCode); var second = await http.PostAsJsonAsync( MembersUrl(circleId), - new { userId = "bob" }, TestContext.Current.CancellationToken); + new { userId = "bob" }); Assert.Equal(HttpStatusCode.Conflict, second.StatusCode); } @@ -171,14 +172,14 @@ public sealed class CircleMembersApiTests : IClassFixture var circleId = SeedCircle("alice", "Famille"); using var http = NewClient("alice"); - await http.PostAsJsonAsync(MembersUrl(circleId), new { userId = "bob" }, TestContext.Current.CancellationToken); + await http.PostAsJsonAsync(MembersUrl(circleId), new { userId = "bob" }); var deleteResponse = await http.DeleteAsync( - $"{MembersUrl(circleId)}/bob", TestContext.Current.CancellationToken); + $"{MembersUrl(circleId)}/bob"); Assert.Equal(HttpStatusCode.OK, deleteResponse.StatusCode); - var getResponse = await http.GetAsync(MembersUrl(circleId), TestContext.Current.CancellationToken); - using var doc = JsonDocument.Parse(await getResponse.Content.ReadAsStringAsync(TestContext.Current.CancellationToken)); + var getResponse = await http.GetAsync(MembersUrl(circleId)); + using var doc = JsonDocument.Parse(await getResponse.Content.ReadAsStringAsync()); Assert.Equal(0, doc.RootElement.GetArrayLength()); } @@ -190,7 +191,7 @@ public sealed class CircleMembersApiTests : IClassFixture var circleId = SeedCircle("alice", "Famille"); using var http = NewClient("bob"); - var response = await http.GetAsync(MembersUrl(circleId), TestContext.Current.CancellationToken); + var response = await http.GetAsync(MembersUrl(circleId)); // 404, not 403 — the controller deliberately avoids leaking // the existence of someone else's circle. diff --git a/src/Yavsc.Blogs.Tests/JwtClaimMappingCollection.cs b/src/Yavsc.Blogs.Tests/JwtClaimMappingCollection.cs index 927453ac..e141c0f3 100644 --- a/src/Yavsc.Blogs.Tests/JwtClaimMappingCollection.cs +++ b/src/Yavsc.Blogs.Tests/JwtClaimMappingCollection.cs @@ -1,3 +1,5 @@ +using Xunit; + namespace Yavsc.Blogs.Tests; [CollectionDefinition("JwtClaimMapping", DisableParallelization = true)] diff --git a/src/Yavsc.Blogs.Tests/MappedClaimsBlogsWebServerFixture.cs b/src/Yavsc.Blogs.Tests/MappedClaimsBlogsWebServerFixture.cs index 127f38fe..6d84aed5 100644 --- a/src/Yavsc.Blogs.Tests/MappedClaimsBlogsWebServerFixture.cs +++ b/src/Yavsc.Blogs.Tests/MappedClaimsBlogsWebServerFixture.cs @@ -1,5 +1,6 @@ using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; +using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; diff --git a/src/Yavsc.Blogs.Tests/PublishEndpointTests.cs b/src/Yavsc.Blogs.Tests/PublishEndpointTests.cs index 7d5a02a9..e767a57a 100644 --- a/src/Yavsc.Blogs.Tests/PublishEndpointTests.cs +++ b/src/Yavsc.Blogs.Tests/PublishEndpointTests.cs @@ -1,4 +1,5 @@ using System.Net; +using System.Net.Http; using System.Net.Http.Json; using System.Text.Json; using Microsoft.Extensions.DependencyInjection; @@ -100,12 +101,12 @@ public sealed class PublishEndpointTests : IClassFixture var postId = SeedPost("alice"); using var http = NewClient("alice"); - var put = await http.PutAsJsonAsync(PublishUrl(postId), new { publish = true }, TestContext.Current.CancellationToken); + var put = await http.PutAsJsonAsync(PublishUrl(postId), new { publish = true }); Assert.Equal(HttpStatusCode.NoContent, put.StatusCode); - var get = await http.GetAsync($"{BlogsUrl}/{postId}", TestContext.Current.CancellationToken); + var get = await http.GetAsync($"{BlogsUrl}/{postId}"); Assert.Equal(HttpStatusCode.OK, get.StatusCode); - using var doc = JsonDocument.Parse(await get.Content.ReadAsStringAsync(TestContext.Current.CancellationToken)); + using var doc = JsonDocument.Parse(await get.Content.ReadAsStringAsync()); Assert.True(doc.RootElement.GetProperty("isPublished").GetBoolean()); } @@ -116,12 +117,12 @@ public sealed class PublishEndpointTests : IClassFixture var postId = SeedPost("alice"); using var http = NewClient("alice"); - await http.PutAsJsonAsync(PublishUrl(postId), new { publish = true }, TestContext.Current.CancellationToken); - var put = await http.PutAsJsonAsync(PublishUrl(postId), new { publish = false }, TestContext.Current.CancellationToken); + await http.PutAsJsonAsync(PublishUrl(postId), new { publish = true }); + var put = await http.PutAsJsonAsync(PublishUrl(postId), new { publish = false }); Assert.Equal(HttpStatusCode.NoContent, put.StatusCode); - var get = await http.GetAsync($"{BlogsUrl}/{postId}", TestContext.Current.CancellationToken); - using var doc = JsonDocument.Parse(await get.Content.ReadAsStringAsync(TestContext.Current.CancellationToken)); + var get = await http.GetAsync($"{BlogsUrl}/{postId}"); + using var doc = JsonDocument.Parse(await get.Content.ReadAsStringAsync()); Assert.False(doc.RootElement.GetProperty("isPublished").GetBoolean()); } @@ -130,7 +131,7 @@ public sealed class PublishEndpointTests : IClassFixture { ResetDatabase(); using var http = NewClient("alice"); - var put = await http.PutAsJsonAsync(PublishUrl(99999L), new { publish = true }, TestContext.Current.CancellationToken); + var put = await http.PutAsJsonAsync(PublishUrl(99999L), new { publish = true }); Assert.Equal(HttpStatusCode.NotFound, put.StatusCode); } @@ -141,7 +142,7 @@ public sealed class PublishEndpointTests : IClassFixture var postId = SeedPost("alice"); using var http = NewClient("bob"); - var put = await http.PutAsJsonAsync(PublishUrl(postId), new { publish = true }, TestContext.Current.CancellationToken); + var put = await http.PutAsJsonAsync(PublishUrl(postId), new { publish = true }); // 401 Challenge (the controller returns Challenge() // for AuthorizationFailureException). The exact code // is framework-dependent; what matters is "not 204". diff --git a/src/Yavsc.Blogs.Tests/Yavsc.Blogs.Tests.csproj b/src/Yavsc.Blogs.Tests/Yavsc.Blogs.Tests.csproj index 34536806..fc7883ce 100644 --- a/src/Yavsc.Blogs.Tests/Yavsc.Blogs.Tests.csproj +++ b/src/Yavsc.Blogs.Tests/Yavsc.Blogs.Tests.csproj @@ -9,7 +9,7 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -35,4 +35,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Blogs/Controllers/CircleApiController.cs b/src/Yavsc.Blogs/Controllers/CircleApiController.cs index 524f0471..ea3c981b 100644 --- a/src/Yavsc.Blogs/Controllers/CircleApiController.cs +++ b/src/Yavsc.Blogs/Controllers/CircleApiController.cs @@ -1,3 +1,4 @@ +using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Yavsc.Models; diff --git a/src/Yavsc.Blogs/Program.cs b/src/Yavsc.Blogs/Program.cs index 00ac7f6f..952115d3 100644 --- a/src/Yavsc.Blogs/Program.cs +++ b/src/Yavsc.Blogs/Program.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection.Extensions; +using Yavsc; using Yavsc.Interface; using Yavsc.Interfaces; using Yavsc.Models; diff --git a/src/Yavsc.Blogs/Yavsc.Blogs.csproj b/src/Yavsc.Blogs/Yavsc.Blogs.csproj index 019fb102..5c175cb5 100644 --- a/src/Yavsc.Blogs/Yavsc.Blogs.csproj +++ b/src/Yavsc.Blogs/Yavsc.Blogs.csproj @@ -8,7 +8,7 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -18,4 +18,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Org.Tests/ComputeKidTests.cs b/src/Yavsc.Org.Tests/ComputeKidTests.cs index b1338bbd..af9d94a9 100644 --- a/src/Yavsc.Org.Tests/ComputeKidTests.cs +++ b/src/Yavsc.Org.Tests/ComputeKidTests.cs @@ -1,5 +1,9 @@ +using System; +using System.IO; +using System.Linq; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; +using Xunit; using Yavsc.Extensions; namespace Yavsc.Org.Tests; diff --git a/src/Yavsc.Org.Tests/Controllers/ClientControllerCollectionTests.cs b/src/Yavsc.Org.Tests/Controllers/ClientControllerCollectionTests.cs index d2e40f53..8883c75d 100644 --- a/src/Yavsc.Org.Tests/Controllers/ClientControllerCollectionTests.cs +++ b/src/Yavsc.Org.Tests/Controllers/ClientControllerCollectionTests.cs @@ -1,8 +1,11 @@ using System.Net; +using System.Net.Http; +using System.Threading.Tasks; using IdentityServer8.EntityFramework.Entities; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +using Xunit; using Yavsc.Models; using Yavsc.Tests.Shared; diff --git a/src/Yavsc.Org.Tests/Controllers/CommandFormsControllerTests.cs b/src/Yavsc.Org.Tests/Controllers/CommandFormsControllerTests.cs index 462d6fca..953ac43c 100644 --- a/src/Yavsc.Org.Tests/Controllers/CommandFormsControllerTests.cs +++ b/src/Yavsc.Org.Tests/Controllers/CommandFormsControllerTests.cs @@ -1,5 +1,8 @@ using System.Net; +using System.Net.Http; +using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Testing; +using Xunit; using Yavsc.Tests.Shared; namespace Yavsc.Org.Tests.Controllers; diff --git a/src/Yavsc.Org.Tests/Controllers/TestWebApplicationFactoryIsolationTests.cs b/src/Yavsc.Org.Tests/Controllers/TestWebApplicationFactoryIsolationTests.cs deleted file mode 100644 index ec86ffe8..00000000 --- a/src/Yavsc.Org.Tests/Controllers/TestWebApplicationFactoryIsolationTests.cs +++ /dev/null @@ -1,68 +0,0 @@ -using IdentityServer8.EntityFramework.DbContexts; -using IdentityServer8.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace Yavsc.Org.Tests.Controllers; - -/// -/// Regression sentinel: two -/// instances must not see each other's clients. -/// -/// EF Core's UseInMemoryDatabase(name) returns the same -/// backing store to every DbContext that asks for it under -/// the same name, in the same process. Before the per-fixture GUID -/// fix, both and -/// used the bare "InMemory" -/// connection string, so every fixture shared one store and tests -/// were silently order-dependent. -/// -/// We assert against directly -/// rather than via IClientStore: the validating wrapper around -/// IClientStore raises events through IEventService, -/// which is not registered in the test host and crashes with a -/// NullReferenceException before it can return a result. Going -/// straight to the DbContext is the same code path the production -/// code uses, so it is the right surface to assert against. -/// -public class TestWebApplicationFactoryIsolationTests -{ - [Fact] - public async Task Second_factory_does_not_see_clients_seeded_into_first() - { - var marker = $"marker-A-{Guid.NewGuid():N}"; - - // First factory: seed a distinctive client. - using (var first = new TestWebApplicationFactory()) - { - await using var scope = first.Services.CreateAsyncScope(); - var configDb = scope.ServiceProvider.GetRequiredService(); - var firstCs = scope.ServiceProvider.GetRequiredService() - .GetConnectionString("YavscConnection"); - Assert.StartsWith("InMemory-", firstCs); - configDb.Clients.Add(new Client { ClientId = marker, ClientName = "marker-A" }); - await configDb.SaveChangesAsync(TestContext.Current.CancellationToken); - - // Sanity: the first factory can see its own seed. - var seenByFirst = await configDb.Clients - .AsNoTracking() - .AnyAsync(c => c.ClientId == marker, TestContext.Current.CancellationToken); - Assert.True(seenByFirst); - } - - // Second factory: must start from a clean slate. If the - // in-memory store leaked from the first factory, this - // assertion fails. - using var second = new TestWebApplicationFactory(); - await using var secondScope = second.Services.CreateAsyncScope(); - var secondCs = secondScope.ServiceProvider.GetRequiredService() - .GetConnectionString("YavscConnection"); - Assert.StartsWith("InMemory-", secondCs); - var secondDb = secondScope.ServiceProvider.GetRequiredService(); - var seenBySecond = await secondDb.Clients - .AsNoTracking() - .AnyAsync(c => c.ClientId == marker, TestContext.Current.CancellationToken); - Assert.False(seenBySecond); - } -} diff --git a/src/Yavsc.Org.Tests/EstimateSignatureFileHelperTests.cs b/src/Yavsc.Org.Tests/EstimateSignatureFileHelperTests.cs index 69009432..9de881af 100644 --- a/src/Yavsc.Org.Tests/EstimateSignatureFileHelperTests.cs +++ b/src/Yavsc.Org.Tests/EstimateSignatureFileHelperTests.cs @@ -1,5 +1,11 @@ +using System; +using System.IO; using System.Security.Claims; using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Xunit; +using Yavsc.Models; using Yavsc.Models.Billing; using Yavsc.Server.Helpers; using Yavsc.Server.Models.FileSystem; @@ -91,13 +97,9 @@ public class EstimateSignatureFileHelperTests : IDisposable public async Task ReceiveEstimateSignatureAsync_rejects_null_payload() { var user = MakeUser("bob"); - // Capture TestContext.Current.CancellationToken outside the - // lambda so xUnit1051 sees a real CancellationToken argument - // (the lambda body runs on a different stack frame). - var ct = TestContext.Current.CancellationToken; await Assert.ThrowsAsync(() => EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync( - user, 1L, SignatureType.Pro, payload: null!, token: ct)); + user, 1L, SignatureType.Pro, payload: null!)); } [Fact] @@ -105,10 +107,9 @@ public class EstimateSignatureFileHelperTests : IDisposable { var user = MakeUser("bob"); var payload = new SignaturePadPayload { Strokes = new[] { 1, 100, 100 } }; - var ct = TestContext.Current.CancellationToken; await Assert.ThrowsAsync(() => EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync( - user, 0L, SignatureType.Pro, payload, token: ct)); + user, 0L, SignatureType.Pro, payload)); } // --- helpers ---------------------------------------------------- diff --git a/src/Yavsc.Org.Tests/NonRegression/ApplicationUserDisplayTemplateTests.cs b/src/Yavsc.Org.Tests/NonRegression/ApplicationUserDisplayTemplateTests.cs index e0f8e9bf..9fed6a15 100644 --- a/src/Yavsc.Org.Tests/NonRegression/ApplicationUserDisplayTemplateTests.cs +++ b/src/Yavsc.Org.Tests/NonRegression/ApplicationUserDisplayTemplateTests.cs @@ -1,3 +1,6 @@ +using System.IO; +using Xunit; + namespace Yavsc.Org.Tests.NonRegression; /// diff --git a/src/Yavsc.Org.Tests/NonRegression/BillingServiceTests.cs b/src/Yavsc.Org.Tests/NonRegression/BillingServiceTests.cs index 261308a2..bf40438a 100644 --- a/src/Yavsc.Org.Tests/NonRegression/BillingServiceTests.cs +++ b/src/Yavsc.Org.Tests/NonRegression/BillingServiceTests.cs @@ -1,7 +1,10 @@ using Microsoft.EntityFrameworkCore; +using Xunit; +using Yavsc; using Yavsc.Abstract.Workflow; using Yavsc.Helpers; using Yavsc.Models; +using Yavsc.Models.Billing; using Yavsc.Models.Haircut; using Yavsc.Services; diff --git a/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs b/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs index 5bf46a30..af449ae7 100644 --- a/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs +++ b/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs @@ -1,3 +1,5 @@ +using Xunit; + namespace Yavsc { /// diff --git a/src/Yavsc.Org.Tests/NonRegression/UserDisplayHelpersTests.cs b/src/Yavsc.Org.Tests/NonRegression/UserDisplayHelpersTests.cs index c7c46db9..7543a42e 100644 --- a/src/Yavsc.Org.Tests/NonRegression/UserDisplayHelpersTests.cs +++ b/src/Yavsc.Org.Tests/NonRegression/UserDisplayHelpersTests.cs @@ -1,3 +1,5 @@ +using Xunit; +using Yavsc.Abstract; using Yavsc.Abstract.Identity; namespace Yavsc.Org.Tests.NonRegression; diff --git a/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs b/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs index c77a20ab..50f92d63 100644 --- a/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs +++ b/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs @@ -1,3 +1,6 @@ +using System.Threading.Tasks; +using Xunit; + namespace Yavsc.Org.Tests.Smoke; /// diff --git a/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs b/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs index 96650ba8..8aa95347 100644 --- a/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs +++ b/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs @@ -1,3 +1,6 @@ +using System.Threading.Tasks; +using Xunit; + namespace Yavsc.Org.Tests.Smoke; /// diff --git a/src/Yavsc.Org.Tests/Smoke/SmokeTestBase.cs b/src/Yavsc.Org.Tests/Smoke/SmokeTestBase.cs index 29fd9b46..1029effc 100644 --- a/src/Yavsc.Org.Tests/Smoke/SmokeTestBase.cs +++ b/src/Yavsc.Org.Tests/Smoke/SmokeTestBase.cs @@ -1,3 +1,8 @@ +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using Xunit; + namespace Yavsc.Org.Tests.Smoke; /// diff --git a/src/Yavsc.Org.Tests/StaticAssetsPathsTests.cs b/src/Yavsc.Org.Tests/StaticAssetsPathsTests.cs index fcc22e1c..01962268 100644 --- a/src/Yavsc.Org.Tests/StaticAssetsPathsTests.cs +++ b/src/Yavsc.Org.Tests/StaticAssetsPathsTests.cs @@ -1,3 +1,7 @@ +using System.IO; +using Xunit; +using Xunit.v3; + namespace Yavsc.Org.Tests; /// diff --git a/src/Yavsc.Org.Tests/TestUserMiddleware.cs b/src/Yavsc.Org.Tests/TestUserMiddleware.cs index 7117b2ed..b88a75e3 100644 --- a/src/Yavsc.Org.Tests/TestUserMiddleware.cs +++ b/src/Yavsc.Org.Tests/TestUserMiddleware.cs @@ -1,4 +1,6 @@ +using System.Linq; using System.Security.Claims; +using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Yavsc.Tests.Shared; diff --git a/src/Yavsc.Org.Tests/TestWebApplicationFactory.cs b/src/Yavsc.Org.Tests/TestWebApplicationFactory.cs index b85cba11..dfd6edea 100644 --- a/src/Yavsc.Org.Tests/TestWebApplicationFactory.cs +++ b/src/Yavsc.Org.Tests/TestWebApplicationFactory.cs @@ -21,54 +21,9 @@ namespace Yavsc.Org.Tests; /// so that User.GetUserId() /// in user code sees a logged-in identity derived from the same /// header. -/// -/// Each instance gets its own in-memory database, identified by a -/// GUID generated in the constructor. The connection string -/// (ConnectionStrings:YavscConnection) is set as an -/// environment variable (ConnectionStrings__YavscConnection) -/// in the constructor and unset in , so the -/// production AddIdentityDBAndStores registers DbContext -/// instances against this fixture's own store. Without this, the -/// "InMemory" connection string from -/// appsettings-org.Testing.json would route every -/// instance — and any -/// running in the same process — to -/// the same backing store, leaking state between fixtures. -/// -/// Env vars are used (rather than ConfigureAppConfiguration or -/// UseSetting) because WebApplicationFactory applies -/// those too late: Program.Main has already captured the -/// connection string in AddIdentityDBAndStores by the time -/// the test host's overrides take effect. Env vars are the last -/// provider added in AddConfiguration (see -/// Yavsc.Server/Helpers/ConfigHelpers.cs), so they win. /// public class TestWebApplicationFactory : WebApplicationFactory { - private readonly string _fixtureId = Guid.NewGuid().ToString("N"); - - // ASP.NET Core's environment-variable configuration provider uses - // the key ConnectionStrings__YavscConnection (double underscore - // for the section separator). Set it before the host starts so - // the per-fixture connection string wins over - // appsettings-org.Testing.json. We do NOT touch the appsettings - // file; env vars take precedence in the configuration pipeline - // (see AddConfiguration in Yavsc.Server/Helpers/ConfigHelpers.cs, - // which adds AddEnvironmentVariables last). - private static readonly object _envLock = new(); - private bool _envSet; - - public TestWebApplicationFactory() - { - lock (_envLock) - { - Environment.SetEnvironmentVariable( - "ConnectionStrings__YavscConnection", - InMemoryDatabaseName.For(_fixtureId)); - _envSet = true; - } - } - protected override void ConfigureWebHost(IWebHostBuilder builder) { // UseEnvironment("Testing") puts the host in a dedicated @@ -95,18 +50,4 @@ public class TestWebApplicationFactory : WebApplicationFactory services.AddTransient(); }); } - - protected override void Dispose(bool disposing) - { - if (disposing && _envSet) - { - lock (_envLock) - { - Environment.SetEnvironmentVariable( - "ConnectionStrings__YavscConnection", null); - _envSet = false; - } - } - base.Dispose(disposing); - } } diff --git a/src/Yavsc.Org.Tests/WebServerFixture.cs b/src/Yavsc.Org.Tests/WebServerFixture.cs index 4f736ecf..edfd87d9 100644 --- a/src/Yavsc.Org.Tests/WebServerFixture.cs +++ b/src/Yavsc.Org.Tests/WebServerFixture.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System.Net; using System.Net.Sockets; +using Yavsc; using Yavsc.Extensions; using Yavsc.Interfaces; using Yavsc.Models; @@ -42,17 +43,6 @@ public sealed class WebServerFixture : WebHostFixture { private static readonly int _httpsPort = GetAvailableLoopbackPort(); - // One in-memory database name for the whole process: WebHostFixture - // is a per-process singleton (see _app, _isInitialized, _sharedServices - // in the base class), so every WebServerFixture instance shares the - // same backing store. That is intentional — the "Yavsc Server" test - // collection groups tests that should see the same seeded state, and - // re-initialising the store per fixture would just regress the - // order-dependence we are trying to eliminate. The GUID still matters - // because TestWebApplicationFactory and WebServerFixture must not - // collide in the in-memory store; see InMemoryDatabaseName. - private static readonly string _fixtureId = Guid.NewGuid().ToString("N"); - protected override int HttpsPort => _httpsPort; private static IConfiguration? _sharedConfiguration; @@ -91,7 +81,7 @@ public sealed class WebServerFixture : WebHostFixture // that plus the in-memory overrides below. builder.AddConfiguration(null).AddInMemoryCollection(new Dictionary { - [$"ConnectionStrings:{Yavsc.Constants.YavscConnectionStringName}"] = InMemoryDatabaseName.For(_fixtureId), + [$"ConnectionStrings:{Yavsc.Constants.YavscConnectionStringName}"] = "InMemory", // SMTP test config: UserName non-null so MailSender // exercises the Authenticate branch — the // RecordingSmtpClient captures it. diff --git a/src/Yavsc.Org.Tests/Yavsc.Org.Tests.csproj b/src/Yavsc.Org.Tests/Yavsc.Org.Tests.csproj index 34de5bd8..88842cb4 100644 --- a/src/Yavsc.Org.Tests/Yavsc.Org.Tests.csproj +++ b/src/Yavsc.Org.Tests/Yavsc.Org.Tests.csproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory)\test.runsettings 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -89,4 +89,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Org/Contants.cs b/src/Yavsc.Org/Contants.cs index c4a5e8b1..c8d79d6d 100644 --- a/src/Yavsc.Org/Contants.cs +++ b/src/Yavsc.Org/Contants.cs @@ -1,6 +1,8 @@ namespace Yavsc.Org; +using IdentityServer8.EntityFramework.Entities; + public static class Constants { // ApiScopes seeded explicitly by EnsureDefaultApplicationScopes. diff --git a/src/Yavsc.Org/Controllers/Accounting/ExternalController.cs b/src/Yavsc.Org/Controllers/Accounting/ExternalController.cs index 11bf1684..1e0dd487 100644 --- a/src/Yavsc.Org/Controllers/Accounting/ExternalController.cs +++ b/src/Yavsc.Org/Controllers/Accounting/ExternalController.cs @@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Yavsc; using Yavsc.Extensions; using Yavsc.Interfaces; diff --git a/src/Yavsc.Org/Controllers/Accounting/UsersController.cs b/src/Yavsc.Org/Controllers/Accounting/UsersController.cs index a94157ee..cab06844 100644 --- a/src/Yavsc.Org/Controllers/Accounting/UsersController.cs +++ b/src/Yavsc.Org/Controllers/Accounting/UsersController.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/src/Yavsc.Org/Controllers/Administration/AdministrationController.cs b/src/Yavsc.Org/Controllers/Administration/AdministrationController.cs index 3abf8296..e2944e9e 100644 --- a/src/Yavsc.Org/Controllers/Administration/AdministrationController.cs +++ b/src/Yavsc.Org/Controllers/Administration/AdministrationController.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; using Yavsc.Abstract.Identity; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Server.Helpers; using Yavsc.ViewModels; diff --git a/src/Yavsc.Org/Controllers/Administration/ClientController.cs b/src/Yavsc.Org/Controllers/Administration/ClientController.cs index ed7e278e..ac3dc326 100644 --- a/src/Yavsc.Org/Controllers/Administration/ClientController.cs +++ b/src/Yavsc.Org/Controllers/Administration/ClientController.cs @@ -1,3 +1,4 @@ +using IdentityServer8.EntityFramework.DbContexts; using IdentityServer8.EntityFramework.Entities; using IdentityServer8.EntityFramework.Stores; using Microsoft.AspNetCore.Authorization; diff --git a/src/Yavsc.Org/Controllers/Administration/MailingTemplateController.cs b/src/Yavsc.Org/Controllers/Administration/MailingTemplateController.cs index 9be8b7c4..caaebc11 100644 --- a/src/Yavsc.Org/Controllers/Administration/MailingTemplateController.cs +++ b/src/Yavsc.Org/Controllers/Administration/MailingTemplateController.cs @@ -2,10 +2,12 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Yavsc.Models; +using Yavsc.Models.Calendar; using Yavsc.Server.Models.EMailing; using Microsoft.AspNetCore.Authorization; using Yavsc.Server.Settings; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Server.Models.Calendar; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Communicating/AnnouncesController.cs b/src/Yavsc.Org/Controllers/Communicating/AnnouncesController.cs index d2aefcdb..f8b41c99 100644 --- a/src/Yavsc.Org/Controllers/Communicating/AnnouncesController.cs +++ b/src/Yavsc.Org/Controllers/Communicating/AnnouncesController.cs @@ -1,9 +1,11 @@ +using System.Threading.Tasks; using Yavsc.ViewModels.Auth; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Yavsc.Models; using Yavsc.Models.Messaging; using Microsoft.Extensions.Localization; +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Communicating/CircleController.cs b/src/Yavsc.Org/Controllers/Communicating/CircleController.cs index d4110047..8a19ba6b 100644 --- a/src/Yavsc.Org/Controllers/Communicating/CircleController.cs +++ b/src/Yavsc.Org/Controllers/Communicating/CircleController.cs @@ -2,6 +2,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Relationship; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Communicating/CircleMembersController.cs b/src/Yavsc.Org/Controllers/Communicating/CircleMembersController.cs index a64a1cf7..2710c7cd 100644 --- a/src/Yavsc.Org/Controllers/Communicating/CircleMembersController.cs +++ b/src/Yavsc.Org/Controllers/Communicating/CircleMembersController.cs @@ -3,6 +3,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Relationship; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Communicating/NotificationsController.cs b/src/Yavsc.Org/Controllers/Communicating/NotificationsController.cs index 05df7f55..5a3c25de 100644 --- a/src/Yavsc.Org/Controllers/Communicating/NotificationsController.cs +++ b/src/Yavsc.Org/Controllers/Communicating/NotificationsController.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Yavsc.Abstract.Models.Messaging; +using Yavsc.Helpers; using Yavsc.Models; +using Yavsc.Models.Messaging; using Yavsc.Server.Helpers; namespace Yavsc.Controllers diff --git a/src/Yavsc.Org/Controllers/Consent/ConsentController.cs b/src/Yavsc.Org/Controllers/Consent/ConsentController.cs index b11ce511..b7b6eff8 100644 --- a/src/Yavsc.Org/Controllers/Consent/ConsentController.cs +++ b/src/Yavsc.Org/Controllers/Consent/ConsentController.cs @@ -8,9 +8,15 @@ using IdentityServer8.Services; using IdentityServer8.Extensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System.Linq; +using System.Threading.Tasks; using IdentityServer8.Validation; +using System.Collections.Generic; +using System; using Yavsc; using Yavsc.Extensions; +using Yavsc.Models; namespace IdentityServerHost.Quickstart.UI { diff --git a/src/Yavsc.Org/Controllers/Consent/ConsentInputModel.cs b/src/Yavsc.Org/Controllers/Consent/ConsentInputModel.cs index 9eb30853..f608fe3b 100644 --- a/src/Yavsc.Org/Controllers/Consent/ConsentInputModel.cs +++ b/src/Yavsc.Org/Controllers/Consent/ConsentInputModel.cs @@ -1,6 +1,9 @@ // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + +using System.Collections.Generic; + namespace IdentityServerHost.Quickstart.UI { public class ConsentInputModel @@ -11,4 +14,4 @@ namespace IdentityServerHost.Quickstart.UI public string ReturnUrl { get; set; } public string Description { get; set; } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Org/Controllers/Consent/ConsentViewModel.cs b/src/Yavsc.Org/Controllers/Consent/ConsentViewModel.cs index 3d157578..af4b9c5c 100644 --- a/src/Yavsc.Org/Controllers/Consent/ConsentViewModel.cs +++ b/src/Yavsc.Org/Controllers/Consent/ConsentViewModel.cs @@ -1,6 +1,9 @@ // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + +using System.Collections.Generic; + namespace IdentityServerHost.Quickstart.UI { public class ConsentViewModel : ConsentInputModel diff --git a/src/Yavsc.Org/Controllers/Contracting/CoWorkingController.cs b/src/Yavsc.Org/Controllers/Contracting/CoWorkingController.cs index f719085c..0d173df5 100644 --- a/src/Yavsc.Org/Controllers/Contracting/CoWorkingController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/CoWorkingController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Workflow; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Contracting/DoController.cs b/src/Yavsc.Org/Controllers/Contracting/DoController.cs index a62312c4..f0393a80 100644 --- a/src/Yavsc.Org/Controllers/Contracting/DoController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/DoController.cs @@ -11,6 +11,7 @@ namespace Yavsc.Controllers using Yavsc.ViewModels.Workflow; using Yavsc.Services; using System.Threading.Tasks; + using Yavsc.Helpers; using Microsoft.EntityFrameworkCore; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Contracting/EstimateController.cs b/src/Yavsc.Org/Controllers/Contracting/EstimateController.cs index 5dbd882b..bbcc89fc 100644 --- a/src/Yavsc.Org/Controllers/Contracting/EstimateController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/EstimateController.cs @@ -2,6 +2,7 @@ using System.Net.Mime; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Yavsc.Helpers; namespace Yavsc.Controllers { diff --git a/src/Yavsc.Org/Controllers/Contracting/FormsController.cs b/src/Yavsc.Org/Controllers/Contracting/FormsController.cs index 423cf2f4..e7243022 100644 --- a/src/Yavsc.Org/Controllers/Contracting/FormsController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/FormsController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Forms; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Contracting/MusicalTendenciesController.cs b/src/Yavsc.Org/Controllers/Contracting/MusicalTendenciesController.cs index ee8d40e7..ca7996a3 100644 --- a/src/Yavsc.Org/Controllers/Contracting/MusicalTendenciesController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/MusicalTendenciesController.cs @@ -4,6 +4,7 @@ namespace Yavsc.Controllers { using Models; using Models.Musical; + using Yavsc.Helpers; using Yavsc.Server.Helpers; public class MusicalTendenciesController : Controller diff --git a/src/Yavsc.Org/Controllers/Contracting/SIRENExceptionsController.cs b/src/Yavsc.Org/Controllers/Contracting/SIRENExceptionsController.cs index bf08484e..baa7f060 100644 --- a/src/Yavsc.Org/Controllers/Contracting/SIRENExceptionsController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/SIRENExceptionsController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Billing; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Device/DeviceController.cs b/src/Yavsc.Org/Controllers/Device/DeviceController.cs index 0a10e28f..2e516aa6 100644 --- a/src/Yavsc.Org/Controllers/Device/DeviceController.cs +++ b/src/Yavsc.Org/Controllers/Device/DeviceController.cs @@ -2,6 +2,10 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using IdentityServer8.Configuration; using IdentityServer8.Events; using IdentityServer8.Extensions; @@ -10,6 +14,7 @@ using IdentityServer8.Services; using IdentityServer8.Validation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Yavsc.Models; using Yavsc.Models.Access; diff --git a/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsController.cs b/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsController.cs index 65870f85..ffdfb78d 100644 --- a/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsController.cs +++ b/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsController.cs @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using System.Linq; +using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsViewModel.cs b/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsViewModel.cs index b50d5c48..d88cbc5e 100644 --- a/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsViewModel.cs +++ b/src/Yavsc.Org/Controllers/Diagnostics/DiagnosticsViewModel.cs @@ -5,6 +5,7 @@ using IdentityModel; using Microsoft.AspNetCore.Authentication; using Newtonsoft.Json; +using System.Collections.Generic; using System.Text; namespace Yavsc.Models diff --git a/src/Yavsc.Org/Controllers/DimissClicksApiController.cs b/src/Yavsc.Org/Controllers/DimissClicksApiController.cs index 56fec223..b07bc4b3 100644 --- a/src/Yavsc.Org/Controllers/DimissClicksApiController.cs +++ b/src/Yavsc.Org/Controllers/DimissClicksApiController.cs @@ -2,6 +2,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Messaging; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/FileSystemController.cs b/src/Yavsc.Org/Controllers/FileSystemController.cs index e4f18b39..84579675 100644 --- a/src/Yavsc.Org/Controllers/FileSystemController.cs +++ b/src/Yavsc.Org/Controllers/FileSystemController.cs @@ -1,4 +1,6 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Yavsc.Helpers; using Yavsc.Server.Helpers; namespace Yavsc.Controllers diff --git a/src/Yavsc.Org/Controllers/GrantsController.cs b/src/Yavsc.Org/Controllers/GrantsController.cs index ad5627ed..225b7f5b 100644 --- a/src/Yavsc.Org/Controllers/GrantsController.cs +++ b/src/Yavsc.Org/Controllers/GrantsController.cs @@ -5,6 +5,9 @@ using IdentityServer8.Services; using IdentityServer8.Stores; using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using IdentityServer8.Events; using IdentityServer8.Extensions; diff --git a/src/Yavsc.Org/Controllers/Haircut/ColorsController.cs b/src/Yavsc.Org/Controllers/Haircut/ColorsController.cs index 6beaa561..ef390f84 100644 --- a/src/Yavsc.Org/Controllers/Haircut/ColorsController.cs +++ b/src/Yavsc.Org/Controllers/Haircut/ColorsController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Drawing; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Haircut/HairTaintsController.cs b/src/Yavsc.Org/Controllers/Haircut/HairTaintsController.cs index 7885720a..a0a25246 100644 --- a/src/Yavsc.Org/Controllers/Haircut/HairTaintsController.cs +++ b/src/Yavsc.Org/Controllers/Haircut/HairTaintsController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Haircut; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Kyc/DeclarantController.cs b/src/Yavsc.Org/Controllers/Kyc/DeclarantController.cs index 491d378d..9f4933d1 100644 --- a/src/Yavsc.Org/Controllers/Kyc/DeclarantController.cs +++ b/src/Yavsc.Org/Controllers/Kyc/DeclarantController.cs @@ -1,6 +1,7 @@ // Yavsc.Controllers.Kyc/DeclarantController.cs namespace Yavsc.Controllers.Kyc { + using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; diff --git a/src/Yavsc.Org/Controllers/Musical/InstrumentationController.cs b/src/Yavsc.Org/Controllers/Musical/InstrumentationController.cs index 70faa88b..536c7417 100644 --- a/src/Yavsc.Org/Controllers/Musical/InstrumentationController.cs +++ b/src/Yavsc.Org/Controllers/Musical/InstrumentationController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Models.Musical.Profiles; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Org/Controllers/Musical/InstrumentsController.cs b/src/Yavsc.Org/Controllers/Musical/InstrumentsController.cs index 84c9590b..7c0d6cb3 100644 --- a/src/Yavsc.Org/Controllers/Musical/InstrumentsController.cs +++ b/src/Yavsc.Org/Controllers/Musical/InstrumentsController.cs @@ -1,9 +1,12 @@ +using System.Linq; using Microsoft.AspNetCore.Mvc; namespace Yavsc.Controllers { + using System.Security.Claims; using Models; using Models.Musical; + using Yavsc.Helpers; using Yavsc.Server.Helpers; public class InstrumentsController : Controller diff --git a/src/Yavsc.Org/CustomModelBinder.cs b/src/Yavsc.Org/CustomModelBinder.cs index ef1454b0..c12084c5 100644 --- a/src/Yavsc.Org/CustomModelBinder.cs +++ b/src/Yavsc.Org/CustomModelBinder.cs @@ -1,4 +1,6 @@ +using System; using System.Globalization; +using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace Yavsc @@ -35,7 +37,7 @@ namespace Yavsc bindingContext.Result = ModelBindingResult.Success(actualValue); } else bindingContext.Result = ModelBindingResult.Failed(); - + } } } diff --git a/src/Yavsc.Org/Extensions/HostingExtensions.cs b/src/Yavsc.Org/Extensions/HostingExtensions.cs index 6528b9c6..f92dc3c9 100644 --- a/src/Yavsc.Org/Extensions/HostingExtensions.cs +++ b/src/Yavsc.Org/Extensions/HostingExtensions.cs @@ -169,20 +169,10 @@ public static class HostingExtensions public static IdentityBuilder AddIdentityDBAndStores(this WebApplicationBuilder builder) { IServiceCollection services = builder.Services; + var connectionString = builder.Configuration.GetConnectionString(Constants.YavscConnectionStringName); - services.AddDbContext((sp, options) => + services.AddDbContext(options => { - // Read the connection string at DbContext construction time - // rather than at AddDbContext registration time, so test - // fixtures (e.g. WebApplicationFactory) can - // override the value via the host's IConfiguration before - // any DbContext is built. Reading it eagerly at the top of - // this method would freeze whatever was in configuration - // when Program.Main ran — too early for the test host's - // ConfigureAppConfiguration / UseSetting hooks to apply. - var connectionString = sp.GetRequiredService() - .GetConnectionString(Constants.YavscConnectionStringName); - if (UsesInMemoryProvider(connectionString)) { options.UseInMemoryDatabase(connectionString); @@ -327,21 +317,10 @@ public static class HostingExtensions options.ClaimsIdentity.RoleClaimType = Constants.RoleClaimType; }); var migrationsAssembly = typeof(Program).GetTypeInfo().Assembly.GetName().Name; - - // The IdentityServer8.EntityFramework ConfigurationStoreOptions - // and OperationalStoreOptions expose ConfigureDbContext as an - // Action with no service-provider - // access, so the connection string has to be captured here at - // registration time. For the production runtime this is fine: - // the connection string does not change after startup. For - // tests, this is the one knob we cannot push into the per-fixture - // config pipeline; the TestWebApplicationFactory bridge instead - // sets ConnectionStrings__YavscConnection as an environment - // variable, which AddEnvironmentVariables picks up as the last - // configuration provider in AddConfiguration. See - // Yavsc.Server/Helpers/ConfigHelpers.cs. var connectionString = builder.Configuration.GetConnectionString(Constants.YavscConnectionStringName); + string sqliteConnectionString = $"Data Source={Path.Combine(Path.GetTempPath(), "yavsc_test.db")}"; + var identityServerBuilder = builder.Services.AddIdentityServer(options => { options.Events.RaiseErrorEvents = true; @@ -621,13 +600,7 @@ public static class HostingExtensions private static bool UsesInMemoryProvider(string connectionString) { - // Test fixtures may suffix the connection string with a - // per-fixture GUID (see InMemoryDatabaseName in - // Yavsc.Tests.Shared) to keep their in-memory stores - // isolated. The base name "InMemory" is still what - // identifies an in-memory provider — anything starting - // with it is one. - return connectionString.StartsWith(InMemoryProviderName, StringComparison.OrdinalIgnoreCase); + return string.Equals(connectionString, InMemoryProviderName, StringComparison.OrdinalIgnoreCase); } private static Action EnsureDefaultApplicationScopes() diff --git a/src/Yavsc.Org/Helpers/Ansi2HtmlEncoder.cs b/src/Yavsc.Org/Helpers/Ansi2HtmlEncoder.cs index fb832a5d..61f8c51b 100644 --- a/src/Yavsc.Org/Helpers/Ansi2HtmlEncoder.cs +++ b/src/Yavsc.Org/Helpers/Ansi2HtmlEncoder.cs @@ -3,7 +3,9 @@ // paul schneider 19/06/2018 15:58 20182018 6 19 // */ +using System.IO; using System.Diagnostics; +using System.Threading.Tasks; namespace Yavsc.Helpers { diff --git a/src/Yavsc.Org/Helpers/ControllerHelpers.cs b/src/Yavsc.Org/Helpers/ControllerHelpers.cs index 9f92c9e7..07937e4a 100644 --- a/src/Yavsc.Org/Helpers/ControllerHelpers.cs +++ b/src/Yavsc.Org/Helpers/ControllerHelpers.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Yavsc.Abstract.Models.Messaging; diff --git a/src/Yavsc.Org/Helpers/ListItemHelpers.cs b/src/Yavsc.Org/Helpers/ListItemHelpers.cs index ea81e24e..a9101622 100644 --- a/src/Yavsc.Org/Helpers/ListItemHelpers.cs +++ b/src/Yavsc.Org/Helpers/ListItemHelpers.cs @@ -1,3 +1,6 @@ + +using System.Collections.Generic; +using System.Linq; using Microsoft.AspNetCore.Mvc.Rendering; using Yavsc.Models; using Yavsc.Models.Workflow; diff --git a/src/Yavsc.Org/Helpers/OAuthHelpers.cs b/src/Yavsc.Org/Helpers/OAuthHelpers.cs index 668d720e..efd3942b 100644 --- a/src/Yavsc.Org/Helpers/OAuthHelpers.cs +++ b/src/Yavsc.Org/Helpers/OAuthHelpers.cs @@ -1,3 +1,4 @@ +using System; using System.Security.Cryptography; namespace Yavsc.Helpers { diff --git a/src/Yavsc.Org/Helpers/PageHelpers.cs b/src/Yavsc.Org/Helpers/PageHelpers.cs index 4258565a..c094495e 100644 --- a/src/Yavsc.Org/Helpers/PageHelpers.cs +++ b/src/Yavsc.Org/Helpers/PageHelpers.cs @@ -1,5 +1,8 @@ +using System; +using System.Collections.Generic; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.Localization; namespace Yavsc.Server.Helpers diff --git a/src/Yavsc.Org/Helpers/TeXHelpers.cs b/src/Yavsc.Org/Helpers/TeXHelpers.cs index daacb741..9e7ed330 100644 --- a/src/Yavsc.Org/Helpers/TeXHelpers.cs +++ b/src/Yavsc.Org/Helpers/TeXHelpers.cs @@ -1,4 +1,7 @@ +using System; using System.Diagnostics; +using System.IO; +using System.Linq; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/src/Yavsc.Org/Migrations/20260309015232_init.cs b/src/Yavsc.Org/Migrations/20260309015232_init.cs index 8780da0d..894d57cb 100644 --- a/src/Yavsc.Org/Migrations/20260309015232_init.cs +++ b/src/Yavsc.Org/Migrations/20260309015232_init.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Yavsc.Org/Migrations/20260604103455_pending.cs b/src/Yavsc.Org/Migrations/20260604103455_pending.cs index 1f34c294..5f9eb8b9 100644 --- a/src/Yavsc.Org/Migrations/20260604103455_pending.cs +++ b/src/Yavsc.Org/Migrations/20260604103455_pending.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Yavsc.Org/Migrations/20260706013420_activityModerated.cs b/src/Yavsc.Org/Migrations/20260706013420_activityModerated.cs index d99d3296..79e4000d 100644 --- a/src/Yavsc.Org/Migrations/20260706013420_activityModerated.cs +++ b/src/Yavsc.Org/Migrations/20260706013420_activityModerated.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Yavsc.Org/Migrations/ConfigurationDb/20260301200548_init.cs b/src/Yavsc.Org/Migrations/ConfigurationDb/20260301200548_init.cs index df95a443..a8261311 100644 --- a/src/Yavsc.Org/Migrations/ConfigurationDb/20260301200548_init.cs +++ b/src/Yavsc.Org/Migrations/ConfigurationDb/20260301200548_init.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Yavsc.Org/Migrations/PersistedGrantDb/20260301200508_init.cs b/src/Yavsc.Org/Migrations/PersistedGrantDb/20260301200508_init.cs index b1297867..0c240b20 100644 --- a/src/Yavsc.Org/Migrations/PersistedGrantDb/20260301200508_init.cs +++ b/src/Yavsc.Org/Migrations/PersistedGrantDb/20260301200508_init.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Yavsc.Org/Program.cs b/src/Yavsc.Org/Program.cs index 7f8e38b1..a0ef57d3 100644 --- a/src/Yavsc.Org/Program.cs +++ b/src/Yavsc.Org/Program.cs @@ -1,3 +1,5 @@ +using Anthropic.SDK; +using Yavsc.Abstract.Interfaces; using Yavsc.Extensions; using Yavsc.Server.Helpers; @@ -16,6 +18,6 @@ namespace Yavsc app.Run(); } - + } -} +} \ No newline at end of file diff --git a/src/Yavsc.Org/Services/BlogSpotService.cs b/src/Yavsc.Org/Services/BlogSpotService.cs index 7eac07a1..5a47e85e 100644 --- a/src/Yavsc.Org/Services/BlogSpotService.cs +++ b/src/Yavsc.Org/Services/BlogSpotService.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; +using Yavsc; using Yavsc.Blogspot; using Yavsc.Models; using Yavsc.Models.Blog; diff --git a/src/Yavsc.Org/Services/ChatHubConnexionManager.cs b/src/Yavsc.Org/Services/ChatHubConnexionManager.cs index a9782661..43365366 100644 --- a/src/Yavsc.Org/Services/ChatHubConnexionManager.cs +++ b/src/Yavsc.Org/Services/ChatHubConnexionManager.cs @@ -1,5 +1,13 @@ + +using System; using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Input; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Logging; using Yavsc.Abstract.Chat; using Yavsc.Models; using Yavsc.ViewModels.Chat; diff --git a/src/Yavsc.Org/Services/YavscTemplateEngine.cs b/src/Yavsc.Org/Services/YavscTemplateEngine.cs index 904f203a..9b29d853 100644 --- a/src/Yavsc.Org/Services/YavscTemplateEngine.cs +++ b/src/Yavsc.Org/Services/YavscTemplateEngine.cs @@ -10,9 +10,15 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Emit; using Yavsc.Models; +using Yavsc.Services; +using System.Reflection; using Yavsc.Abstract.Templates; using Microsoft.AspNetCore.Identity; +using RazorEngine.Configuration; +using Yavsc.Interface; +using Microsoft.Extensions.Logging; using System.Diagnostics; +using RazorEngine.Compilation.ImpromptuInterface.Optimization; using RazorEngine.Compilation.ImpromptuInterface; namespace Yavsc.Lib @@ -24,7 +30,7 @@ namespace Yavsc.Lib "Yavsc.Templates" , "Yavsc.Models", "Yavsc.Models.Identity"}; - + readonly IStringLocalizer stringLocalizer; readonly ApplicationDbContext dbContext; @@ -138,14 +144,14 @@ namespace Yavsc.Lib var template = result.CallActLike(user); return template.GeneratedText; } - + /* result.CallActLike<> inMemoryAssembly.Seek(0, SeekOrigin.Begin); Assembly assembly = Assembly.Load(inMemoryAssembly.ToArray()); // UserOrientedTemplate userOrientedTemplate = (UserOrientedTemplate) // FIXME Activator.CreateInstance(Type.GetType(templateInfo.TemplateType)); - + foreach (var user in dbContext.ApplicationUser.Where( u => u.AllowMonthlyEmail )) @@ -154,7 +160,7 @@ namespace Yavsc.Lib userOrientedTemplate.Init(); userOrientedTemplate.User = user; */ throw new NotImplementedException(); - + } } } diff --git a/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs b/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs index 9b0fd6a0..ed8b7acd 100644 --- a/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs +++ b/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs @@ -1,4 +1,7 @@ +using System; +using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Yavsc.Models; using Yavsc.Services; namespace Yavsc.ViewComponents diff --git a/src/Yavsc.Org/ViewComponents/CirclesControlViewComponent.cs b/src/Yavsc.Org/ViewComponents/CirclesControlViewComponent.cs index 58aab3b8..c7af7c86 100644 --- a/src/Yavsc.Org/ViewComponents/CirclesControlViewComponent.cs +++ b/src/Yavsc.Org/ViewComponents/CirclesControlViewComponent.cs @@ -1,3 +1,4 @@ +using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/src/Yavsc.Org/ViewComponents/CommentViewComponent.cs b/src/Yavsc.Org/ViewComponents/CommentViewComponent.cs index 6f85a953..62d3bb7a 100644 --- a/src/Yavsc.Org/ViewComponents/CommentViewComponent.cs +++ b/src/Yavsc.Org/ViewComponents/CommentViewComponent.cs @@ -1,7 +1,9 @@ +using System.Diagnostics; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Localization; using Yavsc.Models; +using Yavsc.Models.Blog; namespace Yavsc.ViewComponents { diff --git a/src/Yavsc.Org/ViewComponents/DirectoryViewComponent.cs b/src/Yavsc.Org/ViewComponents/DirectoryViewComponent.cs index fea78afb..af7f436b 100644 --- a/src/Yavsc.Org/ViewComponents/DirectoryViewComponent.cs +++ b/src/Yavsc.Org/ViewComponents/DirectoryViewComponent.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Server.Helpers; using Yavsc.ViewModels.UserFiles; diff --git a/src/Yavsc.Org/ViewComponents/TaggerComponent.cs b/src/Yavsc.Org/ViewComponents/TaggerComponent.cs index d9f26e60..94655237 100644 --- a/src/Yavsc.Org/ViewComponents/TaggerComponent.cs +++ b/src/Yavsc.Org/ViewComponents/TaggerComponent.cs @@ -1,6 +1,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Logging; using Yavsc.Interfaces; +using Yavsc.Models; namespace Yavsc.ViewComponents { diff --git a/src/Yavsc.Org/ViewModels/Account/SendCodeViewModel.cs b/src/Yavsc.Org/ViewModels/Account/SendCodeViewModel.cs index ea4dfba5..a10bda89 100644 --- a/src/Yavsc.Org/ViewModels/Account/SendCodeViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Account/SendCodeViewModel.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Rendering; namespace Yavsc.ViewModels.Account diff --git a/src/Yavsc.Org/ViewModels/Administration/EnrolerViewModel.cs b/src/Yavsc.Org/ViewModels/Administration/EnrolerViewModel.cs index 471a080e..1963e357 100644 --- a/src/Yavsc.Org/ViewModels/Administration/EnrolerViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Administration/EnrolerViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels { diff --git a/src/Yavsc.Org/ViewModels/Administration/FireViewModel.cs b/src/Yavsc.Org/ViewModels/Administration/FireViewModel.cs index 53b63bad..52230137 100644 --- a/src/Yavsc.Org/ViewModels/Administration/FireViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Administration/FireViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels { diff --git a/src/Yavsc.Org/ViewModels/Gen/PdfGenerationViewModel.cs b/src/Yavsc.Org/ViewModels/Gen/PdfGenerationViewModel.cs index fe934e3a..cbc99b0a 100644 --- a/src/Yavsc.Org/ViewModels/Gen/PdfGenerationViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Gen/PdfGenerationViewModel.cs @@ -1,5 +1,7 @@ using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Mvc.Rendering; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Gen { diff --git a/src/Yavsc.Org/ViewModels/Manage/ConfigureTwoFactorViewModel.cs b/src/Yavsc.Org/ViewModels/Manage/ConfigureTwoFactorViewModel.cs index 57212785..685d11be 100644 --- a/src/Yavsc.Org/ViewModels/Manage/ConfigureTwoFactorViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Manage/ConfigureTwoFactorViewModel.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Rendering; namespace Yavsc.ViewModels.Manage diff --git a/src/Yavsc.Org/ViewModels/Manage/IndexViewModel.cs b/src/Yavsc.Org/ViewModels/Manage/IndexViewModel.cs index 03cc42d8..b54bebcc 100644 --- a/src/Yavsc.Org/ViewModels/Manage/IndexViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Manage/IndexViewModel.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.AspNetCore.Identity; namespace Yavsc.ViewModels.Manage diff --git a/src/Yavsc.Org/ViewModels/Manage/ManageLoginsViewModel.cs b/src/Yavsc.Org/ViewModels/Manage/ManageLoginsViewModel.cs index 2b77adcd..d29107c3 100644 --- a/src/Yavsc.Org/ViewModels/Manage/ManageLoginsViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Manage/ManageLoginsViewModel.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.AspNetCore.Identity; namespace Yavsc.ViewModels.Manage diff --git a/src/Yavsc.Org/ViewModels/Manage/SetUserNameViewModel.cs b/src/Yavsc.Org/ViewModels/Manage/SetUserNameViewModel.cs index 9cef1603..61cf0727 100644 --- a/src/Yavsc.Org/ViewModels/Manage/SetUserNameViewModel.cs +++ b/src/Yavsc.Org/ViewModels/Manage/SetUserNameViewModel.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Manage { diff --git a/src/Yavsc.Org/Yavsc.Org.csproj b/src/Yavsc.Org/Yavsc.Org.csproj index aeb94a8e..ccdb7f24 100644 --- a/src/Yavsc.Org/Yavsc.Org.csproj +++ b/src/Yavsc.Org/Yavsc.Org.csproj @@ -9,7 +9,7 @@ https://github.com/pazof/yavsc 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -54,4 +54,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Server/Exceptions/InvalidActivityModelException.cs b/src/Yavsc.Server/Exceptions/InvalidActivityModelException.cs index c2739d7c..5b3d086a 100644 --- a/src/Yavsc.Server/Exceptions/InvalidActivityModelException.cs +++ b/src/Yavsc.Server/Exceptions/InvalidActivityModelException.cs @@ -1,3 +1,4 @@ +using System; namespace Yavsc.Exceptions { public class InvalidWorkflowModelException : Exception diff --git a/src/Yavsc.Server/Exceptions/InvalidPathException.cs b/src/Yavsc.Server/Exceptions/InvalidPathException.cs index ea64128c..d093d9ab 100644 --- a/src/Yavsc.Server/Exceptions/InvalidPathException.cs +++ b/src/Yavsc.Server/Exceptions/InvalidPathException.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Exceptions { public class InvalidPathException: Exception diff --git a/src/Yavsc.Server/Helpers/CompanyInfoHelpers.cs b/src/Yavsc.Server/Helpers/CompanyInfoHelpers.cs index 2d007b4a..01a35a75 100644 --- a/src/Yavsc.Server/Helpers/CompanyInfoHelpers.cs +++ b/src/Yavsc.Server/Helpers/CompanyInfoHelpers.cs @@ -1,3 +1,5 @@ +using System.Net.Http; +using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace Yavsc.Helpers diff --git a/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs b/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs index e2d40266..122b382c 100644 --- a/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs +++ b/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs @@ -1,7 +1,12 @@ +using System; +using System.IO; using System.Security.Claims; using System.Text; using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Yavsc.Models; using Yavsc.Models.Billing; using Yavsc.Server.Models.FileSystem; namespace Yavsc.Server.Helpers; diff --git a/src/Yavsc.Server/Helpers/FileSystemHelpers.cs b/src/Yavsc.Server/Helpers/FileSystemHelpers.cs index 91202727..f53ce0e8 100644 --- a/src/Yavsc.Server/Helpers/FileSystemHelpers.cs +++ b/src/Yavsc.Server/Helpers/FileSystemHelpers.cs @@ -4,10 +4,12 @@ using System.Security.Claims; using Microsoft.AspNetCore.Html; using Microsoft.Extensions.FileProviders; using Yavsc.Models; +using Yavsc.Models.FileSystem; using Yavsc.Models.Streaming; using Yavsc.ViewModels; using Microsoft.AspNetCore.Http; using Yavsc.Exceptions; +using Yavsc.Helpers; using Yavsc.Abstract.Helpers; using ImageMagick; using Yavsc.Server.Models.FileSystem; diff --git a/src/Yavsc.Server/Helpers/PayPalHelpers.cs b/src/Yavsc.Server/Helpers/PayPalHelpers.cs index 9d4074d4..abd70849 100644 --- a/src/Yavsc.Server/Helpers/PayPalHelpers.cs +++ b/src/Yavsc.Server/Helpers/PayPalHelpers.cs @@ -1,11 +1,15 @@ +using System.Collections.Generic; + using Microsoft.Extensions.Logging; using Yavsc.Models.Billing; using Microsoft.AspNetCore.Http; +using System.Threading.Tasks; using Newtonsoft.Json; using PayPal.PayPalAPIInterfaceService.Model; using PayPal.PayPalAPIInterfaceService; using Yavsc.ViewModels.PayPal; using Yavsc.Models; +using System.Linq; using Yavsc.Models.Payment; using Microsoft.EntityFrameworkCore; diff --git a/src/Yavsc.Server/Helpers/RequestHelper.cs b/src/Yavsc.Server/Helpers/RequestHelper.cs index 1bdde9fe..9edbbbd8 100644 --- a/src/Yavsc.Server/Helpers/RequestHelper.cs +++ b/src/Yavsc.Server/Helpers/RequestHelper.cs @@ -1,5 +1,10 @@ +using System; +using System.Collections.Generic; +using System.IO; using System.Net; +using System.Net.Http; using System.Net.Http.Headers; +using System.Threading.Tasks; using Yavsc.Server.Model; namespace Yavsc.Server.Helpers diff --git a/src/Yavsc.Server/Helpers/ServiceExtensions.cs b/src/Yavsc.Server/Helpers/ServiceExtensions.cs index 2c421025..0ac1f135 100644 --- a/src/Yavsc.Server/Helpers/ServiceExtensions.cs +++ b/src/Yavsc.Server/Helpers/ServiceExtensions.cs @@ -1,6 +1,8 @@ using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; namespace Yavsc.Server.Helpers; diff --git a/src/Yavsc.Server/Helpers/SimpleJsonPostMethod.cs b/src/Yavsc.Server/Helpers/SimpleJsonPostMethod.cs index 83c8bca7..7de9d358 100644 --- a/src/Yavsc.Server/Helpers/SimpleJsonPostMethod.cs +++ b/src/Yavsc.Server/Helpers/SimpleJsonPostMethod.cs @@ -19,7 +19,10 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . using System.Net; +using System.IO; +using System.Threading.Tasks; using Newtonsoft.Json; +using System; namespace Yavsc.Server.Helpers { @@ -73,7 +76,7 @@ namespace Yavsc.Server.Helpers } return ans; } - + } } diff --git a/src/Yavsc.Server/Interfaces/IConnexionManager.cs b/src/Yavsc.Server/Interfaces/IConnexionManager.cs index 46374d40..1283b500 100644 --- a/src/Yavsc.Server/Interfaces/IConnexionManager.cs +++ b/src/Yavsc.Server/Interfaces/IConnexionManager.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using Yavsc.ViewModels.Chat; namespace Yavsc.Services diff --git a/src/Yavsc.Server/Interfaces/IDiskUsageTracker.cs b/src/Yavsc.Server/Interfaces/IDiskUsageTracker.cs index 15a2fe48..6066e94c 100644 --- a/src/Yavsc.Server/Interfaces/IDiskUsageTracker.cs +++ b/src/Yavsc.Server/Interfaces/IDiskUsageTracker.cs @@ -1,3 +1,6 @@ + +using System; + namespace Yavsc.Services { diff --git a/src/Yavsc.Server/Interfaces/IFreeDateSet.cs b/src/Yavsc.Server/Interfaces/IFreeDateSet.cs index 4e42e3c3..640248d3 100644 --- a/src/Yavsc.Server/Interfaces/IFreeDateSet.cs +++ b/src/Yavsc.Server/Interfaces/IFreeDateSet.cs @@ -17,6 +17,8 @@ // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; +using System.Collections.Generic; using Yavsc.Server.Models.Calendar; namespace Yavsc.Models.Calendar diff --git a/src/Yavsc.Server/Interfaces/ILiveProcessor.cs b/src/Yavsc.Server/Interfaces/ILiveProcessor.cs index 97636cd5..d2d7f21e 100644 --- a/src/Yavsc.Server/Interfaces/ILiveProcessor.cs +++ b/src/Yavsc.Server/Interfaces/ILiveProcessor.cs @@ -1,4 +1,5 @@ using System.Collections.Concurrent; +using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Yavsc.Models; using Yavsc.ViewModels.Streaming; diff --git a/src/Yavsc.Server/Interfaces/ISmsSender.cs b/src/Yavsc.Server/Interfaces/ISmsSender.cs index 2f3817a4..6f5ebf18 100644 --- a/src/Yavsc.Server/Interfaces/ISmsSender.cs +++ b/src/Yavsc.Server/Interfaces/ISmsSender.cs @@ -1,3 +1,6 @@ + +using System.Threading.Tasks; + namespace Yavsc.Services { public interface ISmsSender diff --git a/src/Yavsc.Server/Interfaces/ISmtpClient.cs b/src/Yavsc.Server/Interfaces/ISmtpClient.cs index 57b5cdcf..6692cdba 100644 --- a/src/Yavsc.Server/Interfaces/ISmtpClient.cs +++ b/src/Yavsc.Server/Interfaces/ISmtpClient.cs @@ -1,3 +1,5 @@ +using System.Threading; +using System.Threading.Tasks; using MimeKit; namespace Yavsc.Interfaces diff --git a/src/Yavsc.Server/Interfaces/IYavscMessageSender.cs b/src/Yavsc.Server/Interfaces/IYavscMessageSender.cs index 9d351ffd..9fcc4449 100644 --- a/src/Yavsc.Server/Interfaces/IYavscMessageSender.cs +++ b/src/Yavsc.Server/Interfaces/IYavscMessageSender.cs @@ -1,4 +1,7 @@ -using Yavsc.Interfaces.Workflow; + +using System.Collections.Generic; +using System.Threading.Tasks; +using Yavsc.Interfaces.Workflow; using Yavsc.Models.Google.Messaging; using Yavsc.Models.Haircut; using Yavsc.Models.Messaging; @@ -8,18 +11,18 @@ namespace Yavsc.Services public interface IYavscMessageSender { Task NotifyBookQueryAsync( - IEnumerable connectionIds, + IEnumerable connectionIds, RdvQueryEvent ev); Task NotifyEstimateAsync( - IEnumerable connectionIds, + IEnumerable connectionIds, EstimationEvent ev); Task NotifyHairCutQueryAsync( - IEnumerable connectionIds, + IEnumerable connectionIds, HairCutQueryEvent ev); Task NotifyAsync( - IEnumerable connectionIds, + IEnumerable connectionIds, IEvent yaev); } } diff --git a/src/Yavsc.Server/Models/Access/Ban.cs b/src/Yavsc.Server/Models/Access/Ban.cs index 92198aab..5b2d02a3 100644 --- a/src/Yavsc.Server/Models/Access/Ban.cs +++ b/src/Yavsc.Server/Models/Access/Ban.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Access/CircleAuthorizationToBlogPost.cs b/src/Yavsc.Server/Models/Access/CircleAuthorizationToBlogPost.cs index d3f79844..7976395b 100644 --- a/src/Yavsc.Server/Models/Access/CircleAuthorizationToBlogPost.cs +++ b/src/Yavsc.Server/Models/Access/CircleAuthorizationToBlogPost.cs @@ -4,6 +4,7 @@ namespace Yavsc.Models.Access using Models.Relationship; using Newtonsoft.Json; using Blog; + using Yavsc.Abstract.Identity.Security; using Yavsc.Abstract.BlogSpot; public class CircleAuthorizationToBlogPost : PostAccessControlRulePayload diff --git a/src/Yavsc.Server/Models/Access/ConsentInputModel.cs b/src/Yavsc.Server/Models/Access/ConsentInputModel.cs index cf20824a..b5015bdd 100644 --- a/src/Yavsc.Server/Models/Access/ConsentInputModel.cs +++ b/src/Yavsc.Server/Models/Access/ConsentInputModel.cs @@ -1,6 +1,9 @@ // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + +using System.Collections.Generic; + namespace Yavsc.Models.Access { public class ConsentInputModel diff --git a/src/Yavsc.Server/Models/Access/ConsentViewModel.cs b/src/Yavsc.Server/Models/Access/ConsentViewModel.cs index 740c6881..f94204ff 100644 --- a/src/Yavsc.Server/Models/Access/ConsentViewModel.cs +++ b/src/Yavsc.Server/Models/Access/ConsentViewModel.cs @@ -1,6 +1,9 @@ // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + +using System.Collections.Generic; + namespace Yavsc.Models.Access { public class ConsentViewModel : ConsentInputModel diff --git a/src/Yavsc.Server/Models/Access/RuleSet.cs b/src/Yavsc.Server/Models/Access/RuleSet.cs index c4ca55d1..c8b3068d 100644 --- a/src/Yavsc.Server/Models/Access/RuleSet.cs +++ b/src/Yavsc.Server/Models/Access/RuleSet.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Yavsc.Models.Access { public abstract class RuleSet :List> { diff --git a/src/Yavsc.Server/Models/ApplicationDbContext.cs b/src/Yavsc.Server/Models/ApplicationDbContext.cs index 0ddab58e..5ebf931f 100644 --- a/src/Yavsc.Server/Models/ApplicationDbContext.cs +++ b/src/Yavsc.Server/Models/ApplicationDbContext.cs @@ -8,6 +8,8 @@ namespace Yavsc.Models using Abstract.Identity; using Abstract.Models.Messaging; using Access; + using Attributes; + using Auth; using Bank; using Billing; using Blog; @@ -20,6 +22,7 @@ namespace Yavsc.Models using IT.Fixing; using Market; using Messaging; + using Microsoft.AspNetCore.Http; using Musical; using Musical.Profiles; using Payment; diff --git a/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs b/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs index 1db1d89e..a6190c96 100644 --- a/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs +++ b/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; @@ -20,13 +21,13 @@ namespace Yavsc.Models.Identity /// /// Latest Activity Update - /// - /// Let's says, - /// the latest time this device downloaded functional info from server + /// + /// Let's says, + /// the latest time this device downloaded functional info from server /// activity list, let's say, promoted ones, those thar are at index, and - /// all others, that are not listed as unsupported ones (not any more, after + /// all others, that are not listed as unsupported ones (not any more, after /// has been annonced as obsolete a decent laps of time). - /// + /// /// In order to say, is any activity has changed here. /// /// diff --git a/src/Yavsc.Server/Models/Auth/OAuth2Tokens.cs b/src/Yavsc.Server/Models/Auth/OAuth2Tokens.cs index 88397a88..89963ed4 100644 --- a/src/Yavsc.Server/Models/Auth/OAuth2Tokens.cs +++ b/src/Yavsc.Server/Models/Auth/OAuth2Tokens.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Auth diff --git a/src/Yavsc.Server/Models/Auth/RefreshToken.cs b/src/Yavsc.Server/Models/Auth/RefreshToken.cs index 0234291c..89642295 100644 --- a/src/Yavsc.Server/Models/Auth/RefreshToken.cs +++ b/src/Yavsc.Server/Models/Auth/RefreshToken.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Auth diff --git a/src/Yavsc.Server/Models/Bank/BalanceImpact.cs b/src/Yavsc.Server/Models/Bank/BalanceImpact.cs index 3a248844..c5aa654b 100644 --- a/src/Yavsc.Server/Models/Bank/BalanceImpact.cs +++ b/src/Yavsc.Server/Models/Bank/BalanceImpact.cs @@ -1,3 +1,5 @@ + +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Billing/Estimate.cs b/src/Yavsc.Server/Models/Billing/Estimate.cs index e6495a14..817d22ae 100644 --- a/src/Yavsc.Server/Models/Billing/Estimate.cs +++ b/src/Yavsc.Server/Models/Billing/Estimate.cs @@ -1,5 +1,9 @@ + +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; namespace Yavsc.Models.Billing { diff --git a/src/Yavsc.Server/Models/Billing/EstimateTemplate.cs b/src/Yavsc.Server/Models/Billing/EstimateTemplate.cs index 49af6b0e..d191f9d7 100644 --- a/src/Yavsc.Server/Models/Billing/EstimateTemplate.cs +++ b/src/Yavsc.Server/Models/Billing/EstimateTemplate.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs b/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs index ad651d36..b2af663b 100644 --- a/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs +++ b/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs @@ -1,3 +1,5 @@ + +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Billing/Signature.cs b/src/Yavsc.Server/Models/Billing/Signature.cs index 10da97f1..2e26ae9c 100644 --- a/src/Yavsc.Server/Models/Billing/Signature.cs +++ b/src/Yavsc.Server/Models/Billing/Signature.cs @@ -1,6 +1,8 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; +using Yavsc.Models.Relationship; namespace Yavsc.Models.Billing; diff --git a/src/Yavsc.Server/Models/Billing/histoestim.cs b/src/Yavsc.Server/Models/Billing/histoestim.cs index 1f9b99f1..3821bf5f 100644 --- a/src/Yavsc.Server/Models/Billing/histoestim.cs +++ b/src/Yavsc.Server/Models/Billing/histoestim.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Models.Billing { public partial class histoestim diff --git a/src/Yavsc.Server/Models/Blog/BlogAttachedFile.cs b/src/Yavsc.Server/Models/Blog/BlogAttachedFile.cs index a857665d..8f556d5c 100644 --- a/src/Yavsc.Server/Models/Blog/BlogAttachedFile.cs +++ b/src/Yavsc.Server/Models/Blog/BlogAttachedFile.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Org.BouncyCastle.Crypto.Modes; using Microsoft.EntityFrameworkCore; namespace Yavsc.Models.Blog diff --git a/src/Yavsc.Server/Models/Blog/Comment.cs b/src/Yavsc.Server/Models/Blog/Comment.cs index acb5e003..d1d09c29 100644 --- a/src/Yavsc.Server/Models/Blog/Comment.cs +++ b/src/Yavsc.Server/Models/Blog/Comment.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Calendar/Availabliity.cs b/src/Yavsc.Server/Models/Calendar/Availabliity.cs index 02bdbb28..e39dd476 100644 --- a/src/Yavsc.Server/Models/Calendar/Availabliity.cs +++ b/src/Yavsc.Server/Models/Calendar/Availabliity.cs @@ -1,3 +1,5 @@ +using Yavsc.Models.Calendar; + namespace Yavsc.Server.Models.Calendar { public class Availability : List diff --git a/src/Yavsc.Server/Models/Calendar/Period.cs b/src/Yavsc.Server/Models/Calendar/Period.cs index dfc285cf..50303463 100644 --- a/src/Yavsc.Server/Models/Calendar/Period.cs +++ b/src/Yavsc.Server/Models/Calendar/Period.cs @@ -19,6 +19,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; using System.ComponentModel.DataAnnotations; namespace Yavsc.Server.Models.Calendar diff --git a/src/Yavsc.Server/Models/Chat/ChatRoom.cs b/src/Yavsc.Server/Models/Chat/ChatRoom.cs index 1b7f1c58..e03421c0 100644 --- a/src/Yavsc.Server/Models/Chat/ChatRoom.cs +++ b/src/Yavsc.Server/Models/Chat/ChatRoom.cs @@ -1,3 +1,6 @@ + +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Cratie/Option.cs b/src/Yavsc.Server/Models/Cratie/Option.cs index d3a3caaf..ed157717 100644 --- a/src/Yavsc.Server/Models/Cratie/Option.cs +++ b/src/Yavsc.Server/Models/Cratie/Option.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Models.Cratie { public class Option: ITrackedEntity diff --git a/src/Yavsc.Server/Models/Cratie/Scrutin.cs b/src/Yavsc.Server/Models/Cratie/Scrutin.cs index a4ca11dd..753cec34 100644 --- a/src/Yavsc.Server/Models/Cratie/Scrutin.cs +++ b/src/Yavsc.Server/Models/Cratie/Scrutin.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Cratie diff --git a/src/Yavsc.Server/Models/EMailing/MailingTemplate.cs b/src/Yavsc.Server/Models/EMailing/MailingTemplate.cs index 3626388b..71e773d8 100644 --- a/src/Yavsc.Server/Models/EMailing/MailingTemplate.cs +++ b/src/Yavsc.Server/Models/EMailing/MailingTemplate.cs @@ -1,6 +1,10 @@ +using System; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using RazorEngine.Templating; using Yavsc.Attributes.Validation; +using Yavsc.Models; +using Yavsc.Models.Calendar; using Yavsc.Server.Models.Calendar; namespace Yavsc.Server.Models.EMailing diff --git a/src/Yavsc.Server/Models/Edition/IDocument.cs b/src/Yavsc.Server/Models/Edition/IDocument.cs index 28307d42..396e4eba 100644 --- a/src/Yavsc.Server/Models/Edition/IDocument.cs +++ b/src/Yavsc.Server/Models/Edition/IDocument.cs @@ -1,3 +1,4 @@ + // // IDocument.cs // @@ -19,6 +20,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; + namespace Yavsc.Models { public class Parameter { diff --git a/src/Yavsc.Server/Models/FormFile.cs b/src/Yavsc.Server/Models/FormFile.cs index bda84217..9bac0ae4 100644 --- a/src/Yavsc.Server/Models/FormFile.cs +++ b/src/Yavsc.Server/Models/FormFile.cs @@ -1,3 +1,5 @@ + +using System.IO; using System.Net.Mime; namespace Yavsc.Server.Model diff --git a/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs b/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs index ba47bfdc..ace5a12b 100644 --- a/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs +++ b/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs @@ -23,6 +23,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; +using System.Collections.Generic; namespace Yavsc.Models.Haircut { diff --git a/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs b/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs index 35324928..e76bbb37 100644 --- a/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs +++ b/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Localization; +using System.Linq; using Yavsc.Interfaces.Workflow; using Yavsc.Models.Haircut; diff --git a/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs b/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs index 0960db6d..5aab5258 100644 --- a/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs +++ b/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs @@ -1,3 +1,6 @@ + +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Billing; @@ -5,6 +8,7 @@ using Yavsc.Models.Relationship; using Yavsc.Billing; using System.Globalization; using Yavsc.Helpers; +using System.Linq; using Microsoft.Extensions.Localization; using Yavsc.ViewModels.PayPal; using Yavsc.Models.HairCut; diff --git a/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs b/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs index 21ae437c..b68ed38b 100644 --- a/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs +++ b/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Billing; diff --git a/src/Yavsc.Server/Models/HairCut/HairPrestation.cs b/src/Yavsc.Server/Models/HairCut/HairPrestation.cs index a14053b3..ce560d01 100644 --- a/src/Yavsc.Server/Models/HairCut/HairPrestation.cs +++ b/src/Yavsc.Server/Models/HairCut/HairPrestation.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/HairCut/Haircut.cs b/src/Yavsc.Server/Models/HairCut/Haircut.cs index 77cb0eb9..dc7549a3 100644 --- a/src/Yavsc.Server/Models/HairCut/Haircut.cs +++ b/src/Yavsc.Server/Models/HairCut/Haircut.cs @@ -1,3 +1,4 @@ +using System; namespace Yavsc.Haircut { public interface IProviderInfo diff --git a/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs b/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs index c9213862..d86da930 100644 --- a/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs +++ b/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs @@ -20,6 +20,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System; using System.ComponentModel.DataAnnotations; using Yavsc.Abstract.Identity; using Yavsc.Models.Relationship; diff --git a/src/Yavsc.Server/Models/IT/Project.cs b/src/Yavsc.Server/Models/IT/Project.cs index 1fce99de..1a7fa4e4 100644 --- a/src/Yavsc.Server/Models/IT/Project.cs +++ b/src/Yavsc.Server/Models/IT/Project.cs @@ -1,6 +1,9 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; using Yavsc.Abstract.IT; +using Yavsc.Attributes.Validation; using Yavsc.Billing; using Yavsc.Models.Billing; using Yavsc.Server.Models.IT.SourceCode; diff --git a/src/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs b/src/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs index e2f96bed..e0ea867e 100644 --- a/src/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs +++ b/src/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Server.Models.IT { diff --git a/src/Yavsc.Server/Models/IT/SourceCode/Batch.cs b/src/Yavsc.Server/Models/IT/SourceCode/Batch.cs index 8a0d4c6b..2405c6e1 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/Batch.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/Batch.cs @@ -1,3 +1,4 @@ +using System; using Yavsc.Abstract.Interfaces; namespace Yavsc.Server.Models.IT.SourceCode diff --git a/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs b/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs index 826e5de3..5c926f3b 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs @@ -3,6 +3,8 @@ // paul 21/06/2018 11:27 20182018 6 21 // */ using System.Diagnostics; +using System.IO; +using System; namespace Yavsc.Server.Models.IT.SourceCode { @@ -38,7 +40,7 @@ namespace Yavsc.Server.Models.IT.SourceCode using (var writer = new StreamWriter(stream)) { var process = Process.Start(cloneStart); - // TODO publish the starting log url ... + // TODO publish the starting log url ... while (!process.HasExited) { if (process.StandardOutput.Peek() > -1) diff --git a/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs b/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs index f65b17b5..3c636e0f 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs @@ -1,4 +1,6 @@ +using System; using System.Diagnostics; +using System.IO; namespace Yavsc.Server.Models.IT.SourceCode { diff --git a/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs b/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs index 2ce16256..73a7f075 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs @@ -1,4 +1,7 @@ +using System; +using System.Collections.Generic; using System.Diagnostics; +using System.IO; namespace Yavsc.Server.Models.IT.SourceCode { diff --git a/src/Yavsc.Server/Models/IdentityUserLogin.cs b/src/Yavsc.Server/Models/IdentityUserLogin.cs index bfbd4e89..49afeeea 100644 --- a/src/Yavsc.Server/Models/IdentityUserLogin.cs +++ b/src/Yavsc.Server/Models/IdentityUserLogin.cs @@ -1,5 +1,6 @@ namespace Yavsc.Models.Auth { + using Microsoft.AspNetCore.Identity; using System.ComponentModel.DataAnnotations.Schema; public class YaIdentityUserLogin diff --git a/src/Yavsc.Server/Models/Kyc/TrustToken.cs b/src/Yavsc.Server/Models/Kyc/TrustToken.cs index 2e240bae..47084cb0 100644 --- a/src/Yavsc.Server/Models/Kyc/TrustToken.cs +++ b/src/Yavsc.Server/Models/Kyc/TrustToken.cs @@ -3,6 +3,7 @@ namespace Yavsc.Models.Kyc { using System; using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; /// /// Token opaque représentant une entité sans l'identifier. diff --git a/src/Yavsc.Server/Models/Market/Catalog.cs b/src/Yavsc.Server/Models/Market/Catalog.cs index aee16e3f..b58a1c1c 100644 --- a/src/Yavsc.Server/Models/Market/Catalog.cs +++ b/src/Yavsc.Server/Models/Market/Catalog.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Yavsc.Models.Market { public class Catalog { diff --git a/src/Yavsc.Server/Models/Market/Money.cs b/src/Yavsc.Server/Models/Market/Money.cs index a4b599d3..fd6a5546 100644 --- a/src/Yavsc.Server/Models/Market/Money.cs +++ b/src/Yavsc.Server/Models/Market/Money.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.Models.Market { /// /// Not yet used! diff --git a/src/Yavsc.Server/Models/Market/Service.cs b/src/Yavsc.Server/Models/Market/Service.cs index 34c996e5..8177bd59 100644 --- a/src/Yavsc.Server/Models/Market/Service.cs +++ b/src/Yavsc.Server/Models/Market/Service.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; namespace Yavsc.Models.Market { diff --git a/src/Yavsc.Server/Models/Messaging/CircleEvent.cs b/src/Yavsc.Server/Models/Messaging/CircleEvent.cs index b1eb782b..369e3a54 100644 --- a/src/Yavsc.Server/Models/Messaging/CircleEvent.cs +++ b/src/Yavsc.Server/Models/Messaging/CircleEvent.cs @@ -19,11 +19,13 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Messaging { using Models.Relationship; + using Yavsc.Attributes.Validation; /// /// Event pub. diff --git a/src/Yavsc.Server/Models/Messaging/DimissClicked.cs b/src/Yavsc.Server/Models/Messaging/DimissClicked.cs index 88295fd8..3ac16646 100644 --- a/src/Yavsc.Server/Models/Messaging/DimissClicked.cs +++ b/src/Yavsc.Server/Models/Messaging/DimissClicked.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Abstract.Models.Messaging; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Messaging { diff --git a/src/Yavsc.Server/Models/Messaging/LiveFlow.cs b/src/Yavsc.Server/Models/Messaging/LiveFlow.cs index 7e3914c0..b121877b 100644 --- a/src/Yavsc.Server/Models/Messaging/LiveFlow.cs +++ b/src/Yavsc.Server/Models/Messaging/LiveFlow.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Abstract.Streaming; diff --git a/src/Yavsc.Server/Models/Musical/Instrument.cs b/src/Yavsc.Server/Models/Musical/Instrument.cs index 105d2442..0b81fed0 100644 --- a/src/Yavsc.Server/Models/Musical/Instrument.cs +++ b/src/Yavsc.Server/Models/Musical/Instrument.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Musical { diff --git a/src/Yavsc.Server/Models/Musical/InstrumentRating.cs b/src/Yavsc.Server/Models/Musical/InstrumentRating.cs index 150d2967..7578a427 100644 --- a/src/Yavsc.Server/Models/Musical/InstrumentRating.cs +++ b/src/Yavsc.Server/Models/Musical/InstrumentRating.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; using Yavsc.Models.Workflow; namespace Yavsc.Models.Musical diff --git a/src/Yavsc.Server/Models/Musical/MusicalPreference.cs b/src/Yavsc.Server/Models/Musical/MusicalPreference.cs index 009e1167..dc66667d 100644 --- a/src/Yavsc.Server/Models/Musical/MusicalPreference.cs +++ b/src/Yavsc.Server/Models/Musical/MusicalPreference.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Musical { diff --git a/src/Yavsc.Server/Models/Musical/MusicalTendency.cs b/src/Yavsc.Server/Models/Musical/MusicalTendency.cs index 9b5743b7..0804bd1e 100644 --- a/src/Yavsc.Server/Models/Musical/MusicalTendency.cs +++ b/src/Yavsc.Server/Models/Musical/MusicalTendency.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Musical { diff --git a/src/Yavsc.Server/Models/Musical/Profiles/DjPerformerProfile.cs b/src/Yavsc.Server/Models/Musical/Profiles/DjPerformerProfile.cs index 2669e0d9..863e8263 100644 --- a/src/Yavsc.Server/Models/Musical/Profiles/DjPerformerProfile.cs +++ b/src/Yavsc.Server/Models/Musical/Profiles/DjPerformerProfile.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; diff --git a/src/Yavsc.Server/Models/Musical/Profiles/DjSettings.cs b/src/Yavsc.Server/Models/Musical/Profiles/DjSettings.cs index 6d7cc372..d74a0284 100644 --- a/src/Yavsc.Server/Models/Musical/Profiles/DjSettings.cs +++ b/src/Yavsc.Server/Models/Musical/Profiles/DjSettings.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Musical.Profiles diff --git a/src/Yavsc.Server/Models/Musical/Profiles/FormationPerformerProfile.cs b/src/Yavsc.Server/Models/Musical/Profiles/FormationPerformerProfile.cs index 496bd40f..410864e4 100644 --- a/src/Yavsc.Server/Models/Musical/Profiles/FormationPerformerProfile.cs +++ b/src/Yavsc.Server/Models/Musical/Profiles/FormationPerformerProfile.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; diff --git a/src/Yavsc.Server/Models/Musical/Profiles/MusicLoverSettings.cs b/src/Yavsc.Server/Models/Musical/Profiles/MusicLoverSettings.cs index 40c87347..fae39a40 100644 --- a/src/Yavsc.Server/Models/Musical/Profiles/MusicLoverSettings.cs +++ b/src/Yavsc.Server/Models/Musical/Profiles/MusicLoverSettings.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Musical.Profiles diff --git a/src/Yavsc.Server/Models/Musical/Profiles/MusicianPerformerProfile.cs b/src/Yavsc.Server/Models/Musical/Profiles/MusicianPerformerProfile.cs index 83ed28bb..62719963 100644 --- a/src/Yavsc.Server/Models/Musical/Profiles/MusicianPerformerProfile.cs +++ b/src/Yavsc.Server/Models/Musical/Profiles/MusicianPerformerProfile.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; diff --git a/src/Yavsc.Server/Models/Musical/Profiles/StarPerformerProfile.cs b/src/Yavsc.Server/Models/Musical/Profiles/StarPerformerProfile.cs index eff45874..43b976b4 100644 --- a/src/Yavsc.Server/Models/Musical/Profiles/StarPerformerProfile.cs +++ b/src/Yavsc.Server/Models/Musical/Profiles/StarPerformerProfile.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; diff --git a/src/Yavsc.Server/Models/Payment/PaypalPayment.cs b/src/Yavsc.Server/Models/Payment/PaypalPayment.cs index bb214cad..f33160e5 100644 --- a/src/Yavsc.Server/Models/Payment/PaypalPayment.cs +++ b/src/Yavsc.Server/Models/Payment/PaypalPayment.cs @@ -1,10 +1,12 @@ +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace Yavsc.Models.Payment -{ +namespace Yavsc.Models.Payment { using Yavsc; using Relationship; + using Yavsc.Attributes.Validation; public class PayPalPayment : ITrackedEntity { diff --git a/src/Yavsc.Server/Models/Relationship/Circle.cs b/src/Yavsc.Server/Models/Relationship/Circle.cs index 35b40c07..97b79f8d 100644 --- a/src/Yavsc.Server/Models/Relationship/Circle.cs +++ b/src/Yavsc.Server/Models/Relationship/Circle.cs @@ -1,6 +1,9 @@ + +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Server/Models/Relationship/CircleMember.cs b/src/Yavsc.Server/Models/Relationship/CircleMember.cs index e83215c7..a102b260 100644 --- a/src/Yavsc.Server/Models/Relationship/CircleMember.cs +++ b/src/Yavsc.Server/Models/Relationship/CircleMember.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Server/Models/Relationship/Contact.cs b/src/Yavsc.Server/Models/Relationship/Contact.cs index 4e87f322..7976432b 100644 --- a/src/Yavsc.Server/Models/Relationship/Contact.cs +++ b/src/Yavsc.Server/Models/Relationship/Contact.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Server/Models/Relationship/Tag.cs b/src/Yavsc.Server/Models/Relationship/Tag.cs index 9fd1907b..ea9cc222 100644 --- a/src/Yavsc.Server/Models/Relationship/Tag.cs +++ b/src/Yavsc.Server/Models/Relationship/Tag.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Server/Models/Workflow/Activity.cs b/src/Yavsc.Server/Models/Workflow/Activity.cs index 0f813a27..af9a0909 100644 --- a/src/Yavsc.Server/Models/Workflow/Activity.cs +++ b/src/Yavsc.Server/Models/Workflow/Activity.cs @@ -1,3 +1,6 @@ + +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Workflow/CommandForm.cs b/src/Yavsc.Server/Models/Workflow/CommandForm.cs index a5b76153..4063babd 100644 --- a/src/Yavsc.Server/Models/Workflow/CommandForm.cs +++ b/src/Yavsc.Server/Models/Workflow/CommandForm.cs @@ -4,7 +4,8 @@ using Newtonsoft.Json; namespace Yavsc.Models.Workflow { - using Yavsc; + using Yavsc; + using Yavsc.Attributes.Validation; public class CommandForm : ICommandForm { diff --git a/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs b/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs index 7067bc13..a9f4a507 100644 --- a/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs +++ b/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Workflow/Profiles/FormationSettings.cs b/src/Yavsc.Server/Models/Workflow/Profiles/FormationSettings.cs index 1c30d32c..2f7095da 100644 --- a/src/Yavsc.Server/Models/Workflow/Profiles/FormationSettings.cs +++ b/src/Yavsc.Server/Models/Workflow/Profiles/FormationSettings.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Yavsc.Attributes.Validation; diff --git a/src/Yavsc.Server/Models/Workflow/RdvQuery.cs b/src/Yavsc.Server/Models/Workflow/RdvQuery.cs index 34bae29a..d908c492 100644 --- a/src/Yavsc.Server/Models/Workflow/RdvQuery.cs +++ b/src/Yavsc.Server/Models/Workflow/RdvQuery.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Workflow/RendezVous.cs b/src/Yavsc.Server/Models/Workflow/RendezVous.cs index ddfbf587..2f2e35f9 100644 --- a/src/Yavsc.Server/Models/Workflow/RendezVous.cs +++ b/src/Yavsc.Server/Models/Workflow/RendezVous.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Market; @@ -5,6 +6,7 @@ using Yavsc.Models.Market; namespace Yavsc.Models.Workflow { using Models.Relationship; + using Yavsc.Attributes.Validation; /// /// A date, between two persons diff --git a/src/Yavsc.Server/Models/Workflow/UserActivity.cs b/src/Yavsc.Server/Models/Workflow/UserActivity.cs index 5e2abf35..d9841ce7 100644 --- a/src/Yavsc.Server/Models/Workflow/UserActivity.cs +++ b/src/Yavsc.Server/Models/Workflow/UserActivity.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Workflow { diff --git a/src/Yavsc.Server/Services/BlogSpotService.cs b/src/Yavsc.Server/Services/BlogSpotService.cs index 6b85a4c3..eb6fa457 100644 --- a/src/Yavsc.Server/Services/BlogSpotService.cs +++ b/src/Yavsc.Server/Services/BlogSpotService.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; +using Yavsc; using Yavsc.Models; using Yavsc.Models.Blog; using Yavsc.Server.Exceptions; diff --git a/src/Yavsc.Server/Services/ClaudeModerationService.cs b/src/Yavsc.Server/Services/ClaudeModerationService.cs index a510e55c..0d6260ae 100644 --- a/src/Yavsc.Server/Services/ClaudeModerationService.cs +++ b/src/Yavsc.Server/Services/ClaudeModerationService.cs @@ -3,6 +3,8 @@ using Yavsc.Abstract.Interfaces; using Anthropic.SDK; using Anthropic.SDK.Messaging; using Anthropic.SDK.Constants; +using Anthropic.SDK.Models; +using Newtonsoft.Json; using Microsoft.Extensions.Configuration; using System.Text.Json; public class ClaudeModerationService : IModerationService @@ -85,4 +87,4 @@ public class ClaudeModerationService : IModerationService 0f); } } -} +} \ No newline at end of file diff --git a/src/Yavsc.Server/Services/FileSystemAuthManager.cs b/src/Yavsc.Server/Services/FileSystemAuthManager.cs index 53f29210..973ccffc 100644 --- a/src/Yavsc.Server/Services/FileSystemAuthManager.cs +++ b/src/Yavsc.Server/Services/FileSystemAuthManager.cs @@ -1,7 +1,9 @@ using System.Security.Claims; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Options; using rules; +using Yavsc.Helpers; using Yavsc.Models; using Yavsc.Server.Helpers; diff --git a/src/Yavsc.Server/Services/GoogleApis/CalendarManager.cs b/src/Yavsc.Server/Services/GoogleApis/CalendarManager.cs index 8d9d7c23..f91b3393 100644 --- a/src/Yavsc.Server/Services/GoogleApis/CalendarManager.cs +++ b/src/Yavsc.Server/Services/GoogleApis/CalendarManager.cs @@ -29,6 +29,7 @@ namespace Yavsc.Services { using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; + using Yavsc.Models.Calendar; using Yavsc.Server.Helpers; using Yavsc.Server.Models.Calendar; using Yavsc.ViewModels.Calendar; diff --git a/src/Yavsc.Server/Services/GoogleApis/MapTracks.cs b/src/Yavsc.Server/Services/GoogleApis/MapTracks.cs index 6691674b..230bee9a 100644 --- a/src/Yavsc.Server/Services/GoogleApis/MapTracks.cs +++ b/src/Yavsc.Server/Services/GoogleApis/MapTracks.cs @@ -18,6 +18,7 @@ // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System.Threading.Tasks; using Yavsc.Models.Google; using Yavsc.Server.Helpers; @@ -55,11 +56,11 @@ namespace Yavsc.GoogleApis /// Entities. public static async Task CreateEntity( Entity[] entities ) { string [] ans = null; - + using (SimpleJsonPostMethod wr = new SimpleJsonPostMethod (googleMapTracksPath + "entities/create")) { - ans = await wr.Invoke (entities); + ans = await wr.Invoke (entities); } return ans; } diff --git a/src/Yavsc.Server/Services/GoogleApis/PeopleApi.cs b/src/Yavsc.Server/Services/GoogleApis/PeopleApi.cs index de50e555..e67fa30e 100644 --- a/src/Yavsc.Server/Services/GoogleApis/PeopleApi.cs +++ b/src/Yavsc.Server/Services/GoogleApis/PeopleApi.cs @@ -19,6 +19,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System.IO; using System.Net; using Newtonsoft.Json; using Yavsc.Abstract.Identity; diff --git a/src/Yavsc.Server/Services/IFileSystemAuthManager.cs b/src/Yavsc.Server/Services/IFileSystemAuthManager.cs index 36d44c2d..9551cc6a 100644 --- a/src/Yavsc.Server/Services/IFileSystemAuthManager.cs +++ b/src/Yavsc.Server/Services/IFileSystemAuthManager.cs @@ -1,5 +1,6 @@ using System.Security.Claims; +using Microsoft.Extensions.FileProviders; namespace Yavsc.Services { diff --git a/src/Yavsc.Server/Services/MailSender.cs b/src/Yavsc.Server/Services/MailSender.cs index 417fca6b..5e9e6d49 100644 --- a/src/Yavsc.Server/Services/MailSender.cs +++ b/src/Yavsc.Server/Services/MailSender.cs @@ -1,3 +1,4 @@ +using System.Net; using MailKit.Security; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Yavsc.Server/Services/ProfileService.cs b/src/Yavsc.Server/Services/ProfileService.cs index b6da3a56..bda689a4 100644 --- a/src/Yavsc.Server/Services/ProfileService.cs +++ b/src/Yavsc.Server/Services/ProfileService.cs @@ -2,6 +2,7 @@ using System.Security.Claims; using IdentityModel; using IdentityServer8.Models; using IdentityServer8.Services; +using IdentityServer8.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Yavsc.Models; diff --git a/src/Yavsc.Server/Services/SIRENCheker.cs b/src/Yavsc.Server/Services/SIRENCheker.cs index eedea3f0..0843e946 100644 --- a/src/Yavsc.Server/Services/SIRENCheker.cs +++ b/src/Yavsc.Server/Services/SIRENCheker.cs @@ -1,3 +1,5 @@ +using System.Net.Http; +using System.Threading.Tasks; using Yavsc.Helpers; namespace Yavsc.Services diff --git a/src/Yavsc.Server/Settings/SiteSettings.cs b/src/Yavsc.Server/Settings/SiteSettings.cs index 9267370e..1f63ea2c 100644 --- a/src/Yavsc.Server/Settings/SiteSettings.cs +++ b/src/Yavsc.Server/Settings/SiteSettings.cs @@ -1,3 +1,4 @@ +using Microsoft.EntityFrameworkCore.Metadata.Builders; using Yavsc.Models.Relationship; namespace Yavsc diff --git a/src/Yavsc.Server/Settings/UserPolicies.cs b/src/Yavsc.Server/Settings/UserPolicies.cs index 125a6236..5f48426b 100644 --- a/src/Yavsc.Server/Settings/UserPolicies.cs +++ b/src/Yavsc.Server/Settings/UserPolicies.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using Yavsc.Models; namespace Yavsc.Server.Settings diff --git a/src/Yavsc.Server/Templates/UserOrientedTemplate.cs b/src/Yavsc.Server/Templates/UserOrientedTemplate.cs index 7c85f104..43ceb532 100644 --- a/src/Yavsc.Server/Templates/UserOrientedTemplate.cs +++ b/src/Yavsc.Server/Templates/UserOrientedTemplate.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using Yavsc.Abstract.Templates; using Yavsc.Models; diff --git a/src/Yavsc.Server/ViewModels/Account/ChangePasswordBindingModel.cs b/src/Yavsc.Server/ViewModels/Account/ChangePasswordBindingModel.cs index f5cb6bc1..bb2478d6 100644 --- a/src/Yavsc.Server/ViewModels/Account/ChangePasswordBindingModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/ChangePasswordBindingModel.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Account {  public class ChangePasswordBindingModel { diff --git a/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs b/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs index a9ab63df..09519543 100644 --- a/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Abstract; using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account diff --git a/src/Yavsc.Server/ViewModels/Account/ResetPasswordViewModel.cs b/src/Yavsc.Server/ViewModels/Account/ResetPasswordViewModel.cs index 35c50878..a7f65c70 100644 --- a/src/Yavsc.Server/ViewModels/Account/ResetPasswordViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/ResetPasswordViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { diff --git a/src/Yavsc.Server/ViewModels/Account/SignInModel.cs b/src/Yavsc.Server/ViewModels/Account/SignInModel.cs index d2aa69ad..272563d5 100755 --- a/src/Yavsc.Server/ViewModels/Account/SignInModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/SignInModel.cs @@ -1,4 +1,8 @@ + +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Runtime.InteropServices; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { diff --git a/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs b/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs index e28fcfed..13e412f1 100644 --- a/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { diff --git a/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs b/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs index a768e249..413eda97 100644 --- a/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { diff --git a/src/Yavsc.Server/ViewModels/Auth/FileSpotInfo.cs b/src/Yavsc.Server/ViewModels/Auth/FileSpotInfo.cs index b151b4e7..78141e98 100644 --- a/src/Yavsc.Server/ViewModels/Auth/FileSpotInfo.cs +++ b/src/Yavsc.Server/ViewModels/Auth/FileSpotInfo.cs @@ -1,3 +1,5 @@ + +using System.IO; using Microsoft.AspNetCore.Authorization; using Yavsc.Models.Blog; diff --git a/src/Yavsc.Server/ViewModels/Calendar/DateTimeChooserViewModel.cs b/src/Yavsc.Server/ViewModels/Calendar/DateTimeChooserViewModel.cs index 967a9173..de078cdb 100644 --- a/src/Yavsc.Server/ViewModels/Calendar/DateTimeChooserViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Calendar/DateTimeChooserViewModel.cs @@ -1,3 +1,5 @@ +using System; +using Yavsc.Models.Calendar; using Yavsc.Server.Models.Calendar; namespace Yavsc.ViewModels.Calendar diff --git a/src/Yavsc.Server/ViewModels/Chat/ChatRoomInfo.cs b/src/Yavsc.Server/ViewModels/Chat/ChatRoomInfo.cs index b74206f2..ff17d848 100644 --- a/src/Yavsc.Server/ViewModels/Chat/ChatRoomInfo.cs +++ b/src/Yavsc.Server/ViewModels/Chat/ChatRoomInfo.cs @@ -19,6 +19,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . +using System.Collections.Generic; + namespace Yavsc { public class ChatRoomInfo diff --git a/src/Yavsc.Server/ViewModels/Chat/ChatUserInfo.cs b/src/Yavsc.Server/ViewModels/Chat/ChatUserInfo.cs index f8a8d19d..66350be9 100644 --- a/src/Yavsc.Server/ViewModels/Chat/ChatUserInfo.cs +++ b/src/Yavsc.Server/ViewModels/Chat/ChatUserInfo.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Yavsc.Models.Chat; namespace Yavsc.ViewModels.Chat {  diff --git a/src/Yavsc.Server/ViewModels/FrontOffice/PerformerProfileViewModel.cs b/src/Yavsc.Server/ViewModels/FrontOffice/PerformerProfileViewModel.cs index d2a23319..f5dce499 100644 --- a/src/Yavsc.Server/ViewModels/FrontOffice/PerformerProfileViewModel.cs +++ b/src/Yavsc.Server/ViewModels/FrontOffice/PerformerProfileViewModel.cs @@ -1,3 +1,4 @@ +using System.Linq; using Yavsc.Models.Workflow; namespace Yavsc.ViewModels.FrontOffice diff --git a/src/Yavsc.Server/ViewModels/LiveCastHandler.cs b/src/Yavsc.Server/ViewModels/LiveCastHandler.cs index 55c3160d..f3ce00cb 100644 --- a/src/Yavsc.Server/ViewModels/LiveCastHandler.cs +++ b/src/Yavsc.Server/ViewModels/LiveCastHandler.cs @@ -1,7 +1,15 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; using System.Net.WebSockets; +using System.Threading; +using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Yavsc.Helpers; using Yavsc.Models; +using Yavsc.Models.FileSystem; using Yavsc.Server.Helpers; using Yavsc.Server.Models.FileSystem; @@ -46,7 +54,7 @@ namespace Yavsc.ViewModels.Streaming item.Overridden = true; usage -= fi.Length; } - + logger.LogInformation("Opening the file"); using (var dest = fi.Open(FileMode.Create, FileAccess.Write, FileShare.Read)) { diff --git a/src/Yavsc.Server/ViewModels/Manage/AddPhoneNumberViewModel.cs b/src/Yavsc.Server/ViewModels/Manage/AddPhoneNumberViewModel.cs index bc823f50..7c606ed3 100644 --- a/src/Yavsc.Server/ViewModels/Manage/AddPhoneNumberViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Manage/AddPhoneNumberViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Manage { diff --git a/src/Yavsc.Server/ViewModels/Manage/DoDirectCreditViewModel.cs b/src/Yavsc.Server/ViewModels/Manage/DoDirectCreditViewModel.cs index 7ee28f2c..cec754f0 100644 --- a/src/Yavsc.Server/ViewModels/Manage/DoDirectCreditViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Manage/DoDirectCreditViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Manage { diff --git a/src/Yavsc.Server/ViewModels/Manage/SetAddressViewModel.cs b/src/Yavsc.Server/ViewModels/Manage/SetAddressViewModel.cs index b7998761..ca568414 100644 --- a/src/Yavsc.Server/ViewModels/Manage/SetAddressViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Manage/SetAddressViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Manage { diff --git a/src/Yavsc.Server/ViewModels/Manage/VerifyPhoneNumberViewModel.cs b/src/Yavsc.Server/ViewModels/Manage/VerifyPhoneNumberViewModel.cs index 71e87280..160185c9 100644 --- a/src/Yavsc.Server/ViewModels/Manage/VerifyPhoneNumberViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Manage/VerifyPhoneNumberViewModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Manage { diff --git a/src/Yavsc.Server/ViewModels/Test/CalendarViewModel.cs b/src/Yavsc.Server/ViewModels/Test/CalendarViewModel.cs index 105665fd..cd3b58c1 100644 --- a/src/Yavsc.Server/ViewModels/Test/CalendarViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Test/CalendarViewModel.cs @@ -1,3 +1,5 @@ +using System; + namespace Yavsc.ViewModels.Test { public class CalendarViewModel diff --git a/src/Yavsc.Server/Yavsc.Server.csproj b/src/Yavsc.Server/Yavsc.Server.csproj index 7adb3a78..4eaf6a83 100644 --- a/src/Yavsc.Server/Yavsc.Server.csproj +++ b/src/Yavsc.Server/Yavsc.Server.csproj @@ -9,7 +9,7 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -43,4 +43,4 @@ - + \ No newline at end of file diff --git a/src/Yavsc.Tests.Shared/InMemoryDatabaseName.cs b/src/Yavsc.Tests.Shared/InMemoryDatabaseName.cs deleted file mode 100644 index 1c78c6dd..00000000 --- a/src/Yavsc.Tests.Shared/InMemoryDatabaseName.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Yavsc.Tests.Shared; - -/// -/// Helpers for the in-memory connection string used by test fixtures. -/// -/// EF Core's UseInMemoryDatabase(name) returns the same backing -/// store to every DbContext that asks for it under the same -/// , in the same process. That means every -/// fixture that uses the bare "InMemory" connection string -/// shares the same in-memory database — which leaks state between -/// fixtures that are supposed to be independent, and silently makes -/// tests order-dependent. -/// -/// The fix is to give each fixture its own suffix. -/// returns a stable, fixture-scoped connection string. The fixture -/// stores the suffix in an instance field so successive calls within -/// the same fixture always resolve to the same database. -/// -public static class InMemoryDatabaseName -{ - /// Base connection string for the in-memory provider, - /// as it appears in appsettings-org.Testing.json. - public const string Base = "InMemory"; - - /// Builds a per-fixture connection string. Two calls - /// with the same return the same - /// string; two calls with different ids return different - /// strings, isolating the underlying in-memory stores. - public static string For(string fixtureId) => $"{Base}-{fixtureId}"; -} diff --git a/src/Yavsc.Tests.Shared/Yavsc.Tests.Shared.csproj b/src/Yavsc.Tests.Shared/Yavsc.Tests.Shared.csproj index 7f2f382a..52effc72 100644 --- a/src/Yavsc.Tests.Shared/Yavsc.Tests.Shared.csproj +++ b/src/Yavsc.Tests.Shared/Yavsc.Tests.Shared.csproj @@ -14,7 +14,7 @@ --> 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -23,4 +23,4 @@ - + \ No newline at end of file diff --git a/src/cli/Commands/GenerationCommander.cs b/src/cli/Commands/GenerationCommander.cs index 7690a301..55712f5b 100644 --- a/src/cli/Commands/GenerationCommander.cs +++ b/src/cli/Commands/GenerationCommander.cs @@ -3,6 +3,7 @@ using cli.Model; using cli.Services; using cli.Settings; using Microsoft.Extensions.CommandLineUtils; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -43,7 +44,7 @@ namespace cli.Commands config.HelpOption("-? | -h | --help"); }); cmd.OnExecute(() => { - + var logger = loggerFactory.CreateLogger(); var modelFullName = mdClass?.Value ?? options?.Value.ModelFullName; var nameSpace = nameSpaceArg?.Value?? options?.Value.NameSpace; @@ -55,10 +56,10 @@ namespace cli.Commands logger.LogInformation($"Using parameters : modelFullName:{modelFullName} nameSpace:{nameSpace} dbContext:{dbContext} controllerName:{controllerName} relativePath:{relativePath}"); mvcGenerator.Generate(modelFullName, - dbContext, + dbContext, controllerName, relativePath); - + logger.LogInformation("Finished generation"); return 0; diff --git a/src/cli/Commands/UserListCleanUp.cs b/src/cli/Commands/UserListCleanUp.cs index 7d171ed9..e5360f36 100644 --- a/src/cli/Commands/UserListCleanUp.cs +++ b/src/cli/Commands/UserListCleanUp.cs @@ -1,4 +1,5 @@ using cli.Model; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.CommandLineUtils; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -29,7 +30,7 @@ namespace cli.Commands if (!showhelp) { - + var mailer = Program.AppHost.Services.GetService(); var loggerFactory = Program.AppHost.Services.GetService(); diff --git a/src/cli/Program.cs b/src/cli/Program.cs index 6c0d0cef..aeb573b1 100644 --- a/src/cli/Program.cs +++ b/src/cli/Program.cs @@ -1,5 +1,6 @@ // See https://aka.ms/new-console-template for more information +using cli; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; internal class Program @@ -15,7 +16,7 @@ internal class Program .AddJsonFile("appsettings-cli.json", optional: false, reloadOnChange: false) .AddJsonFile($"appsettings-cli.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: false) .AddEnvironmentVariables(); - + AppHost = builder.Build(); AppConfiguration = builder.Configuration; AppHost.Start(); diff --git a/src/cli/Services/YaRazorEngineHost.cs b/src/cli/Services/YaRazorEngineHost.cs index 038cd5fb..3d29812a 100644 --- a/src/cli/Services/YaRazorEngineHost.cs +++ b/src/cli/Services/YaRazorEngineHost.cs @@ -1,4 +1,6 @@ -namespace cli +using Microsoft.AspNetCore.Razor; + +namespace cli { public class YaRazorEngineHost { diff --git a/src/cli/Settings/ConnectionSettings.cs b/src/cli/Settings/ConnectionSettings.cs index 21836d2e..62622ebc 100644 --- a/src/cli/Settings/ConnectionSettings.cs +++ b/src/cli/Settings/ConnectionSettings.cs @@ -1,6 +1,7 @@ namespace cli { using System.ComponentModel.DataAnnotations.Schema; + using System.Runtime.Serialization; using Newtonsoft.Json; using Yavsc; diff --git a/src/cli/cli.csproj b/src/cli/cli.csproj index 237ccdd8..010c4eaf 100644 --- a/src/cli/cli.csproj +++ b/src/cli/cli.csproj @@ -7,7 +7,7 @@ true 1.1.0.0 1.1.0.0 - 1.1.0-beta.1+49.Branch.release-1.0.8-rc3.Sha.5274d7bdf5d14406748a2063b5ae15191aac4359 + 1.1.0-beta.1+1.Branch.release-1.0.8-rc1.Sha.1167169aa89e1bf25290e9a152d27b357a500ab3 1.1.0-beta.1 @@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/yavsc.sln b/yavsc.sln index 00b90dea..33ecf0fc 100644 --- a/yavsc.sln +++ b/yavsc.sln @@ -37,7 +37,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc.Tests.Shared", "src\Y EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc.Api.Client", "src\Yavsc.Api.Client\Yavsc.Api.Client.csproj", "{59AF5DEA-D349-495A-BC44-FC7BD4E55099}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt.Tests", "src\PostIt\PostIt.Tests\PostIt.Tests.csproj", "{021E6F5A-B81D-42A7-9918-DFE39B424FC2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt.Tests", "src\PostIt.Tests\PostIt.Tests.csproj", "{838B9737-88CA-432E-835C-F96817CF8085}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -217,18 +217,18 @@ Global {59AF5DEA-D349-495A-BC44-FC7BD4E55099}.Release|x64.Build.0 = Release|Any CPU {59AF5DEA-D349-495A-BC44-FC7BD4E55099}.Release|x86.ActiveCfg = Release|Any CPU {59AF5DEA-D349-495A-BC44-FC7BD4E55099}.Release|x86.Build.0 = Release|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Debug|x64.ActiveCfg = Debug|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Debug|x64.Build.0 = Debug|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Debug|x86.ActiveCfg = Debug|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Debug|x86.Build.0 = Debug|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Release|Any CPU.Build.0 = Release|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Release|x64.ActiveCfg = Release|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Release|x64.Build.0 = Release|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Release|x86.ActiveCfg = Release|Any CPU - {021E6F5A-B81D-42A7-9918-DFE39B424FC2}.Release|x86.Build.0 = Release|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Debug|Any CPU.Build.0 = Debug|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Debug|x64.ActiveCfg = Debug|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Debug|x64.Build.0 = Debug|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Debug|x86.ActiveCfg = Debug|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Debug|x86.Build.0 = Debug|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Release|Any CPU.ActiveCfg = Release|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Release|Any CPU.Build.0 = Release|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Release|x64.ActiveCfg = Release|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Release|x64.Build.0 = Release|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Release|x86.ActiveCfg = Release|Any CPU + {838B9737-88CA-432E-835C-F96817CF8085}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -249,6 +249,6 @@ Global {0E471075-DABF-40E9-98B7-1630BEF19145} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2} {34D1F73D-BF74-47CC-9358-9F4F221C75D7} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2} {59AF5DEA-D349-495A-BC44-FC7BD4E55099} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2} - {021E6F5A-B81D-42A7-9918-DFE39B424FC2} = {E13D107F-4053-D0DE-6394-453609595BFE} + {838B9737-88CA-432E-835C-F96817CF8085} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2} EndGlobalSection EndGlobal