diff --git a/src/Artemis.Storage/Entities/Workshop/EntryEntity.cs b/src/Artemis.Storage/Entities/Workshop/EntryEntity.cs index e1680ec1f..86bff6dcd 100644 --- a/src/Artemis.Storage/Entities/Workshop/EntryEntity.cs +++ b/src/Artemis.Storage/Entities/Workshop/EntryEntity.cs @@ -6,14 +6,14 @@ public class EntryEntity { public Guid Id { get; set; } - public Guid EntryId { get; set; } + public long EntryId { get; set; } public int EntryType { get; set; } public string Author { get; set; } public string Name { get; set; } = string.Empty; public string Summary { get; set; } = string.Empty; - public Guid ReleaseId { get; set; } + public long ReleaseId { get; set; } public string ReleaseVersion { get; set; } public DateTimeOffset InstalledAt { get; set; } diff --git a/src/Artemis.Storage/Repositories/EntryRepository.cs b/src/Artemis.Storage/Repositories/EntryRepository.cs index b4a572535..61d3da672 100644 --- a/src/Artemis.Storage/Repositories/EntryRepository.cs +++ b/src/Artemis.Storage/Repositories/EntryRepository.cs @@ -32,7 +32,7 @@ internal class EntryRepository : IEntryRepository return _repository.FirstOrDefault(s => s.Id == id); } - public EntryEntity GetByEntryId(Guid entryId) + public EntryEntity GetByEntryId(long entryId) { return _repository.FirstOrDefault(s => s.EntryId == entryId); } diff --git a/src/Artemis.Storage/Repositories/Interfaces/IEntryRepository.cs b/src/Artemis.Storage/Repositories/Interfaces/IEntryRepository.cs index 19429b863..1e9ecd1c5 100644 --- a/src/Artemis.Storage/Repositories/Interfaces/IEntryRepository.cs +++ b/src/Artemis.Storage/Repositories/Interfaces/IEntryRepository.cs @@ -9,7 +9,7 @@ public interface IEntryRepository : IRepository void Add(EntryEntity entryEntity); void Remove(EntryEntity entryEntity); EntryEntity Get(Guid id); - EntryEntity GetByEntryId(Guid entryId); + EntryEntity GetByEntryId(long entryId); List GetAll(); void Save(EntryEntity entryEntity); void Save(IEnumerable entryEntities); diff --git a/src/Artemis.UI.Shared/Routing/Route/ParameterParsers/LongParameterParser.cs b/src/Artemis.UI.Shared/Routing/Route/ParameterParsers/LongParameterParser.cs new file mode 100644 index 000000000..a8e098579 --- /dev/null +++ b/src/Artemis.UI.Shared/Routing/Route/ParameterParsers/LongParameterParser.cs @@ -0,0 +1,17 @@ + +namespace Artemis.UI.Shared.Routing.ParameterParsers; + +internal class LongParameterParser : IRouteParameterParser +{ + /// + public bool IsMatch(RouteSegment segment, string source) + { + return long.TryParse(source, out _); + } + + /// + public object GetValue(RouteSegment segment, string source) + { + return long.Parse(source); + } +} \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Routing/Route/RouteSegment.cs b/src/Artemis.UI.Shared/Routing/Route/RouteSegment.cs index 1f25b67da..b92e36c3a 100644 --- a/src/Artemis.UI.Shared/Routing/Route/RouteSegment.cs +++ b/src/Artemis.UI.Shared/Routing/Route/RouteSegment.cs @@ -79,6 +79,7 @@ public partial class RouteSegment return parameterType switch { "guid" => new GuidParameterParser(), + "long" => new LongParameterParser(), "int" => new IntParameterParser(), _ => new StringParameterParser() }; diff --git a/src/Artemis.UI/Converters/EntryIconUriConverter.cs b/src/Artemis.UI/Converters/EntryIconUriConverter.cs index eab7630ea..fdd185fec 100644 --- a/src/Artemis.UI/Converters/EntryIconUriConverter.cs +++ b/src/Artemis.UI/Converters/EntryIconUriConverter.cs @@ -9,11 +9,9 @@ public class EntryIconUriConverter : IValueConverter { public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { - if (value is Guid guid) - return $"{WorkshopConstants.WORKSHOP_URL}/entries/{guid}/icon"; - return value; + return $"{WorkshopConstants.WORKSHOP_URL}/entries/{value}/icon"; } - + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { return value; diff --git a/src/Artemis.UI/Routing/Routes.cs b/src/Artemis.UI/Routing/Routes.cs index 209c89dea..9516439a9 100644 --- a/src/Artemis.UI/Routing/Routes.cs +++ b/src/Artemis.UI/Routing/Routes.cs @@ -33,10 +33,10 @@ public static class Routes Children = new List { new RouteRegistration("profiles/{page:int}"), - new RouteRegistration("profiles/details/{entryId:guid}"), + new RouteRegistration("profiles/details/{entryId:long}"), #if DEBUG new RouteRegistration("layouts/{page:int}"), - new RouteRegistration("layouts/details/{entryId:guid}"), + new RouteRegistration("layouts/details/{entryId:long}"), #endif } }, @@ -46,7 +46,7 @@ public static class Routes { new RouteRegistration("installed"), new RouteRegistration("submissions"), - new RouteRegistration("submissions/{entryId:guid}"), + new RouteRegistration("submissions/{entryId:long}"), } } } diff --git a/src/Artemis.UI/Screens/Workshop/Categories/CategoriesViewModel.cs b/src/Artemis.UI/Screens/Workshop/Categories/CategoriesViewModel.cs index a72737141..74d0f629e 100644 --- a/src/Artemis.UI/Screens/Workshop/Categories/CategoriesViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Categories/CategoriesViewModel.cs @@ -46,16 +46,16 @@ public class CategoriesViewModel : ActivatableViewModelBase private IReadOnlyList? CreateFilter() { - List categories = Categories.Where(c => c.IsSelected).Select(c => (int?) c.Id).ToList(); + List categories = Categories.Where(c => c.IsSelected).Select(c => (long?) c.Id).ToList(); if (!categories.Any()) return null; List categoryFilters = new(); - foreach (int? category in categories) + foreach (long? category in categories) { categoryFilters.Add(new EntryFilterInput { - Categories = new ListFilterInputTypeOfCategoryFilterInput {Some = new CategoryFilterInput {Id = new IntOperationFilterInput {Eq = category}}} + Categories = new ListFilterInputTypeOfCategoryFilterInput {Some = new CategoryFilterInput {Id = new LongOperationFilterInput {Eq = category}}} }); } diff --git a/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs b/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs index 08d991009..328b43c2a 100644 --- a/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs @@ -17,7 +17,7 @@ public class CategoryViewModel : ViewModelBase Icon = icon as MaterialIconKind? ?? MaterialIconKind.QuestionMarkCircle; } - public int Id { get; } + public long Id { get; } public string Name { get; } public MaterialIconKind Icon { get; } diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs index c06cde881..cc9d289eb 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs @@ -48,7 +48,7 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase .AutoRefresh(c => c.IsSelected) .Filter(c => c.IsSelected) .Transform(c => c.Id) - .Bind(out ReadOnlyObservableCollection selectedCategories) + .Bind(out ReadOnlyObservableCollection selectedCategories) .Subscribe(); SelectedCategories = selectedCategories; @@ -85,7 +85,7 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase public ObservableCollection Categories { get; } = new(); public ObservableCollection Tags { get; } = new(); - public ReadOnlyObservableCollection SelectedCategories { get; } + public ReadOnlyObservableCollection SelectedCategories { get; } public bool CategoriesValid => _categoriesValid.Value ; public bool IconValid => _iconValid.Value; @@ -127,7 +127,7 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase private set => RaiseAndSetIfChanged(ref _iconChanged, value); } - public List PreselectedCategories { get; set; } = new(); + public List PreselectedCategories { get; set; } = new(); private void MarkdownDocumentOnTextChanged(object? sender, EventArgs e) { diff --git a/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs index 45de1c801..179fd95df 100644 --- a/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs @@ -48,7 +48,7 @@ public class LayoutDetailsViewModel : RoutableScreen await GetEntry(parameters.EntryId, cancellationToken); } - private async Task GetEntry(Guid entryId, CancellationToken cancellationToken) + private async Task GetEntry(long entryId, CancellationToken cancellationToken) { IOperationResult result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken); if (result.IsErrorResult()) diff --git a/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs index 61270df28..7d94935c0 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs @@ -136,7 +136,7 @@ public class SubmissionDetailViewModel : RoutableScreen categories = EntrySpecificationsViewModel.Categories.Where(c => c.IsSelected).Select(c => c.Id).OrderBy(c => c).ToList(); + List categories = EntrySpecificationsViewModel.Categories.Where(c => c.IsSelected).Select(c => c.Id).OrderBy(c => c).ToList(); List tags = EntrySpecificationsViewModel.Tags.OrderBy(t => t).ToList(); HasChanges = EntrySpecificationsViewModel.Name != Entry.Name || diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs index 14ae89b70..76947ec5d 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs @@ -19,7 +19,7 @@ namespace Artemis.UI.Screens.Workshop.Library.Tabs; public class SubmissionsTabViewModel : RoutableScreen { private readonly IWorkshopClient _client; - private readonly SourceCache _entries; + private readonly SourceCache _entries; private readonly IWindowService _windowService; private bool _isLoading = true; private bool _workshopReachable; @@ -32,7 +32,7 @@ public class SubmissionsTabViewModel : RoutableScreen { _client = client; _windowService = windowService; - _entries = new SourceCache(e => e.Id); + _entries = new SourceCache(e => e.Id); _entries.Connect() .Transform(getSubmissionsTabItemViewModel) .Bind(out ReadOnlyObservableCollection entries) @@ -54,7 +54,6 @@ public class SubmissionsTabViewModel : RoutableScreen public ReactiveCommand Login { get; } public ReactiveCommand AddSubmission { get; } - public ReactiveCommand NavigateToEntry { get; } public IObservable IsLoggedIn { get; } public ReadOnlyObservableCollection Entries { get; } diff --git a/src/Artemis.UI/Screens/Workshop/Parameters/WorkshopDetailParameters.cs b/src/Artemis.UI/Screens/Workshop/Parameters/WorkshopDetailParameters.cs index dfd37805f..86503f0d4 100644 --- a/src/Artemis.UI/Screens/Workshop/Parameters/WorkshopDetailParameters.cs +++ b/src/Artemis.UI/Screens/Workshop/Parameters/WorkshopDetailParameters.cs @@ -1,8 +1,6 @@ -using System; - namespace Artemis.UI.Screens.Workshop.Parameters; public class WorkshopDetailParameters { - public Guid EntryId { get; set; } + public long EntryId { get; set; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs index 80a09c02e..39d355073 100644 --- a/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs @@ -3,7 +3,6 @@ using System.Reactive; using System.Reactive.Linq; using System.Threading; using System.Threading.Tasks; -using Artemis.Core; using Artemis.UI.Screens.Workshop.Parameters; using Artemis.UI.Shared.Routing; using Artemis.UI.Shared.Services; @@ -52,7 +51,7 @@ public class ProfileDetailsViewModel : RoutableScreen await GetEntry(parameters.EntryId, cancellationToken); } - private async Task GetEntry(Guid entryId, CancellationToken cancellationToken) + private async Task GetEntry(long entryId, CancellationToken cancellationToken) { IOperationResult result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken); if (result.IsErrorResult()) diff --git a/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs b/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs index 4fe24197d..000f0a330 100644 --- a/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Artemis.UI.Screens.Workshop.CurrentUser; using Artemis.UI.Services.Interfaces; using Artemis.UI.Shared; -using Artemis.UI.Shared.Routing; using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop.Services; using ReactiveUI; @@ -18,17 +17,17 @@ namespace Artemis.UI.Screens.Workshop.Search; public class SearchViewModel : ViewModelBase { private readonly ILogger _logger; - private readonly IRouter _router; + private readonly IWorkshopService _workshopService; private readonly IDebugService _debugService; private readonly IWorkshopClient _workshopClient; private bool _isLoading; private SearchResultViewModel? _selectedEntry; - public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IRouter router, CurrentUserViewModel currentUserViewModel, IDebugService debugService) + public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, CurrentUserViewModel currentUserViewModel, IDebugService debugService) { _logger = logger; _workshopClient = workshopClient; - _router = router; + _workshopService = workshopService; _debugService = debugService; CurrentUserViewModel = currentUserViewModel; SearchAsync = ExecuteSearchAsync; @@ -59,14 +58,7 @@ public class SearchViewModel : ViewModelBase private void NavigateToEntry(SearchResultViewModel searchResult) { - string? url = null; - if (searchResult.Entry.EntryType == WebClient.Workshop.EntryType.Profile) - url = $"workshop/entries/profiles/{searchResult.Entry.Id}"; - if (searchResult.Entry.EntryType == WebClient.Workshop.EntryType.Layout) - url = $"workshop/entries/layouts/{searchResult.Entry.Id}"; - - if (url != null) - Task.Run(() => _router.Navigate(url)); + _workshopService.NavigateToEntry(searchResult.Entry.Id, searchResult.Entry.EntryType); } private async Task> ExecuteSearchAsync(string? input, CancellationToken cancellationToken) diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs index 689f80c4e..ab59d122f 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs @@ -11,12 +11,14 @@ using Artemis.WebClient.Workshop.Exceptions; using Artemis.WebClient.Workshop.Handlers.UploadHandlers; using Artemis.WebClient.Workshop.Services; using ReactiveUI; +using Serilog; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; public class UploadStepViewModel : SubmissionViewModel { + private readonly ILogger _logger; private readonly EntryUploadHandlerFactory _entryUploadHandlerFactory; private readonly Progress _progress = new(); private readonly ObservableAsPropertyHelper _progressIndeterminate; @@ -26,14 +28,20 @@ public class UploadStepViewModel : SubmissionViewModel private readonly IWorkshopClient _workshopClient; private readonly IWorkshopService _workshopService; - private Guid? _entryId; + private long? _entryId; private bool _failed; private bool _finished; private bool _succeeded; /// - public UploadStepViewModel(IWorkshopClient workshopClient, IWorkshopService workshopService, EntryUploadHandlerFactory entryUploadHandlerFactory, IWindowService windowService, IRouter router) + public UploadStepViewModel(ILogger logger, + IWorkshopClient workshopClient, + IWorkshopService workshopService, + EntryUploadHandlerFactory entryUploadHandlerFactory, + IWindowService windowService, + IRouter router) { + _logger = logger; _workshopClient = workshopClient; _workshopService = workshopService; _entryUploadHandlerFactory = entryUploadHandlerFactory; @@ -101,8 +109,10 @@ public class UploadStepViewModel : SubmissionViewModel Succeeded = true; } - catch (Exception) + catch (Exception e) { + _logger.Error(e, "Failed to upload submission for entry {EntryId}", _entryId); + // Something went wrong when creating a release :c // We'll keep the workshop entry so that the user can make changes and try again Failed = true; @@ -113,7 +123,7 @@ public class UploadStepViewModel : SubmissionViewModel } } - private async Task CreateEntry(CancellationToken cancellationToken) + private async Task CreateEntry(CancellationToken cancellationToken) { IOperationResult result = await _workshopClient.AddEntry.ExecuteAsync(new CreateEntryInput { @@ -125,7 +135,7 @@ public class UploadStepViewModel : SubmissionViewModel Tags = State.Tags }, cancellationToken); - Guid? entryId = result.Data?.AddEntry?.Id; + long? entryId = result.Data?.AddEntry?.Id; if (result.IsErrorResult() || entryId == null) { await _windowService.ShowConfirmContentDialog("Failed to create workshop entry", result.Errors.ToString() ?? "Not even an error message", "Close", null); diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs index b6f8d53fc..893896621 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs @@ -22,14 +22,14 @@ public class SubmissionWizardState } public EntryType EntryType { get; set; } - public Guid? EntryId { get; set; } + public long? EntryId { get; set; } public string Name { get; set; } = string.Empty; public Stream? Icon { get; set; } public string Summary { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; - public List Categories { get; set; } = new(); + public List Categories { get; set; } = new(); public List Tags { get; set; } = new(); public List Images { get; set; } = new(); diff --git a/src/Artemis.WebClient.Workshop/Entities/Release.cs b/src/Artemis.WebClient.Workshop/Entities/Release.cs index e2c2d1146..ace9fb21f 100644 --- a/src/Artemis.WebClient.Workshop/Entities/Release.cs +++ b/src/Artemis.WebClient.Workshop/Entities/Release.cs @@ -1,10 +1,10 @@ using System.ComponentModel.DataAnnotations; -namespace Artemis.Web.Workshop.Entities; +namespace Artemis.WebClient.Workshop.Entities; public class Release { - public Guid Id { get; set; } + public long Id { get; set; } [MaxLength(64)] public string Version { get; set; } = string.Empty; @@ -18,5 +18,5 @@ public class Release [MaxLength(32)] public string? Md5Hash { get; set; } - public Guid EntryId { get; set; } + public long EntryId { get; set; } } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/IEntryInstallationHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/IEntryInstallationHandler.cs index 91b3fb7f8..d8e7ba951 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/IEntryInstallationHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/IEntryInstallationHandler.cs @@ -5,6 +5,6 @@ namespace Artemis.WebClient.Workshop.Handlers.InstallationHandlers; public interface IEntryInstallationHandler { - Task InstallAsync(IGetEntryById_Entry entry, Guid releaseId, Progress progress, CancellationToken cancellationToken); + Task InstallAsync(IGetEntryById_Entry entry, long releaseId, Progress progress, CancellationToken cancellationToken); Task UninstallAsync(InstalledEntry installedEntry, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs index c61921b06..f3473f66a 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs @@ -19,7 +19,7 @@ public class ProfileEntryInstallationHandler : IEntryInstallationHandler _workshopService = workshopService; } - public async Task InstallAsync(IGetEntryById_Entry entry, Guid releaseId, Progress progress, CancellationToken cancellationToken) + public async Task InstallAsync(IGetEntryById_Entry entry, long releaseId, Progress progress, CancellationToken cancellationToken) { using MemoryStream stream = new(); @@ -89,7 +89,7 @@ public class ProfileEntryInstallationHandler : IEntryInstallationHandler }, cancellationToken); } - private void UpdateRelease(Guid releaseId, InstalledEntry installedEntry) + private void UpdateRelease(long releaseId, InstalledEntry installedEntry) { installedEntry.ReleaseId = releaseId; installedEntry.ReleaseVersion = "TODO"; diff --git a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/EntryUploadResult.cs b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/EntryUploadResult.cs index 477201b24..f55a3dd77 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/EntryUploadResult.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/EntryUploadResult.cs @@ -1,4 +1,4 @@ -using Artemis.Web.Workshop.Entities; +using Artemis.WebClient.Workshop.Entities; namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers; diff --git a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/IEntryUploadHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/IEntryUploadHandler.cs index 85a316600..88ff68896 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/IEntryUploadHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/IEntryUploadHandler.cs @@ -4,5 +4,5 @@ namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers; public interface IEntryUploadHandler { - Task CreateReleaseAsync(Guid entryId, object file, Progress progress, CancellationToken cancellationToken); + Task CreateReleaseAsync(long entryId, object file, Progress progress, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/LayoutEntryUploadHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/LayoutEntryUploadHandler.cs index ac3d0e739..0b16fae3d 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/LayoutEntryUploadHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/LayoutEntryUploadHandler.cs @@ -5,7 +5,7 @@ namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers.Implementations; public class LayoutEntryUploadHandler : IEntryUploadHandler { /// - public async Task CreateReleaseAsync(Guid entryId, object file, Progress progress, CancellationToken cancellationToken) + public async Task CreateReleaseAsync(long entryId, object file, Progress progress, CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/ProfileEntryUploadHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/ProfileEntryUploadHandler.cs index b5ecc03c2..4ec607d85 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/ProfileEntryUploadHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/UploadHandlers/Implementations/ProfileEntryUploadHandler.cs @@ -2,7 +2,7 @@ using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Shared.Utilities; -using Artemis.Web.Workshop.Entities; +using Artemis.WebClient.Workshop.Entities; using Newtonsoft.Json; namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers.Implementations; @@ -19,7 +19,7 @@ public class ProfileEntryUploadHandler : IEntryUploadHandler } /// - public async Task CreateReleaseAsync(Guid entryId, object file, Progress progress, CancellationToken cancellationToken) + public async Task CreateReleaseAsync(long entryId, object file, Progress progress, CancellationToken cancellationToken) { if (file is not ProfileConfiguration profileConfiguration) throw new InvalidOperationException("Can only create releases for profile configurations"); diff --git a/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql b/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql index 5933626a0..932ccef30 100644 --- a/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql @@ -1,4 +1,4 @@ -query GetEntryById($id: UUID!) { +query GetEntryById($id: Long!) { entry(id: $id) { id author diff --git a/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql b/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql index 92da65c60..ea7b0bab3 100644 --- a/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql @@ -1,4 +1,4 @@ -query GetSubmittedEntryById($id: UUID!) { +query GetSubmittedEntryById($id: Long!) { entry(id: $id) { id name diff --git a/src/Artemis.WebClient.Workshop/Queries/RemoveEntry.graphql b/src/Artemis.WebClient.Workshop/Queries/RemoveEntry.graphql index 4f46da2c5..983fbe0d9 100644 --- a/src/Artemis.WebClient.Workshop/Queries/RemoveEntry.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/RemoveEntry.graphql @@ -1,4 +1,4 @@ -mutation RemoveEntry ($id: UUID!) { +mutation RemoveEntry ($id: Long!) { removeEntry(id: $id) { id } diff --git a/src/Artemis.WebClient.Workshop/Services/InstalledEntry.cs b/src/Artemis.WebClient.Workshop/Services/InstalledEntry.cs index 073c74584..8d5cebd18 100644 --- a/src/Artemis.WebClient.Workshop/Services/InstalledEntry.cs +++ b/src/Artemis.WebClient.Workshop/Services/InstalledEntry.cs @@ -22,13 +22,13 @@ public class InstalledEntry Name = entry.Name; } - public Guid EntryId { get; set; } + public long EntryId { get; set; } public EntryType EntryType { get; set; } public string Author { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; - public Guid ReleaseId { get; set; } + public long ReleaseId { get; set; } public string ReleaseVersion { get; set; } = string.Empty; public DateTimeOffset InstalledAt { get; set; } diff --git a/src/Artemis.WebClient.Workshop/Services/Interfaces/IWorkshopService.cs b/src/Artemis.WebClient.Workshop/Services/Interfaces/IWorkshopService.cs index 576b72b37..3f2303c00 100644 --- a/src/Artemis.WebClient.Workshop/Services/Interfaces/IWorkshopService.cs +++ b/src/Artemis.WebClient.Workshop/Services/Interfaces/IWorkshopService.cs @@ -5,11 +5,11 @@ namespace Artemis.WebClient.Workshop.Services; public interface IWorkshopService { - Task GetEntryIcon(Guid entryId, CancellationToken cancellationToken); - Task SetEntryIcon(Guid entryId, Progress progress, Stream icon, CancellationToken cancellationToken); + Task GetEntryIcon(long entryId, CancellationToken cancellationToken); + Task SetEntryIcon(long entryId, Progress progress, Stream icon, CancellationToken cancellationToken); Task GetWorkshopStatus(CancellationToken cancellationToken); Task ValidateWorkshopStatus(CancellationToken cancellationToken); - Task NavigateToEntry(Guid entryId, EntryType entryType); + Task NavigateToEntry(long entryId, EntryType entryType); List GetInstalledEntries(); InstalledEntry? GetInstalledEntry(IGetEntryById_Entry entry); diff --git a/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs b/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs index db3a15ae7..f40a15375 100644 --- a/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs +++ b/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs @@ -20,7 +20,7 @@ public class WorkshopService : IWorkshopService _entryRepository = entryRepository; } - public async Task GetEntryIcon(Guid entryId, CancellationToken cancellationToken) + public async Task GetEntryIcon(long entryId, CancellationToken cancellationToken) { HttpClient client = _httpClientFactory.CreateClient(WorkshopConstants.WORKSHOP_CLIENT_NAME); try @@ -36,7 +36,7 @@ public class WorkshopService : IWorkshopService } } - public async Task SetEntryIcon(Guid entryId, Progress progress, Stream icon, CancellationToken cancellationToken) + public async Task SetEntryIcon(long entryId, Progress progress, Stream icon, CancellationToken cancellationToken) { icon.Seek(0, SeekOrigin.Begin); @@ -85,7 +85,7 @@ public class WorkshopService : IWorkshopService return status.IsReachable; } - public async Task NavigateToEntry(Guid entryId, EntryType entryType) + public async Task NavigateToEntry(long entryId, EntryType entryType) { switch (entryType) { diff --git a/src/Artemis.WebClient.Workshop/WorkshopConstants.cs b/src/Artemis.WebClient.Workshop/WorkshopConstants.cs index 192a92b56..1dcfa737d 100644 --- a/src/Artemis.WebClient.Workshop/WorkshopConstants.cs +++ b/src/Artemis.WebClient.Workshop/WorkshopConstants.cs @@ -2,7 +2,7 @@ namespace Artemis.WebClient.Workshop; public static class WorkshopConstants { - public const string AUTHORITY_URL = "https://identity.artemis-rgb.com"; - public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com"; + public const string AUTHORITY_URL = "https://localhost:5001"; + public const string WORKSHOP_URL = "https://localhost:7281"; public const string WORKSHOP_CLIENT_NAME = "WorkshopApiClient"; } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/schema.graphql b/src/Artemis.WebClient.Workshop/schema.graphql index 52b3ebb56..c889bca85 100644 --- a/src/Artemis.WebClient.Workshop/schema.graphql +++ b/src/Artemis.WebClient.Workshop/schema.graphql @@ -7,7 +7,7 @@ schema { type Category { icon: String! - id: Int! + id: Long! name: String! } @@ -38,10 +38,10 @@ type Entry { entryType: EntryType! icon: Image iconId: UUID - id: UUID! + id: Long! images: [Image!]! latestRelease: Release - latestReleaseId: UUID + latestReleaseId: Long name: String! releases: [Release!]! summary: String! @@ -55,14 +55,14 @@ type Image { type Mutation { addEntry(input: CreateEntryInput!): Entry - removeEntry(id: UUID!): Entry + removeEntry(id: Long!): Entry updateEntry(input: UpdateEntryInput!): Entry } type Query { categories(order: [CategorySortInput!], where: CategoryFilterInput): [Category!]! entries(order: [EntrySortInput!], skip: Int, take: Int, where: EntryFilterInput): EntriesCollectionSegment - entry(id: UUID!): Entry + entry(id: Long!): Entry searchEntries(input: String!, order: [EntrySortInput!], type: EntryType, where: EntryFilterInput): [Entry!]! submittedEntries(order: [EntrySortInput!], where: EntryFilterInput): [Entry!]! } @@ -72,14 +72,14 @@ type Release { downloadSize: Long! downloads: Long! entry: Entry! - entryId: UUID! - id: UUID! + entryId: Long! + id: Long! md5Hash: String version: String! } type Tag { - id: Int! + id: Long! name: String! } @@ -111,7 +111,7 @@ scalar UUID input CategoryFilterInput { and: [CategoryFilterInput!] icon: StringOperationFilterInput - id: IntOperationFilterInput + id: LongOperationFilterInput name: StringOperationFilterInput or: [CategoryFilterInput!] } @@ -123,7 +123,7 @@ input CategorySortInput { } input CreateEntryInput { - categories: [Int!]! + categories: [Long!]! description: String! entryType: EntryType! name: String! @@ -157,10 +157,10 @@ input EntryFilterInput { entryType: EntryTypeOperationFilterInput icon: ImageFilterInput iconId: UuidOperationFilterInput - id: UuidOperationFilterInput + id: LongOperationFilterInput images: ListFilterInputTypeOfImageFilterInput latestRelease: ReleaseFilterInput - latestReleaseId: UuidOperationFilterInput + latestReleaseId: LongOperationFilterInput name: StringOperationFilterInput or: [EntryFilterInput!] releases: ListFilterInputTypeOfReleaseFilterInput @@ -203,21 +203,6 @@ input ImageSortInput { mimeType: SortEnumType } -input IntOperationFilterInput { - eq: Int - gt: Int - gte: Int - in: [Int] - lt: Int - lte: Int - neq: Int - ngt: Int - ngte: Int - nin: [Int] - nlt: Int - nlte: Int -} - input ListFilterInputTypeOfCategoryFilterInput { all: CategoryFilterInput any: Boolean @@ -267,8 +252,8 @@ input ReleaseFilterInput { downloadSize: LongOperationFilterInput downloads: LongOperationFilterInput entry: EntryFilterInput - entryId: UuidOperationFilterInput - id: UuidOperationFilterInput + entryId: LongOperationFilterInput + id: LongOperationFilterInput md5Hash: StringOperationFilterInput or: [ReleaseFilterInput!] version: StringOperationFilterInput @@ -302,15 +287,15 @@ input StringOperationFilterInput { input TagFilterInput { and: [TagFilterInput!] - id: IntOperationFilterInput + id: LongOperationFilterInput name: StringOperationFilterInput or: [TagFilterInput!] } input UpdateEntryInput { - categories: [Int!]! + categories: [Long!]! description: String! - id: UUID! + id: Long! name: String! summary: String! tags: [String!]!