diff --git a/MongoDB.Dockerfile b/MongoDB.Dockerfile deleted file mode 100644 index b844871..0000000 --- a/MongoDB.Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM mongo:latest - -LABEL container_name="webone-mongo" - -EXPOSE 27017 - -RUN echo "rs.initiate();" > /docker-entrypoint-initdb.d/init-rs.js - -CMD ["mongod", "--replSet", "rs0"] diff --git a/README.md b/README.md index 269c3e0..646e777 100644 --- a/README.md +++ b/README.md @@ -1 +1,36 @@ -# resqueue +# ResQueue + +**ResQueue** is a web-based UI management tool designed for SQL-based message transports. Currently, it offers seamless integration with MassTransit, and we're open to adding support for additional frameworks based on user feedback and demand. + +Join our community on [Discord](https://discord.gg/322AAB4xKx) for updates, support, and discussions. + +## Configuration + +To set up **ResQueue**, follow these simple steps: + +1. Install the latest version of `ResQueue.MassTransit` from NuGet to ensure compatibility with the official MassTransit updates: + ```bash + dotnet add package ResQueue.MassTransit + ``` + +2. In your .NET application, configure **ResQueue** in the `WebApplication` builder by calling `builder.Services.AddResQueue()` with your database connection details. This can be done as follows: + ```csharp + var builder = WebApplication.CreateBuilder(args); + + // Add ResQueue with the necessary database configuration + builder.Services.AddResQueue(options => + { + // Configure database + }); + + var app = builder.Build(); + + app.UseResQueue(); + + // Run the app + app.Run(); + ``` + +3. Once this is set up, your application should work right out of the box. + +**ResQueue** will handle all the configuration and integration with MassTransit for you, making it simple to manage your SQL transports. diff --git a/backend/ResQueue/ResQueue.sln.DotSettings b/backend/ResQueue/ResQueue.sln.DotSettings new file mode 100644 index 0000000..640d2ea --- /dev/null +++ b/backend/ResQueue/ResQueue.sln.DotSettings @@ -0,0 +1,3 @@ + + True + True \ No newline at end of file diff --git a/backend/ResQueue/ResQueue/Dtos/Messages/RequeueMessagesDto.cs b/backend/ResQueue/ResQueue/Dtos/Messages/RequeueMessagesDto.cs index 208cc67..df0fe3b 100644 --- a/backend/ResQueue/ResQueue/Dtos/Messages/RequeueMessagesDto.cs +++ b/backend/ResQueue/ResQueue/Dtos/Messages/RequeueMessagesDto.cs @@ -1,4 +1,4 @@ -namespace ResQueue.Dtos; +namespace ResQueue.Dtos.Messages; public record RequeueMessagesDto( string QueueName, diff --git a/backend/ResQueue/ResQueue/Dtos/Messages/MoveMessagesDto.cs b/backend/ResQueue/ResQueue/Dtos/Messages/RequeueSpecificMessagesDto.cs similarity index 83% rename from backend/ResQueue/ResQueue/Dtos/Messages/MoveMessagesDto.cs rename to backend/ResQueue/ResQueue/Dtos/Messages/RequeueSpecificMessagesDto.cs index c1a055b..7a5fc12 100644 --- a/backend/ResQueue/ResQueue/Dtos/Messages/MoveMessagesDto.cs +++ b/backend/ResQueue/ResQueue/Dtos/Messages/RequeueSpecificMessagesDto.cs @@ -1,4 +1,4 @@ -namespace ResQueue.Dtos; +namespace ResQueue.Dtos.Messages; public record RequeueSpecificMessagesDto( long[] MessageDeliveryIds, diff --git a/backend/ResQueue/ResQueue/Dtos/Queue/QueueDto.cs b/backend/ResQueue/ResQueue/Dtos/Queue/QueueDto.cs index cff98d6..eaa418d 100644 --- a/backend/ResQueue/ResQueue/Dtos/Queue/QueueDto.cs +++ b/backend/ResQueue/ResQueue/Dtos/Queue/QueueDto.cs @@ -1,4 +1,4 @@ -namespace ResQueue.Dtos; +namespace ResQueue.Dtos.Queue; public record QueueDto( long Id, diff --git a/backend/ResQueue/ResQueue/Dtos/Queue/QueueViewDto.cs b/backend/ResQueue/ResQueue/Dtos/Queue/QueueViewDto.cs index eb00082..32d2223 100644 --- a/backend/ResQueue/ResQueue/Dtos/Queue/QueueViewDto.cs +++ b/backend/ResQueue/ResQueue/Dtos/Queue/QueueViewDto.cs @@ -1,4 +1,4 @@ -namespace ResQueue.Dtos; +namespace ResQueue.Dtos.Queue; public class QueueViewDto { diff --git a/backend/ResQueue/ResQueue/Endpoints/MessagesEndpoints.cs b/backend/ResQueue/ResQueue/Endpoints/MessagesEndpoints.cs index 26b0b56..a35ccf5 100644 --- a/backend/ResQueue/ResQueue/Endpoints/MessagesEndpoints.cs +++ b/backend/ResQueue/ResQueue/Endpoints/MessagesEndpoints.cs @@ -3,8 +3,9 @@ using Microsoft.Extensions.Options; using Npgsql; using ResQueue.Dtos; -using ResQueue.Features.Messages.MoveMessage; +using ResQueue.Dtos.Messages; using ResQueue.Features.Messages.RequeueMessages; +using ResQueue.Features.Messages.RequeueSpecificMessages; using ResQueue.Models.Postgres; using Message = ResQueue.Models.Postgres.Message; @@ -20,7 +21,7 @@ public static void MapMessageEndpoints(this IEndpointRouteBuilder routes) async (IOptions settings, [FromQuery] long queueId, [FromQuery] int pageIndex = 0, int pageSize = 4) => { - pageSize = 50; + pageSize = 50; pageIndex = pageIndex >= 0 ? pageIndex : 0; await using var db = new NpgsqlConnection(settings.Value.PostgreSQLConnectionString); diff --git a/backend/ResQueue/ResQueue/Endpoints/QueuesEndpoints.cs b/backend/ResQueue/ResQueue/Endpoints/QueuesEndpoints.cs index 9fc6be2..17f87f0 100644 --- a/backend/ResQueue/ResQueue/Endpoints/QueuesEndpoints.cs +++ b/backend/ResQueue/ResQueue/Endpoints/QueuesEndpoints.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Options; using Npgsql; using ResQueue.Dtos; +using ResQueue.Dtos.Queue; using ResQueue.Models.Postgres; namespace ResQueue.Endpoints; diff --git a/backend/ResQueue/ResQueue/Features/Messages/RequeueMessages/RequeueMessagesFeature.cs b/backend/ResQueue/ResQueue/Features/Messages/RequeueMessages/RequeueMessagesFeature.cs index 5bd9212..3581509 100644 --- a/backend/ResQueue/ResQueue/Features/Messages/RequeueMessages/RequeueMessagesFeature.cs +++ b/backend/ResQueue/ResQueue/Features/Messages/RequeueMessages/RequeueMessagesFeature.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Options; using Npgsql; using ResQueue.Dtos; +using ResQueue.Dtos.Messages; namespace ResQueue.Features.Messages.RequeueMessages; diff --git a/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/IRequeueSpecificMessagesFeature.cs b/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/IRequeueSpecificMessagesFeature.cs index 1b689ce..3a96a48 100644 --- a/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/IRequeueSpecificMessagesFeature.cs +++ b/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/IRequeueSpecificMessagesFeature.cs @@ -1,4 +1,4 @@ -namespace ResQueue.Features.Messages.MoveMessage; +namespace ResQueue.Features.Messages.RequeueSpecificMessages; public interface IRequeueSpecificMessagesFeature { diff --git a/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/RequeueSpecificMessagesFeature.cs b/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/RequeueSpecificMessagesFeature.cs index 3b6ad4d..51a35a5 100644 --- a/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/RequeueSpecificMessagesFeature.cs +++ b/backend/ResQueue/ResQueue/Features/Messages/RequeueSpecificMessages/RequeueSpecificMessagesFeature.cs @@ -1,9 +1,9 @@ using Dapper; using Microsoft.Extensions.Options; using Npgsql; -using ResQueue.Dtos; +using ResQueue.Dtos.Messages; -namespace ResQueue.Features.Messages.MoveMessage; +namespace ResQueue.Features.Messages.RequeueSpecificMessages; public record RequeueSpecificMessagesRequest( RequeueSpecificMessagesDto Dto diff --git a/backend/ResQueue/ResQueue/Properties/launchSettings.json b/backend/ResQueue/ResQueue/Properties/launchSettings.json deleted file mode 100644 index b64807f..0000000 --- a/backend/ResQueue/ResQueue/Properties/launchSettings.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "applicationUrl": "http://localhost:5004", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "applicationUrl": "https://localhost:7074;http://localhost:5004", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/backend/ResQueue/ResQueue/ResQueue.csproj b/backend/ResQueue/ResQueue/ResQueue.csproj index 21d8d79..a86633c 100644 --- a/backend/ResQueue/ResQueue/ResQueue.csproj +++ b/backend/ResQueue/ResQueue/ResQueue.csproj @@ -42,12 +42,12 @@ - - - - + + + + diff --git a/backend/ResQueue/ResQueue/ResQueueExtensions.cs b/backend/ResQueue/ResQueue/ResQueueExtensions.cs index f6de433..1efca36 100644 --- a/backend/ResQueue/ResQueue/ResQueueExtensions.cs +++ b/backend/ResQueue/ResQueue/ResQueueExtensions.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Rewrite; using Microsoft.Extensions.Options; using ResQueue.Endpoints; -using ResQueue.Features.Messages.MoveMessage; using ResQueue.Features.Messages.RequeueMessages; +using ResQueue.Features.Messages.RequeueSpecificMessages; namespace ResQueue; diff --git a/backend/ResQueue/ResQueue/UserAvatarGenerator.cs b/backend/ResQueue/ResQueue/UserAvatarGenerator.cs deleted file mode 100644 index 81a1df0..0000000 --- a/backend/ResQueue/ResQueue/UserAvatarGenerator.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System.Globalization; -using System.Security.Cryptography; -using System.Text; - -namespace ResQueue -{ - public static class UserAvatarGenerator - { - // List of colors - private static readonly string[] Colors = new[] - { - "#e57373", // Red - "#f06292", // Pink - "#ba68c8", // Purple - "#9575cd", // Deep Purple - "#7986cb", // Indigo - "#64b5f6", // Blue - "#4fc3f7", // Light Blue - "#4dd0e1", // Cyan - "#4db6ac", // Teal - "#81c784", // Green - "#aed581", // Light Green - "#dce775", // Lime - "#fff176", // Yellow - "#ffd54f", // Amber - "#ffb74d", // Orange - "#ff8a65", // Deep Orange - "#a1887f", // Brown - "#e0e0e0", // Grey - "#90a4ae" // Blue Grey - }; - - // Thread-safe random number generator - private static readonly Random GlobalRandom = new Random(); - [ThreadStatic] - private static Random? _localRandom; - - /// - /// Generates an avatar with a random color from the predefined array and a random pattern. - /// - /// A unique identifier (e.g., user ID or email). - /// The width and height of the SVG (default is 100). - /// A Base64-encoded data URI containing the SVG markup. - public static string GenerateUniqueAvatar(string uniqueId, int size = 100) - { - if (string.IsNullOrWhiteSpace(uniqueId)) - throw new ArgumentException("Unique ID must be a non-empty string.", nameof(uniqueId)); - - if (size <= 0) - throw new ArgumentException("Size must be a positive integer.", nameof(size)); - - var gridSize = 5; // Grid size - - // Initialize thread-local random - if (_localRandom == null) - { - int seed; - lock (GlobalRandom) - { - seed = GlobalRandom.Next(); - } - _localRandom = new Random(seed); - } - - // Select a random color from the Colors array - var colorIndex = _localRandom.Next(Colors.Length); - var color = Colors[colorIndex]; - - // Generate random bytes for the pattern - var totalCells = gridSize * gridSize; - var randomBytes = new byte[totalCells]; - using (var rng = RandomNumberGenerator.Create()) - { - rng.GetBytes(randomBytes); - } - - // Create the SVG builder - var svgBuilder = new StringBuilder(); - svgBuilder.AppendLine( - $""); - - var cellSize = size / (double)gridSize; - var byteIndex = 0; - - // Generate the symmetric grid pattern - for (var row = 0; row < gridSize; row++) - { - for (var col = 0; col < (gridSize + 1) / 2; col++) // Only half columns for symmetry - { - // Ensure we stay within the randomBytes array - if (byteIndex >= randomBytes.Length) - { - // Restart from the beginning if we've used all bytes - byteIndex = 0; - } - - // Decide whether to fill the square based on the random byte - var fill = (randomBytes[byteIndex++] % 2) == 0; - - if (fill) - { - var x = col * cellSize; - var y = row * cellSize; - - // Draw the square and its mirrored counterpart - svgBuilder.AppendLine( - $" "); - - if (col != gridSize - col - 1) // Avoid duplicating the center column - { - var mirrorX = (gridSize - col - 1) * cellSize; - svgBuilder.AppendLine( - $" "); - } - } - } - } - - svgBuilder.AppendLine(""); - - // Convert SVG content to Base64-encoded data URI - var svgContent = svgBuilder.ToString(); - var svgBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(svgContent)); - var dataUri = $"data:image/svg+xml;base64,{svgBase64}"; - - return dataUri; - } - } -} diff --git a/backend/ResQueue/ResQueue/appsettings.Development.json b/backend/ResQueue/ResQueue/appsettings.Development.json deleted file mode 100644 index f7776c9..0000000 --- a/backend/ResQueue/ResQueue/appsettings.Development.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "Settings": { - "PostgreSQLConnectionString": "host=localhost;port=5432;database=sandbox100;username=postgres;password=postgres;", - } -} diff --git a/backend/ResQueue/ResQueue/appsettings.json b/backend/ResQueue/ResQueue/appsettings.json deleted file mode 100644 index 10f68b8..0000000 --- a/backend/ResQueue/ResQueue/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -}