From 4b18003aa80b7b9aad9ae335ab0ef2155c8b0c69 Mon Sep 17 00:00:00 2001 From: Simon Diesenreiter Date: Wed, 25 Jun 2025 09:48:27 +0200 Subject: [PATCH] fix: fix formatting, refs NOISSUE --- .../MessengerIntegration/SignalIntegration.cs | 8 ++++---- song_of_the_day/Pages/Index.cshtml.cs | 11 ++++++----- song_of_the_day/Pages/Shared/SongPartialModel.cs | 2 +- song_of_the_day/Pages/SongSubmission.cshtml.cs | 2 +- song_of_the_day/Pages/UnclaimedPhoneNumbers.cshtml.cs | 2 +- .../SongValidators/Base64UrlImageBuilder.cs | 4 ++-- song_of_the_day/SongValidators/SpotifyValidator.cs | 2 +- .../SongValidators/UriBasedSongValidatorBase.cs | 2 +- song_of_the_day/SongValidators/YoutubeValidator.cs | 6 +++--- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/song_of_the_day/MessengerIntegration/SignalIntegration.cs b/song_of_the_day/MessengerIntegration/SignalIntegration.cs index 7605544..9af1311 100644 --- a/song_of_the_day/MessengerIntegration/SignalIntegration.cs +++ b/song_of_the_day/MessengerIntegration/SignalIntegration.cs @@ -3,10 +3,10 @@ using song_of_the_day; public class LinkPreviewAttachment { - public string Url { get; set; } - public string Title { get; set; } - public string Description { get; set; } - public string Base64Image { get; set; } + public required string Url { get; set; } + public required string Title { get; set; } + public required string Description { get; set; } + public required string Base64Image { get; set; } } public class SignalIntegration diff --git a/song_of_the_day/Pages/Index.cshtml.cs b/song_of_the_day/Pages/Index.cshtml.cs index f5edbb9..bd569c9 100644 --- a/song_of_the_day/Pages/Index.cshtml.cs +++ b/song_of_the_day/Pages/Index.cshtml.cs @@ -17,13 +17,14 @@ public class IndexModel : PageModel [BindProperty] public List SongSuggestions { get; set; } = new List(); - public async Task OnGet() - { + public Task OnGet() + { using var dci = DataContext.Instance; - this.SongSuggestions = dci.SongSuggestions.OrderByDescending(s => s.Date) + SongSuggestions = dci.SongSuggestions.OrderByDescending(s => s.Date) .Take(50) .Include(s => s.Song) .Include(s => s.User) - .ToList(); - } + .ToList(); + return Task.CompletedTask; + } } diff --git a/song_of_the_day/Pages/Shared/SongPartialModel.cs b/song_of_the_day/Pages/Shared/SongPartialModel.cs index 53e91bc..a1536e8 100644 --- a/song_of_the_day/Pages/Shared/SongPartialModel.cs +++ b/song_of_the_day/Pages/Shared/SongPartialModel.cs @@ -1,6 +1,6 @@ public class SongPartialModel { - public Song InnerSong { get; set; } + public required Song InnerSong { get; set; } public string? Artist => InnerSong.Artist; diff --git a/song_of_the_day/Pages/SongSubmission.cshtml.cs b/song_of_the_day/Pages/SongSubmission.cshtml.cs index cf83cdd..e6d5822 100644 --- a/song_of_the_day/Pages/SongSubmission.cshtml.cs +++ b/song_of_the_day/Pages/SongSubmission.cshtml.cs @@ -40,7 +40,7 @@ public class SongSubmissionModel : PageModel public bool IsPageReadonly { get; set; } = false; [BindProperty] - public SuggestionHelper SuggestionHelper { get; set; } = null; + public SuggestionHelper? SuggestionHelper { get; set; } = null; [BindProperty] public List UserSongSubmissions { get; set; } = []; diff --git a/song_of_the_day/Pages/UnclaimedPhoneNumbers.cshtml.cs b/song_of_the_day/Pages/UnclaimedPhoneNumbers.cshtml.cs index 4019874..d9d9710 100644 --- a/song_of_the_day/Pages/UnclaimedPhoneNumbers.cshtml.cs +++ b/song_of_the_day/Pages/UnclaimedPhoneNumbers.cshtml.cs @@ -24,7 +24,7 @@ public class UnclaimedPhoneNumbersModel : PageModel { using (var dci = DataContext.Instance) { - this.UnclaimedUsers = dci.Users == null ? new List(): dci.Users.Where(u => string.IsNullOrEmpty(u.LdapUserName)).ToList(); + this.UnclaimedUsers = dci.Users == null ? new List() : dci.Users.Where(u => string.IsNullOrEmpty(u.LdapUserName)).ToList(); } } diff --git a/song_of_the_day/SongValidators/Base64UrlImageBuilder.cs b/song_of_the_day/SongValidators/Base64UrlImageBuilder.cs index 1a5ef75..f7c7f2e 100644 --- a/song_of_the_day/SongValidators/Base64UrlImageBuilder.cs +++ b/song_of_the_day/SongValidators/Base64UrlImageBuilder.cs @@ -1,6 +1,6 @@ public class Base64UrlImageBuilder { - public string ContentType { set; get; } + public required string ContentType { set; get; } public string Url { @@ -13,7 +13,7 @@ public class Base64UrlImageBuilder } } - private string FileContents { get; set; } + private required string FileContents { get; set; } public override string ToString() { diff --git a/song_of_the_day/SongValidators/SpotifyValidator.cs b/song_of_the_day/SongValidators/SpotifyValidator.cs index a1d46fb..503b545 100644 --- a/song_of_the_day/SongValidators/SpotifyValidator.cs +++ b/song_of_the_day/SongValidators/SpotifyValidator.cs @@ -8,7 +8,7 @@ public class SpotifyValidator : UriBasedSongValidatorBase public override string UriValidatorRegex => @"^(https?://)?open.spotify.com/track/([a-zA-Z0-9_-]{22})(\?si=[a-zA-Z0-9_-]+)?$"; public SpotifyValidator(ILogger _logger, SpotifyApiClient spotifyApiClient) : base(_logger, spotifyApiClient) - {} + { } public override Task CanExtractSongMetadataAsync(Uri songUri) { diff --git a/song_of_the_day/SongValidators/UriBasedSongValidatorBase.cs b/song_of_the_day/SongValidators/UriBasedSongValidatorBase.cs index 6e25ecc..325324c 100644 --- a/song_of_the_day/SongValidators/UriBasedSongValidatorBase.cs +++ b/song_of_the_day/SongValidators/UriBasedSongValidatorBase.cs @@ -5,7 +5,7 @@ public abstract class UriBasedSongValidatorBase : SongValidatorBase public abstract string UriValidatorRegex { get; } public UriBasedSongValidatorBase(ILogger logger, SpotifyApiClient spotifyApiClient) : base(logger, spotifyApiClient) - {} + { } public Match GetUriMatch(Uri songUri) { diff --git a/song_of_the_day/SongValidators/YoutubeValidator.cs b/song_of_the_day/SongValidators/YoutubeValidator.cs index 470b97f..69a3986 100644 --- a/song_of_the_day/SongValidators/YoutubeValidator.cs +++ b/song_of_the_day/SongValidators/YoutubeValidator.cs @@ -6,7 +6,7 @@ using YouTubeMusicAPI.Client; public class YoutubeValidator : UriBasedSongValidatorBase { private YouTubeMusicClient youtubeClient; - + public YoutubeValidator(ILogger logger, SpotifyApiClient spotifyApiClient) : base(logger, spotifyApiClient) { youtubeClient = new("AT"); @@ -14,9 +14,9 @@ public class YoutubeValidator : UriBasedSongValidatorBase public override string UriValidatorRegex => @"^(https?://)?(www\.)?(youtube\.com/watch\?v=|youtu\.be/)([a-zA-Z0-9_-]{11})"; - public override async Task CanExtractSongMetadataAsync(Uri songUri) + public override Task CanExtractSongMetadataAsync(Uri songUri) { - return this.CanValidateUri(songUri); + return Task.FromResult(this.CanValidateUri(songUri)); } public override SongProvider GetSongProvider()