diff --git a/SharpbinV3/Controllers/AuthController.cs b/SharpbinV3.Server/Controllers/AuthController.cs similarity index 100% rename from SharpbinV3/Controllers/AuthController.cs rename to SharpbinV3.Server/Controllers/AuthController.cs diff --git a/SharpbinV3/Controllers/PasteController.cs b/SharpbinV3.Server/Controllers/PasteController.cs similarity index 100% rename from SharpbinV3/Controllers/PasteController.cs rename to SharpbinV3.Server/Controllers/PasteController.cs diff --git a/SharpbinV3/Controllers/UserController.cs b/SharpbinV3.Server/Controllers/UserController.cs similarity index 100% rename from SharpbinV3/Controllers/UserController.cs rename to SharpbinV3.Server/Controllers/UserController.cs diff --git a/SharpbinV3/DTOs/JWTResult.cs b/SharpbinV3.Server/DTOs/JWTResult.cs similarity index 100% rename from SharpbinV3/DTOs/JWTResult.cs rename to SharpbinV3.Server/DTOs/JWTResult.cs diff --git a/SharpbinV3/DTOs/LoginRequest.cs b/SharpbinV3.Server/DTOs/LoginRequest.cs similarity index 100% rename from SharpbinV3/DTOs/LoginRequest.cs rename to SharpbinV3.Server/DTOs/LoginRequest.cs diff --git a/SharpbinV3/DTOs/PasteMetadataUpdateRequest.cs b/SharpbinV3.Server/DTOs/PasteMetadataUpdateRequest.cs similarity index 100% rename from SharpbinV3/DTOs/PasteMetadataUpdateRequest.cs rename to SharpbinV3.Server/DTOs/PasteMetadataUpdateRequest.cs diff --git a/SharpbinV3/DTOs/RefreshTokenRequest.cs b/SharpbinV3.Server/DTOs/RefreshTokenRequest.cs similarity index 100% rename from SharpbinV3/DTOs/RefreshTokenRequest.cs rename to SharpbinV3.Server/DTOs/RefreshTokenRequest.cs diff --git a/SharpbinV3/DTOs/RegisterRequest.cs b/SharpbinV3.Server/DTOs/RegisterRequest.cs similarity index 100% rename from SharpbinV3/DTOs/RegisterRequest.cs rename to SharpbinV3.Server/DTOs/RegisterRequest.cs diff --git a/SharpbinV3/Dockerfile b/SharpbinV3.Server/Dockerfile similarity index 72% rename from SharpbinV3/Dockerfile rename to SharpbinV3.Server/Dockerfile index 092939d..e84a11e 100644 --- a/SharpbinV3/Dockerfile +++ b/SharpbinV3.Server/Dockerfile @@ -12,19 +12,19 @@ EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src -COPY ["SharpbinV3/SharpbinV3.csproj", "SharpbinV3/"] -RUN dotnet restore "./SharpbinV3/SharpbinV3.csproj" +COPY ["SharpbinV3.Server.csproj", "./"] +RUN dotnet restore "./SharpbinV3.Server.csproj" COPY . . WORKDIR "/src/SharpbinV3" -RUN dotnet build "./SharpbinV3.csproj" -c $BUILD_CONFIGURATION -o /app/build +RUN dotnet build "../SharpbinV3.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build # This stage is used to publish the service project to be copied to the final stage FROM build AS publish ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./SharpbinV3.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false +RUN dotnet publish "../SharpbinV3.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false # This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "SharpbinV3.dll"] \ No newline at end of file +ENTRYPOINT ["dotnet", "SharpbinV3.Server.dll"] \ No newline at end of file diff --git a/SharpbinV3/Migrations/20251125015039_Init.Designer.cs b/SharpbinV3.Server/Migrations/20251125015039_Init.Designer.cs similarity index 100% rename from SharpbinV3/Migrations/20251125015039_Init.Designer.cs rename to SharpbinV3.Server/Migrations/20251125015039_Init.Designer.cs diff --git a/SharpbinV3/Migrations/20251125015039_Init.cs b/SharpbinV3.Server/Migrations/20251125015039_Init.cs similarity index 100% rename from SharpbinV3/Migrations/20251125015039_Init.cs rename to SharpbinV3.Server/Migrations/20251125015039_Init.cs diff --git a/SharpbinV3/Migrations/20251125053617_ImprovePastes.Designer.cs b/SharpbinV3.Server/Migrations/20251125053617_ImprovePastes.Designer.cs similarity index 100% rename from SharpbinV3/Migrations/20251125053617_ImprovePastes.Designer.cs rename to SharpbinV3.Server/Migrations/20251125053617_ImprovePastes.Designer.cs diff --git a/SharpbinV3/Migrations/20251125053617_ImprovePastes.cs b/SharpbinV3.Server/Migrations/20251125053617_ImprovePastes.cs similarity index 100% rename from SharpbinV3/Migrations/20251125053617_ImprovePastes.cs rename to SharpbinV3.Server/Migrations/20251125053617_ImprovePastes.cs diff --git a/SharpbinV3/Migrations/20251125055340_PasteContent.Designer.cs b/SharpbinV3.Server/Migrations/20251125055340_PasteContent.Designer.cs similarity index 100% rename from SharpbinV3/Migrations/20251125055340_PasteContent.Designer.cs rename to SharpbinV3.Server/Migrations/20251125055340_PasteContent.Designer.cs diff --git a/SharpbinV3/Migrations/20251125055340_PasteContent.cs b/SharpbinV3.Server/Migrations/20251125055340_PasteContent.cs similarity index 100% rename from SharpbinV3/Migrations/20251125055340_PasteContent.cs rename to SharpbinV3.Server/Migrations/20251125055340_PasteContent.cs diff --git a/SharpbinV3/Migrations/20251125061310_GrammarFix.Designer.cs b/SharpbinV3.Server/Migrations/20251125061310_GrammarFix.Designer.cs similarity index 100% rename from SharpbinV3/Migrations/20251125061310_GrammarFix.Designer.cs rename to SharpbinV3.Server/Migrations/20251125061310_GrammarFix.Designer.cs diff --git a/SharpbinV3/Migrations/20251125061310_GrammarFix.cs b/SharpbinV3.Server/Migrations/20251125061310_GrammarFix.cs similarity index 100% rename from SharpbinV3/Migrations/20251125061310_GrammarFix.cs rename to SharpbinV3.Server/Migrations/20251125061310_GrammarFix.cs diff --git a/SharpbinV3/Migrations/20251228173503_UserGrammarFix.Designer.cs b/SharpbinV3.Server/Migrations/20251228173503_UserGrammarFix.Designer.cs similarity index 100% rename from SharpbinV3/Migrations/20251228173503_UserGrammarFix.Designer.cs rename to SharpbinV3.Server/Migrations/20251228173503_UserGrammarFix.Designer.cs diff --git a/SharpbinV3/Migrations/20251228173503_UserGrammarFix.cs b/SharpbinV3.Server/Migrations/20251228173503_UserGrammarFix.cs similarity index 100% rename from SharpbinV3/Migrations/20251228173503_UserGrammarFix.cs rename to SharpbinV3.Server/Migrations/20251228173503_UserGrammarFix.cs diff --git a/SharpbinV3/Migrations/20251228175338_LongFileSizes.Designer.cs b/SharpbinV3.Server/Migrations/20251228175338_LongFileSizes.Designer.cs similarity index 100% rename from SharpbinV3/Migrations/20251228175338_LongFileSizes.Designer.cs rename to SharpbinV3.Server/Migrations/20251228175338_LongFileSizes.Designer.cs diff --git a/SharpbinV3/Migrations/20251228175338_LongFileSizes.cs b/SharpbinV3.Server/Migrations/20251228175338_LongFileSizes.cs similarity index 100% rename from SharpbinV3/Migrations/20251228175338_LongFileSizes.cs rename to SharpbinV3.Server/Migrations/20251228175338_LongFileSizes.cs diff --git a/SharpbinV3/Migrations/AppDbContextModelSnapshot.cs b/SharpbinV3.Server/Migrations/AppDbContextModelSnapshot.cs similarity index 100% rename from SharpbinV3/Migrations/AppDbContextModelSnapshot.cs rename to SharpbinV3.Server/Migrations/AppDbContextModelSnapshot.cs diff --git a/SharpbinV3/Program.cs b/SharpbinV3.Server/Program.cs similarity index 100% rename from SharpbinV3/Program.cs rename to SharpbinV3.Server/Program.cs diff --git a/SharpbinV3/Properties/launchSettings.json b/SharpbinV3.Server/Properties/launchSettings.json similarity index 100% rename from SharpbinV3/Properties/launchSettings.json rename to SharpbinV3.Server/Properties/launchSettings.json diff --git a/SharpbinV3/Services/AuthService.cs b/SharpbinV3.Server/Services/AuthService.cs similarity index 100% rename from SharpbinV3/Services/AuthService.cs rename to SharpbinV3.Server/Services/AuthService.cs diff --git a/SharpbinV3/Services/CompressionService.cs b/SharpbinV3.Server/Services/CompressionService.cs similarity index 100% rename from SharpbinV3/Services/CompressionService.cs rename to SharpbinV3.Server/Services/CompressionService.cs diff --git a/SharpbinV3/Services/IAuthService.cs b/SharpbinV3.Server/Services/IAuthService.cs similarity index 90% rename from SharpbinV3/Services/IAuthService.cs rename to SharpbinV3.Server/Services/IAuthService.cs index 45ceaf9..01ad9e9 100644 --- a/SharpbinV3/Services/IAuthService.cs +++ b/SharpbinV3.Server/Services/IAuthService.cs @@ -7,7 +7,6 @@ namespace SharpbinV3.Server.Services { Task CreateUser(string username, string password, string? email, string? displayName); Task GenerateJWTToken(User user); - Task ValidateJWTToken(string token); Task RefreshJWTToken(string token, string refreshToken); Task UpdateUser(User user); Task UpdateLoginTime(User user); diff --git a/SharpbinV3/Services/ICompressionService.cs b/SharpbinV3.Server/Services/ICompressionService.cs similarity index 100% rename from SharpbinV3/Services/ICompressionService.cs rename to SharpbinV3.Server/Services/ICompressionService.cs diff --git a/SharpbinV3/Services/IPasteService.cs b/SharpbinV3.Server/Services/IPasteService.cs similarity index 95% rename from SharpbinV3/Services/IPasteService.cs rename to SharpbinV3.Server/Services/IPasteService.cs index 179e1da..701e557 100644 --- a/SharpbinV3/Services/IPasteService.cs +++ b/SharpbinV3.Server/Services/IPasteService.cs @@ -10,7 +10,7 @@ namespace SharpbinV3.Server.Services Task Exists(string id); Task Exists(Guid uuid); Task EditText(Paste paste, string text); - Task Get(string id); + Task Get(string id); Task> GetList(int offset, int count, bool publicOnly = false); Task ValidateSyntax(string syntax); Task ValidateTitle(string title); diff --git a/SharpbinV3/Services/IUserService.cs b/SharpbinV3.Server/Services/IUserService.cs similarity index 100% rename from SharpbinV3/Services/IUserService.cs rename to SharpbinV3.Server/Services/IUserService.cs diff --git a/SharpbinV3/Services/PasteCleanUpService.cs b/SharpbinV3.Server/Services/PasteCleanUpService.cs similarity index 100% rename from SharpbinV3/Services/PasteCleanUpService.cs rename to SharpbinV3.Server/Services/PasteCleanUpService.cs diff --git a/SharpbinV3/Services/PasteService.cs b/SharpbinV3.Server/Services/PasteService.cs similarity index 100% rename from SharpbinV3/Services/PasteService.cs rename to SharpbinV3.Server/Services/PasteService.cs diff --git a/SharpbinV3/Services/UserService.cs b/SharpbinV3.Server/Services/UserService.cs similarity index 100% rename from SharpbinV3/Services/UserService.cs rename to SharpbinV3.Server/Services/UserService.cs diff --git a/SharpbinV3/Settings/JWTSettings.cs b/SharpbinV3.Server/Settings/JWTSettings.cs similarity index 100% rename from SharpbinV3/Settings/JWTSettings.cs rename to SharpbinV3.Server/Settings/JWTSettings.cs diff --git a/SharpbinV3/Settings/PasteSettings.cs b/SharpbinV3.Server/Settings/PasteSettings.cs similarity index 100% rename from SharpbinV3/Settings/PasteSettings.cs rename to SharpbinV3.Server/Settings/PasteSettings.cs diff --git a/SharpbinV3/SharpbinV3.Server.csproj b/SharpbinV3.Server/SharpbinV3.Server.csproj similarity index 100% rename from SharpbinV3/SharpbinV3.Server.csproj rename to SharpbinV3.Server/SharpbinV3.Server.csproj diff --git a/SharpbinV3/SharpbinV3.sln b/SharpbinV3.Server/SharpbinV3.sln similarity index 100% rename from SharpbinV3/SharpbinV3.sln rename to SharpbinV3.Server/SharpbinV3.sln diff --git a/SharpbinV3/Utilities.cs b/SharpbinV3.Server/Utilities.cs similarity index 100% rename from SharpbinV3/Utilities.cs rename to SharpbinV3.Server/Utilities.cs diff --git a/SharpbinV3/appsettings.Development.json b/SharpbinV3.Server/appsettings.Development.json similarity index 100% rename from SharpbinV3/appsettings.Development.json rename to SharpbinV3.Server/appsettings.Development.json diff --git a/SharpbinV3/appsettings.json b/SharpbinV3.Server/appsettings.json similarity index 100% rename from SharpbinV3/appsettings.json rename to SharpbinV3.Server/appsettings.json diff --git a/SharpbinV3.slnx b/SharpbinV3.slnx index add9ca1..14d9b60 100644 --- a/SharpbinV3.slnx +++ b/SharpbinV3.slnx @@ -1,3 +1,3 @@ - + diff --git a/SharpbinV3/Data/AppDbContext.cs b/SharpbinV3/Data/AppDbContext.cs deleted file mode 100644 index cb8e807..0000000 --- a/SharpbinV3/Data/AppDbContext.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using SharpbinV3.Server.Data.Entities; - -namespace SharpbinV3.Server.Data -{ - public sealed class AppDbContext(DbContextOptions options) : DbContext(options) - { - public DbSet Users => Set(); - public DbSet Pastes => Set(); - public DbSet RefreshTokens => Set(); - } -} diff --git a/SharpbinV3/Data/Entities/Paste.cs b/SharpbinV3/Data/Entities/Paste.cs deleted file mode 100644 index d2fec33..0000000 --- a/SharpbinV3/Data/Entities/Paste.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System.ComponentModel.DataAnnotations; - -namespace SharpbinV3.Server.Data.Entities -{ - [Index(nameof(PID), IsUnique = true)] - [Index(nameof(UUID), IsUnique = true)] - [Index(nameof(ID), IsUnique = true)] - [Index(nameof(AuthorUUID))] - [Index(nameof(ExpiresAt))] - [Index(nameof(Views))] - [Index(nameof(Visibility))] - public sealed class Paste - { - [Key] - public int PID { get; set; } - public required Guid UUID { get; set; } // uuid v7 includes timestamp, this counts as created at - public required string ID { get; set; } - public string? Title { get; set; } - - public required Guid AuthorUUID { get; set; } = Guid.Empty; // uuid of the user who created the paste, or Guid.Empty for anonymous pastes - public User? User { get; set; } - - public long? EditedAt { get; set; } - - public required byte[] Content { get; set; } - public long Size { get; set; } // stored size (may be compressed) - public long TrueSize { get; set; } // uncompressed size - public bool IsCompressed { get; set; } = false; - - public int Views { get; set; } - public string? Syntax { get; set; } - public int Visibility { get; set; } = 0; // 0 = public, 1 = unlisted, 2 = private (encrypted pastes handled on frontend) - - public long ExpiresAt { get; set; } // timestamp of when the paste expires, or 0 for never - } -} diff --git a/SharpbinV3/Data/Entities/RefreshToken.cs b/SharpbinV3/Data/Entities/RefreshToken.cs deleted file mode 100644 index 3190226..0000000 --- a/SharpbinV3/Data/Entities/RefreshToken.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace SharpbinV3.Server.Data.Entities -{ - public sealed class RefreshToken - { - [Key] - public Guid UserUUID { get; set; } - public required string Token { get; set; } - public required string JwtId { get; set; } - public required long CreatedAt { get; set; } - public required long ExpiresAt { get; set; } - public bool Used { get; set; } = false; - public User? User { get; set; } - } -} diff --git a/SharpbinV3/Data/Entities/User.cs b/SharpbinV3/Data/Entities/User.cs deleted file mode 100644 index 2c59d48..0000000 --- a/SharpbinV3/Data/Entities/User.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System.ComponentModel.DataAnnotations; - -namespace SharpbinV3.Server.Data.Entities -{ - [Index(nameof(UUID), IsUnique = true)] - public sealed class User - { - [Key] - public int UID { get; set; } - public required Guid UUID { get; set; } = Guid.CreateVersion7(); // uuid v7 includes timestamp - public required string Username { get; set; } - public required string PasswordHash { get; set; } - public string? Email { get; set; } - public string? DisplayName { get; set; } - public long? LastLogin { get; set; } - public int[] Roles { get; set; } = [0]; // 0 = regular user, 1 = moderator, 255 = admin - public int Visibility { get; set; } = 0; // 0 = public, 1 = unlisted, 2 = private - public List Pastes { get; set; } = []; - } -}