1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Workshop - Update workshop IDs to be long

This commit is contained in:
Robert 2023-09-09 13:30:26 +02:00
parent a798980eec
commit 0fdb40bd35
33 changed files with 102 additions and 103 deletions

View File

@ -6,14 +6,14 @@ public class EntryEntity
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid EntryId { get; set; } public long EntryId { get; set; }
public int EntryType { get; set; } public int EntryType { get; set; }
public string Author { get; set; } public string Author { get; set; }
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string Summary { 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 string ReleaseVersion { get; set; }
public DateTimeOffset InstalledAt { get; set; } public DateTimeOffset InstalledAt { get; set; }

View File

@ -32,7 +32,7 @@ internal class EntryRepository : IEntryRepository
return _repository.FirstOrDefault<EntryEntity>(s => s.Id == id); return _repository.FirstOrDefault<EntryEntity>(s => s.Id == id);
} }
public EntryEntity GetByEntryId(Guid entryId) public EntryEntity GetByEntryId(long entryId)
{ {
return _repository.FirstOrDefault<EntryEntity>(s => s.EntryId == entryId); return _repository.FirstOrDefault<EntryEntity>(s => s.EntryId == entryId);
} }

View File

@ -9,7 +9,7 @@ public interface IEntryRepository : IRepository
void Add(EntryEntity entryEntity); void Add(EntryEntity entryEntity);
void Remove(EntryEntity entryEntity); void Remove(EntryEntity entryEntity);
EntryEntity Get(Guid id); EntryEntity Get(Guid id);
EntryEntity GetByEntryId(Guid entryId); EntryEntity GetByEntryId(long entryId);
List<EntryEntity> GetAll(); List<EntryEntity> GetAll();
void Save(EntryEntity entryEntity); void Save(EntryEntity entryEntity);
void Save(IEnumerable<EntryEntity> entryEntities); void Save(IEnumerable<EntryEntity> entryEntities);

View File

@ -0,0 +1,17 @@
namespace Artemis.UI.Shared.Routing.ParameterParsers;
internal class LongParameterParser : IRouteParameterParser
{
/// <inheritdoc />
public bool IsMatch(RouteSegment segment, string source)
{
return long.TryParse(source, out _);
}
/// <inheritdoc />
public object GetValue(RouteSegment segment, string source)
{
return long.Parse(source);
}
}

View File

@ -79,6 +79,7 @@ public partial class RouteSegment
return parameterType switch return parameterType switch
{ {
"guid" => new GuidParameterParser(), "guid" => new GuidParameterParser(),
"long" => new LongParameterParser(),
"int" => new IntParameterParser(), "int" => new IntParameterParser(),
_ => new StringParameterParser() _ => new StringParameterParser()
}; };

View File

@ -9,11 +9,9 @@ public class EntryIconUriConverter : IValueConverter
{ {
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
if (value is Guid guid) return $"{WorkshopConstants.WORKSHOP_URL}/entries/{value}/icon";
return $"{WorkshopConstants.WORKSHOP_URL}/entries/{guid}/icon";
return value;
} }
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
return value; return value;

View File

@ -33,10 +33,10 @@ public static class Routes
Children = new List<IRouterRegistration> Children = new List<IRouterRegistration>
{ {
new RouteRegistration<ProfileListViewModel>("profiles/{page:int}"), new RouteRegistration<ProfileListViewModel>("profiles/{page:int}"),
new RouteRegistration<ProfileDetailsViewModel>("profiles/details/{entryId:guid}"), new RouteRegistration<ProfileDetailsViewModel>("profiles/details/{entryId:long}"),
#if DEBUG #if DEBUG
new RouteRegistration<LayoutListViewModel>("layouts/{page:int}"), new RouteRegistration<LayoutListViewModel>("layouts/{page:int}"),
new RouteRegistration<LayoutDetailsViewModel>("layouts/details/{entryId:guid}"), new RouteRegistration<LayoutDetailsViewModel>("layouts/details/{entryId:long}"),
#endif #endif
} }
}, },
@ -46,7 +46,7 @@ public static class Routes
{ {
new RouteRegistration<InstalledTabViewModel>("installed"), new RouteRegistration<InstalledTabViewModel>("installed"),
new RouteRegistration<SubmissionsTabViewModel>("submissions"), new RouteRegistration<SubmissionsTabViewModel>("submissions"),
new RouteRegistration<SubmissionDetailViewModel>("submissions/{entryId:guid}"), new RouteRegistration<SubmissionDetailViewModel>("submissions/{entryId:long}"),
} }
} }
} }

View File

@ -46,16 +46,16 @@ public class CategoriesViewModel : ActivatableViewModelBase
private IReadOnlyList<EntryFilterInput>? CreateFilter() private IReadOnlyList<EntryFilterInput>? CreateFilter()
{ {
List<int?> categories = Categories.Where(c => c.IsSelected).Select(c => (int?) c.Id).ToList(); List<long?> categories = Categories.Where(c => c.IsSelected).Select(c => (long?) c.Id).ToList();
if (!categories.Any()) if (!categories.Any())
return null; return null;
List<EntryFilterInput> categoryFilters = new(); List<EntryFilterInput> categoryFilters = new();
foreach (int? category in categories) foreach (long? category in categories)
{ {
categoryFilters.Add(new EntryFilterInput 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}}}
}); });
} }

View File

@ -17,7 +17,7 @@ public class CategoryViewModel : ViewModelBase
Icon = icon as MaterialIconKind? ?? MaterialIconKind.QuestionMarkCircle; Icon = icon as MaterialIconKind? ?? MaterialIconKind.QuestionMarkCircle;
} }
public int Id { get; } public long Id { get; }
public string Name { get; } public string Name { get; }
public MaterialIconKind Icon { get; } public MaterialIconKind Icon { get; }

View File

@ -48,7 +48,7 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase
.AutoRefresh(c => c.IsSelected) .AutoRefresh(c => c.IsSelected)
.Filter(c => c.IsSelected) .Filter(c => c.IsSelected)
.Transform(c => c.Id) .Transform(c => c.Id)
.Bind(out ReadOnlyObservableCollection<int> selectedCategories) .Bind(out ReadOnlyObservableCollection<long> selectedCategories)
.Subscribe(); .Subscribe();
SelectedCategories = selectedCategories; SelectedCategories = selectedCategories;
@ -85,7 +85,7 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase
public ObservableCollection<CategoryViewModel> Categories { get; } = new(); public ObservableCollection<CategoryViewModel> Categories { get; } = new();
public ObservableCollection<string> Tags { get; } = new(); public ObservableCollection<string> Tags { get; } = new();
public ReadOnlyObservableCollection<int> SelectedCategories { get; } public ReadOnlyObservableCollection<long> SelectedCategories { get; }
public bool CategoriesValid => _categoriesValid.Value ; public bool CategoriesValid => _categoriesValid.Value ;
public bool IconValid => _iconValid.Value; public bool IconValid => _iconValid.Value;
@ -127,7 +127,7 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase
private set => RaiseAndSetIfChanged(ref _iconChanged, value); private set => RaiseAndSetIfChanged(ref _iconChanged, value);
} }
public List<int> PreselectedCategories { get; set; } = new(); public List<long> PreselectedCategories { get; set; } = new();
private void MarkdownDocumentOnTextChanged(object? sender, EventArgs e) private void MarkdownDocumentOnTextChanged(object? sender, EventArgs e)
{ {

View File

@ -48,7 +48,7 @@ public class LayoutDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
await GetEntry(parameters.EntryId, cancellationToken); await GetEntry(parameters.EntryId, cancellationToken);
} }
private async Task GetEntry(Guid entryId, CancellationToken cancellationToken) private async Task GetEntry(long entryId, CancellationToken cancellationToken)
{ {
IOperationResult<IGetEntryByIdResult> result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken); IOperationResult<IGetEntryByIdResult> result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken);
if (result.IsErrorResult()) if (result.IsErrorResult())

View File

