Némi API hozzáadás

This commit is contained in:
2025-01-28 14:38:28 +01:00
parent e74df61ca0
commit 3669267898
7 changed files with 67 additions and 3 deletions
+9 -3
View File
@@ -74,7 +74,13 @@ builder.Services.AddControllers()
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
});
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
});
});
var app = builder.Build();
@@ -95,11 +101,11 @@ if (app.Environment.IsDevelopment())
}
// Routing és endpointok
app.UseHttpsRedirection();
//app.UseHttpsRedirection();
app.UseRouting();
app.UseMiddleware<ApiKeyMiddleware>();
app.MapControllers();
app.UseAuthorization();
app.UseCors();
app.Run();
@@ -18,6 +18,7 @@ namespace WorkFlowCheck.BL.Mappings
CreateMap<UserDTO, User>()
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>();
}
}
}
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateHeaderDTO
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
}
}
+2
View File
@@ -16,6 +16,8 @@ namespace WorkFlowCheck.DL
}
public DbSet<Entities.User> Users { get; set; } = null!;
public DbSet<Entities.CheckListTemplateHeader> CheckListTemplateHeaders { get; set; } = null!;
public DbSet<Entities.UsersCheckListTemplateHeader> UsersCheckListTemplateHeaders { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Configurations
{
public class UsersCheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.UsersCheckListTemplateHeader>
{
public void Configure(EntityTypeBuilder<Entities.UsersCheckListTemplateHeader> builder)
{
builder.ToTable("UsersCheckListTemplateHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.DL.Entities
{
public class CheckListTemplateHeader
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
}
}
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.DL.Entities
{
public class UsersCheckListTemplateHeader
{
public int Id { get; set; }
public int UsersId { get; set; }
public int CheckListTemplateHeader { get; set; }
public bool Enabled { get; set; } = false;
}
}