feat(security): enforcement — filtrage caméra dans les endpoints sensibles (#175)
This commit is contained in:
1 parent
0f47236c08
commit
b97d3bec11
24 files changed
+313
-25
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using Heimdall.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Heimdall.Infrastructure.Data.Configurations;
|
||||
|
||||
public class UserCameraConfiguration : IEntityTypeConfiguration<UserCamera>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserCamera> builder)
|
||||
{
|
||||
builder.ToTable("user_cameras");
|
||||
|
||||
builder.HasKey(uc => new { uc.UserId, uc.CameraId });
|
||||
|
||||
builder.HasOne(uc => uc.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(uc => uc.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(uc => uc.Camera)
|
||||
.WithMany()
|
||||
.HasForeignKey(uc => uc.CameraId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
// Index for "find all cameras for a user" queries
|
||||
builder.HasIndex(uc => uc.UserId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user