@ -136,7 +136,7 @@ public class SubmissionDetailViewModel : RoutableScreen<WorkshopDetailParameters
if (EntrySpecificationsViewModel == null || Entry == null) if (EntrySpecificationsViewModel == null || Entry == null)
return; return;
List<int> categories = EntrySpecificationsViewModel.Categories.Where(c => c.IsSelected).Select(c => c.Id).OrderBy(c => c).ToList(); List<long> categories = EntrySpecificationsViewModel.Categories.Where(c => c.IsSelected).Select(c => c.Id).OrderBy(c => c).ToList();
List<string> tags = EntrySpecificationsViewModel.Tags.OrderBy(t => t).ToList(); List<string> tags = EntrySpecificationsViewModel.Tags.OrderBy(t => t).ToList();
HasChanges = EntrySpecificationsViewModel.Name != Entry.Name || HasChanges = EntrySpecificationsViewModel.Name != Entry.Name ||

View File

@ -19,7 +19,7 @@ namespace Artemis.UI.Screens.Workshop.Library.Tabs;
public class SubmissionsTabViewModel : RoutableScreen public class SubmissionsTabViewModel : RoutableScreen
{ {
private readonly IWorkshopClient _client; private readonly IWorkshopClient _client;
private readonly SourceCache<IGetSubmittedEntries_SubmittedEntries, Guid> _entries; private readonly SourceCache<IGetSubmittedEntries_SubmittedEntries, long> _entries;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private bool _isLoading = true; private bool _isLoading = true;
private bool _workshopReachable; private bool _workshopReachable;
@ -32,7 +32,7 @@ public class SubmissionsTabViewModel : RoutableScreen
{ {
_client = client; _client = client;
_windowService = windowService; _windowService = windowService;
_entries = new SourceCache<IGetSubmittedEntries_SubmittedEntries, Guid>(e => e.Id); _entries = new SourceCache<IGetSubmittedEntries_SubmittedEntries, long>(e => e.Id);
_entries.Connect() _entries.Connect()
.Transform(getSubmissionsTabItemViewModel) .Transform(getSubmissionsTabItemViewModel)
.Bind(out ReadOnlyObservableCollection<SubmissionsTabItemViewModel> entries) .Bind(out ReadOnlyObservableCollection<SubmissionsTabItemViewModel> entries)
@ -54,7 +54,6 @@ public class SubmissionsTabViewModel : RoutableScreen
public ReactiveCommand<Unit, Unit> Login { get; } public ReactiveCommand<Unit, Unit> Login { get; }
public ReactiveCommand<Unit, Unit> AddSubmission { get; } public ReactiveCommand<Unit, Unit> AddSubmission { get; }
public ReactiveCommand<IGetSubmittedEntries_SubmittedEntries, Unit> NavigateToEntry { get; }
public IObservable<bool> IsLoggedIn { get; } public IObservable<bool> IsLoggedIn { get; }
public ReadOnlyObservableCollection<SubmissionsTabItemViewModel> Entries { get; } public ReadOnlyObservableCollection<SubmissionsTabItemViewModel> Entries { get; }

View File

@ -1,8 +1,6 @@
using System;
namespace Artemis.UI.Screens.Workshop.Parameters; namespace Artemis.UI.Screens.Workshop.Parameters;
public class WorkshopDetailParameters public class WorkshopDetailParameters
{ {
public Guid EntryId { get; set; } public long EntryId { get; set; }
} }

View File

@ -3,7 +3,6 @@ using System.Reactive;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.Core;
using Artemis.UI.Screens.Workshop.Parameters; using Artemis.UI.Screens.Workshop.Parameters;
using Artemis.UI.Shared.Routing; using Artemis.UI.Shared.Routing;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
@ -52,7 +51,7 @@ public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
await GetEntry(parameters.EntryId, cancellationToken); await GetEntry(parameters.EntryId, cancellationToken);
} }
private async Task GetEntry(Guid entryId, CancellationToken cancellationToken) private async Task GetEntry(long entryId, CancellationToken cancellationToken)
{ {
IOperationResult<IGetEntryByIdResult> result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken); IOperationResult<IGetEntryByIdResult> result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken);
if (result.IsErrorResult()) if (result.IsErrorResult())

View File

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Artemis.UI.Screens.Workshop.CurrentUser; using Artemis.UI.Screens.Workshop.CurrentUser;
using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.UI.Shared.Routing;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using ReactiveUI; using ReactiveUI;
@ -18,17 +17,17 @@ namespace Artemis.UI.Screens.Workshop.Search;
public class SearchViewModel : ViewModelBase public class SearchViewModel : ViewModelBase
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IRouter _router; private readonly IWorkshopService _workshopService;
private readonly IDebugService _debugService; private readonly IDebugService _debugService;
private readonly IWorkshopClient _workshopClient; private readonly IWorkshopClient _workshopClient;
private bool _isLoading; private bool _isLoading;
private SearchResultViewModel? _selectedEntry; 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; _logger = logger;
_workshopClient = workshopClient; _workshopClient = workshopClient;
_router = router; _workshopService = workshopService;
_debugService = debugService; _debugService = debugService;
CurrentUserViewModel = currentUserViewModel; CurrentUserViewModel = currentUserViewModel;
SearchAsync = ExecuteSearchAsync; SearchAsync = ExecuteSearchAsync;
@ -59,14 +58,7 @@ public class SearchViewModel : ViewModelBase
private void NavigateToEntry(SearchResultViewModel searchResult) private void NavigateToEntry(SearchResultViewModel searchResult)
{ {
string? url = null; _workshopService.NavigateToEntry(searchResult.Entry.Id, searchResult.Entry.EntryType);
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));
} }
private async Task<IEnumerable<object>> ExecuteSearchAsync(string? input, CancellationToken cancellationToken) private async Task<IEnumerable<object>> ExecuteSearchAsync(string? input, CancellationToken cancellationToken)

View File

@ -11,12 +11,14 @@ using Artemis.WebClient.Workshop.Exceptions;
using Artemis.WebClient.Workshop.Handlers.UploadHandlers; using Artemis.WebClient.Workshop.Handlers.UploadHandlers;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using ReactiveUI; using ReactiveUI;
using Serilog;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
public class UploadStepViewModel : SubmissionViewModel public class UploadStepViewModel : SubmissionViewModel
{ {
private readonly ILogger _logger;
private readonly EntryUploadHandlerFactory _entryUploadHandlerFactory; private readonly EntryUploadHandlerFactory _entryUploadHandlerFactory;
private readonly Progress<StreamProgress> _progress = new(); private readonly Progress<StreamProgress> _progress = new();
private readonly ObservableAsPropertyHelper<bool> _progressIndeterminate; private readonly ObservableAsPropertyHelper<bool> _progressIndeterminate;
@ -26,14 +28,20 @@ public class UploadStepViewModel : SubmissionViewModel
private readonly IWorkshopClient _workshopClient; private readonly IWorkshopClient _workshopClient;
private readonly IWorkshopService _workshopService; private readonly IWorkshopService _workshopService;
private Guid? _entryId; private long? _entryId;
private bool _failed; private bool _failed;
private bool _finished; private bool _finished;
private bool _succeeded; private bool _succeeded;
/// <inheritdoc /> /// <inheritdoc />
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; _workshopClient = workshopClient;
_workshopService = workshopService; _workshopService = workshopService;
_entryUploadHandlerFactory = entryUploadHandlerFactory; _entryUploadHandlerFactory = entryUploadHandlerFactory;
@ -101,8 +109,10 @@ public class UploadStepViewModel : SubmissionViewModel
Succeeded = true; 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 // Something went wrong when creating a release :c
// We'll keep the workshop entry so that the user can make changes and try again // We'll keep the workshop entry so that the user can make changes and try again
Failed = true; Failed = true;
@ -113,7 +123,7 @@ public class UploadStepViewModel : SubmissionViewModel
} }
} }
private async Task<Guid?> CreateEntry(CancellationToken cancellationToken) private async Task<long?> CreateEntry(CancellationToken cancellationToken)
{ {
IOperationResult<IAddEntryResult> result = await _workshopClient.AddEntry.ExecuteAsync(new CreateEntryInput IOperationResult<IAddEntryResult> result = await _workshopClient.AddEntry.ExecuteAsync(new CreateEntryInput
{ {
@ -125,7 +135,7 @@ public class UploadStepViewModel : SubmissionViewModel
Tags = State.Tags Tags = State.Tags
}, cancellationToken); }, cancellationToken);
Guid? entryId = result.Data?.AddEntry?.Id; long? entryId = result.Data?.AddEntry?.Id;
if (result.IsErrorResult() || entryId == null) if (result.IsErrorResult() || entryId == null)
{ {
await _windowService.ShowConfirmContentDialog("Failed to create workshop entry", result.Errors.ToString() ?? "Not even an error message", "Close", null); await _windowService.ShowConfirmContentDialog("Failed to create workshop entry", result.Errors.ToString() ?? "Not even an error message", "Close", null);

View File

@ -22,14 +22,14 @@ public class SubmissionWizardState
} }
public EntryType EntryType { get; set; } public EntryType EntryType { get; set; }
public Guid? EntryId { get; set; } public long? EntryId { get; set; }
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public Stream? Icon { get; set; } public Stream? Icon { get; set; }
public string Summary { get; set; } = string.Empty; public string Summary { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public List<int> Categories { get; set; } = new(); public List<long> Categories { get; set; } = new();
public List<string> Tags { get; set; } = new(); public List<string> Tags { get; set; } = new();
public List<Stream> Images { get; set; } = new(); public List<Stream> Images { get; set; } = new();

View File

@ -1,10 +1,10 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Artemis.Web.Workshop.Entities; namespace Artemis.WebClient.Workshop.Entities;
public class Release public class Release
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(64)] [MaxLength(64)]
public string Version { get; set; } = string.Empty; public string Version { get; set; } = string.Empty;
@ -18,5 +18,5 @@ public class Release
[MaxLength(32)] [MaxLength(32)]
public string? Md5Hash { get; set; } public string? Md5Hash { get; set; }
public Guid EntryId { get; set; } public long EntryId { get; set; }
} }

