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.Emails.Services;
|
||||||
using Features.ImageUploads.Commands.UploadPhoto;
|
using Features.ImageUploads.Commands.UploadPhoto;
|
||||||
using Features.ImageUploads.DependencyInjection;
|
using Features.ImageUploads.DependencyInjection;
|
||||||
using Features.Users.Controllers;
|
|
||||||
using Features.Users.DependencyInjection;
|
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using FluentValidation.AspNetCore;
|
using FluentValidation.AspNetCore;
|
||||||
using Infrastructure.FileUpload;
|
using Infrastructure.FileUpload;
|
||||||
|
|||||||
@@ -24,10 +24,6 @@
|
|||||||
<Project Path="Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj" />
|
<Project Path="Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj" />
|
||||||
<Project Path="Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj" />
|
<Project Path="Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj" />
|
||||||
</Folder>
|
</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/" />
|
||||||
<Folder Name="/Features/Breweries/">
|
<Folder Name="/Features/Breweries/">
|
||||||
<Project Path="Features/Features.Breweries/Features.Breweries.csproj" />
|
<Project Path="Features/Features.Breweries/Features.Breweries.csproj" />
|
||||||
@@ -40,8 +36,6 @@
|
|||||||
<Folder Name="/Features/Locations/">
|
<Folder Name="/Features/Locations/">
|
||||||
<Project Path="Features/Features.Locations/Features.Locations.csproj" />
|
<Project Path="Features/Features.Locations/Features.Locations.csproj" />
|
||||||
<Project Path="Features/Features.Locations.Tests/Features.Locations.Tests.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>
|
||||||
<Folder Name="/Features/PhotoUpload/">
|
<Folder Name="/Features/PhotoUpload/">
|
||||||
<Project Path="Features/Features.PhotoUpload/Features.PhotoUpload.csproj" />
|
<Project Path="Features/Features.PhotoUpload/Features.PhotoUpload.csproj" />
|
||||||
|
|||||||
@@ -25,7 +25,12 @@ public class UploadPhotoHandler(
|
|||||||
cancellationToken
|
cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
Photo photo = new() { Hyperlink = key, UploadedById = request.UploadedById };
|
Photo photo = new()
|
||||||
|
{
|
||||||
|
PhotoId = photoId,
|
||||||
|
Hyperlink = key,
|
||||||
|
UploadedById = request.UploadedById,
|
||||||
|
};
|
||||||
|
|
||||||
await photoUploadRepository.CreateAsync(photo, cancellationToken);
|
await photoUploadRepository.CreateAsync(photo, cancellationToken);
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ public class PhotoUploadRepository(ISqlConnectionFactory connectionFactory)
|
|||||||
await connection.ExecuteAsync(
|
await connection.ExecuteAsync(
|
||||||
new CommandDefinition(
|
new CommandDefinition(
|
||||||
"""
|
"""
|
||||||
INSERT INTO dbo.Photo (Hyperlink, UploadedByID)
|
INSERT INTO dbo.Photo (PhotoID, Hyperlink, UploadedByID)
|
||||||
VALUES (@Hyperlink, @UploadedById)
|
VALUES (@PhotoId, @Hyperlink, @UploadedById)
|
||||||
""",
|
""",
|
||||||
new { photo.Hyperlink, photo.UploadedById },
|
new { photo.PhotoId, photo.Hyperlink, photo.UploadedById },
|
||||||
transaction
|
transaction
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user