mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Persist explicit PhotoID on photo upload
This commit is contained in:
@@ -9,8 +9,6 @@ using Features.Emails.DependencyInjection;
|
||||
using Features.Emails.Services;
|
||||
using Features.ImageUploads.Commands.UploadPhoto;
|
||||
using Features.ImageUploads.DependencyInjection;
|
||||
using Features.Users.Controllers;
|
||||
using Features.Users.DependencyInjection;
|
||||
using FluentValidation;
|
||||
using FluentValidation.AspNetCore;
|
||||
using Infrastructure.FileUpload;
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
<Project Path="Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj" />
|
||||
<Project Path="Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Infrastructure/Email/">
|
||||
<Project Path="Infrastructure/Infrastructure.Email/Infrastructure.Email.csproj" />
|
||||
<Project Path="Infrastructure/Infrastructure.Email.Templates/Infrastructure.Email.Templates.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Features/" />
|
||||
<Folder Name="/Features/Breweries/">
|
||||
<Project Path="Features/Features.Breweries/Features.Breweries.csproj" />
|
||||
@@ -40,8 +36,6 @@
|
||||
<Folder Name="/Features/Locations/">
|
||||
<Project Path="Features/Features.Locations/Features.Locations.csproj" />
|
||||
<Project Path="Features/Features.Locations.Tests/Features.Locations.Tests.csproj" />
|
||||
<Project Path="Features\Features.PhotoUpload\Features.PhotoUpload.csproj" />
|
||||
<Project Path="Features/Features.PhotoUpload.Tests/Features.PhotoUpload.Tests.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Features/PhotoUpload/">
|
||||
<Project Path="Features/Features.PhotoUpload/Features.PhotoUpload.csproj" />
|
||||
@@ -51,4 +45,4 @@
|
||||
<Project Path="Shared/Shared.Contracts/Shared.Contracts.csproj" />
|
||||
<Project Path="Shared/Shared.Application/Shared.Application.csproj" />
|
||||
</Folder>
|
||||
</Solution>
|
||||
</Solution>
|
||||
|
||||
@@ -25,7 +25,12 @@ public class UploadPhotoHandler(
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
Photo photo = new() { Hyperlink = key, UploadedById = request.UploadedById };
|
||||
Photo photo = new()
|
||||
{
|
||||
PhotoId = photoId,
|
||||
Hyperlink = key,
|
||||
UploadedById = request.UploadedById,
|
||||
};
|
||||
|
||||
await photoUploadRepository.CreateAsync(photo, cancellationToken);
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ public class PhotoUploadRepository(ISqlConnectionFactory connectionFactory)
|
||||
await connection.ExecuteAsync(
|
||||
new CommandDefinition(
|
||||
"""
|
||||
INSERT INTO dbo.Photo (Hyperlink, UploadedByID)
|
||||
VALUES (@Hyperlink, @UploadedById)
|
||||
INSERT INTO dbo.Photo (PhotoID, Hyperlink, UploadedByID)
|
||||
VALUES (@PhotoId, @Hyperlink, @UploadedById)
|
||||
""",
|
||||
new { photo.Hyperlink, photo.UploadedById },
|
||||
new { photo.PhotoId, photo.Hyperlink, photo.UploadedById },
|
||||
transaction
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user