View File

@ -5,6 +5,6 @@ namespace Artemis.WebClient.Workshop.Handlers.InstallationHandlers;
public interface IEntryInstallationHandler public interface IEntryInstallationHandler
{ {
Task<EntryInstallResult> InstallAsync(IGetEntryById_Entry entry, Guid releaseId, Progress<StreamProgress> progress, CancellationToken cancellationToken); Task<EntryInstallResult> InstallAsync(IGetEntryById_Entry entry, long releaseId, Progress<StreamProgress> progress, CancellationToken cancellationToken);
Task<EntryUninstallResult> UninstallAsync(InstalledEntry installedEntry, CancellationToken cancellationToken); Task<EntryUninstallResult> UninstallAsync(InstalledEntry installedEntry, CancellationToken cancellationToken);
} }

View File

@ -19,7 +19,7 @@ public class ProfileEntryInstallationHandler : IEntryInstallationHandler
_workshopService = workshopService; _workshopService = workshopService;
} }
public async Task<EntryInstallResult> InstallAsync(IGetEntryById_Entry entry, Guid releaseId, Progress<StreamProgress> progress, CancellationToken cancellationToken) public async Task<EntryInstallResult> InstallAsync(IGetEntryById_Entry entry, long releaseId, Progress<StreamProgress> progress, CancellationToken cancellationToken)
{ {
using MemoryStream stream = new(); using MemoryStream stream = new();
@ -89,7 +89,7 @@ public class ProfileEntryInstallationHandler : IEntryInstallationHandler
}, cancellationToken); }, cancellationToken);
} }
private void UpdateRelease(Guid releaseId, InstalledEntry installedEntry) private void UpdateRelease(long releaseId, InstalledEntry installedEntry)
{ {
installedEntry.ReleaseId = releaseId; installedEntry.ReleaseId = releaseId;
installedEntry.ReleaseVersion = "TODO"; installedEntry.ReleaseVersion = "TODO";

View File

@ -1,4 +1,4 @@
using Artemis.Web.Workshop.Entities; using Artemis.WebClient.Workshop.Entities;
namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers; namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers;

View File

@ -4,5 +4,5 @@ namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers;
public interface IEntryUploadHandler public interface IEntryUploadHandler
{ {
Task<EntryUploadResult> CreateReleaseAsync(Guid entryId, object file, Progress<StreamProgress> progress, CancellationToken cancellationToken); Task<EntryUploadResult> CreateReleaseAsync(long entryId, object file, Progress<StreamProgress> progress, CancellationToken cancellationToken);
} }

View File

@ -5,7 +5,7 @@ namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers.Implementations;
public class LayoutEntryUploadHandler : IEntryUploadHandler public class LayoutEntryUploadHandler : IEntryUploadHandler
{ {
/// <inheritdoc /> /// <inheritdoc />
public async Task<EntryUploadResult> CreateReleaseAsync(Guid entryId, object file, Progress<StreamProgress> progress, CancellationToken cancellationToken) public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, object file, Progress<StreamProgress> progress, CancellationToken cancellationToken)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -2,7 +2,7 @@
using Artemis.Core; using Artemis.Core;
using Artemis.Core.Services; using Artemis.Core.Services;
using Artemis.UI.Shared.Utilities; using Artemis.UI.Shared.Utilities;
using Artemis.Web.Workshop.Entities; using Artemis.WebClient.Workshop.Entities;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers.Implementations; namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers.Implementations;
@ -19,7 +19,7 @@ public class ProfileEntryUploadHandler : IEntryUploadHandler
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<EntryUploadResult> CreateReleaseAsync(Guid entryId, object file, Progress<StreamProgress> progress, CancellationToken cancellationToken) public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, object file, Progress<StreamProgress> progress, CancellationToken cancellationToken)
{ {
if (file is not ProfileConfiguration profileConfiguration) if (file is not ProfileConfiguration profileConfiguration)
throw new InvalidOperationException("Can only create releases for profile configurations"); throw new InvalidOperationException("Can only create releases for profile configurations");

View File

@ -1,4 +1,4 @@
query GetEntryById($id: UUID!) { query GetEntryById($id: Long!) {
entry(id: $id) { entry(id: $id) {
id id
author author

View File

@ -1,4 +1,4 @@
query GetSubmittedEntryById($id: UUID!) { query GetSubmittedEntryById($id: Long!) {
entry(id: $id) { entry(id: $id) {
id id
name name

View File

@ -1,4 +1,4 @@
mutation RemoveEntry ($id: UUID!) { mutation RemoveEntry ($id: Long!) {
removeEntry(id: $id) { removeEntry(id: $id) {
id id
} }

View File

@ -22,13 +22,13 @@ public class InstalledEntry
Name = entry.Name; Name = entry.Name;
} }
public Guid EntryId { get; set; } public long EntryId { get; set; }
public EntryType EntryType { get; set; } public EntryType EntryType { get; set; }
public string Author { get; set; } = string.Empty; public string Author { get; set; } = string.Empty;
public string Name { 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 string ReleaseVersion { get; set; } = string.Empty;
public DateTimeOffset InstalledAt { get; set; } public DateTimeOffset InstalledAt { get; set; }

View File

@ -5,11 +5,11 @@ namespace Artemis.WebClient.Workshop.Services;
public interface IWorkshopService public interface IWorkshopService
{ {
Task<Stream?> GetEntryIcon(Guid entryId, CancellationToken cancellationToken); Task<Stream?> GetEntryIcon(long entryId, CancellationToken cancellationToken);
Task<ImageUploadResult> SetEntryIcon(Guid entryId, Progress<StreamProgress> progress, Stream icon, CancellationToken cancellationToken); Task<ImageUploadResult> SetEntryIcon(long entryId, Progress<StreamProgress> progress, Stream icon, CancellationToken cancellationToken);
Task<WorkshopStatus> GetWorkshopStatus(CancellationToken cancellationToken); Task<WorkshopStatus> GetWorkshopStatus(CancellationToken cancellationToken);
Task<bool> ValidateWorkshopStatus(CancellationToken cancellationToken); Task<bool> ValidateWorkshopStatus(CancellationToken cancellationToken);
Task NavigateToEntry(Guid entryId, EntryType entryType); Task NavigateToEntry(long entryId, EntryType entryType);
List<InstalledEntry> GetInstalledEntries(); List<InstalledEntry> GetInstalledEntries();
InstalledEntry? GetInstalledEntry(IGetEntryById_Entry entry); InstalledEntry? GetInstalledEntry(IGetEntryById_Entry entry);

View File

@ -20,7 +20,7 @@ public class WorkshopService : IWorkshopService
_entryRepository = entryRepository; _entryRepository = entryRepository;
} }
public async Task<Stream?> GetEntryIcon(Guid entryId, CancellationToken cancellationToken) public async Task<Stream?> GetEntryIcon(long entryId, CancellationToken cancellationToken)
{ {
HttpClient client = _httpClientFactory.CreateClient(WorkshopConstants.WORKSHOP_CLIENT_NAME); HttpClient client = _httpClientFactory.CreateClient(WorkshopConstants.WORKSHOP_CLIENT_NAME);
try try
@ -36,7 +36,7 @@ public class WorkshopService : IWorkshopService
} }
} }
public async Task<ImageUploadResult> SetEntryIcon(Guid entryId, Progress<StreamProgress> progress, Stream icon, CancellationToken cancellationToken) public async Task<ImageUploadResult> SetEntryIcon(long entryId, Progress<StreamProgress> progress, Stream icon, CancellationToken cancellationToken)
{ {
icon.Seek(0, SeekOrigin.Begin); icon.Seek(0, SeekOrigin.Begin);
@ -85,7 +85,7 @@ public class WorkshopService : IWorkshopService
return status.IsReachable; return status.IsReachable;
} }
public async Task NavigateToEntry(Guid entryId, EntryType entryType) public async Task NavigateToEntry(long entryId, EntryType entryType)
{ {
switch (entryType) switch (entryType)
{ {

View File

@ -2,7 +2,7 @@ namespace Artemis.WebClient.Workshop;
public static class WorkshopConstants public static class WorkshopConstants
{ {
public const string AUTHORITY_URL = "https://identity.artemis-rgb.com"; public const string AUTHORITY_URL = "https://localhost:5001";
public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com"; public const string WORKSHOP_URL = "https://localhost:7281";
public const string WORKSHOP_CLIENT_NAME = "WorkshopApiClient"; public const string WORKSHOP_CLIENT_NAME = "WorkshopApiClient";
} }

View File

@ -7,7 +7,7 @@ schema {
type Category { type Category {
icon: String! icon: String!
id: Int! id: Long!
name: String! name: String!
} }
@ -38,10 +38,10 @@ type Entry {
entryType: EntryType! entryType: EntryType!
icon: Image icon: Image
iconId: UUID iconId: UUID
id: UUID! id: Long!
images: [Image!]! images: [Image!]!
latestRelease: Release latestRelease: Release
latestReleaseId: UUID latestReleaseId: Long
name: String! name: String!
releases: [Release!]! releases: [Release!]!
summary: String! summary: String!
@ -55,14 +55,14 @@ type Image {
type Mutation { type Mutation {
addEntry(input: CreateEntryInput!): Entry addEntry(input: CreateEntryInput!): Entry
removeEntry(id: UUID!): Entry removeEntry(id: Long!): Entry
updateEntry(input: UpdateEntryInput!): Entry updateEntry(input: UpdateEntryInput!): Entry
} }
type Query { type Query {
categories(order: [CategorySortInput!], where: CategoryFilterInput): [Category!]! categories(order: [CategorySortInput!], where: CategoryFilterInput): [Category!]!
entries(order: [EntrySortInput!], skip: Int, take: Int, where: EntryFilterInput): EntriesCollectionSegment 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!]! searchEntries(input: String!, order: [EntrySortInput!], type: EntryType, where: EntryFilterInput): [Entry!]!
submittedEntries(order: [EntrySortInput!], where: EntryFilterInput): [Entry!]! submittedEntries(order: [EntrySortInput!], where: EntryFilterInput): [Entry!]!
} }
@ -72,14 +72,14 @@ type Release {
downloadSize: Long! downloadSize: Long!
downloads: Long! downloads: Long!
entry: Entry! entry: Entry!
entryId: UUID! entryId: Long!
id: UUID! id: Long!
md5Hash: String md5Hash: String
version: String! version: String!
} }
type Tag { type Tag {
id: Int! id: Long!
name: String! name: String!
} }
@ -111,7 +111,7 @@ scalar UUID
input CategoryFilterInput { input CategoryFilterInput {
and: [CategoryFilterInput!] and: [CategoryFilterInput!]
icon: StringOperationFilterInput icon: StringOperationFilterInput
id: IntOperationFilterInput id: LongOperationFilterInput
name: StringOperationFilterInput name: StringOperationFilterInput
or: [CategoryFilterInput!] or: [CategoryFilterInput!]
} }
@ -123,7 +123,7 @@ input CategorySortInput {
} }
input CreateEntryInput { input CreateEntryInput {
categories: [Int!]! categories: [Long!]!
description: String! description: String!
entryType: EntryType! entryType: EntryType!
name: String! name: String!
@ -157,10 +157,10 @@ input EntryFilterInput {
entryType: EntryTypeOperationFilterInput entryType: EntryTypeOperationFilterInput
icon: ImageFilterInput icon: ImageFilterInput
iconId: UuidOperationFilterInput iconId: UuidOperationFilterInput
id: UuidOperationFilterInput id: LongOperationFilterInput
images: ListFilterInputTypeOfImageFilterInput images: ListFilterInputTypeOfImageFilterInput
latestRelease: ReleaseFilterInput latestRelease: ReleaseFilterInput
latestReleaseId: UuidOperationFilterInput latestReleaseId: LongOperationFilterInput
name: StringOperationFilterInput name: StringOperationFilterInput
or: [EntryFilterInput!] or: [EntryFilterInput!]
releases: ListFilterInputTypeOfReleaseFilterInput releases: ListFilterInputTypeOfReleaseFilterInput
@ -203,21 +203,6 @@ input ImageSortInput {
mimeType: SortEnumType 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 { input ListFilterInputTypeOfCategoryFilterInput {
all: CategoryFilterInput all: CategoryFilterInput
any: Boolean any: Boolean
@ -267,8 +252,8 @@ input ReleaseFilterInput {
downloadSize: LongOperationFilterInput downloadSize: LongOperationFilterInput
downloads: LongOperationFilterInput downloads: LongOperationFilterInput
entry: EntryFilterInput entry: EntryFilterInput
entryId: UuidOperationFilterInput entryId: LongOperationFilterInput
id: UuidOperationFilterInput id: LongOperationFilterInput
md5Hash: StringOperationFilterInput md5Hash: StringOperationFilterInput
or: [ReleaseFilterInput!] or: [ReleaseFilterInput!]
version: StringOperationFilterInput version: StringOperationFilterInput
@ -302,15 +287,15 @@ input StringOperationFilterInput {
input TagFilterInput { input TagFilterInput {
and: [TagFilterInput!] and: [TagFilterInput!]
id: IntOperationFilterInput id: LongOperationFilterInput
name: StringOperationFilterInput name: StringOperationFilterInput
or: [TagFilterInput!] or: [TagFilterInput!]
} }
input UpdateEntryInput { input UpdateEntryInput {
categories: [Int!]! categories: [Long!]!
description: String! description: String!
id: UUID! id: Long!
name: String! name: String!
summary: String! summary: String!
tags: [String!]! tags: [String!]!