[성현모] AuthApi 분리

This commit is contained in:
SHM
2025-07-15 10:16:26 +09:00
parent 20f1e7e7e5
commit 7a12be392a
52 changed files with 1931 additions and 60 deletions

View File

@ -19,7 +19,7 @@ public partial class HubXContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseSqlServer("server=127.0.0.1; user id=VPKI; password=Kefico!@34; database=HubX; TrustServerCertificate=true;");
=> optionsBuilder.UseSqlServer("server=127.0.0.1; user id=alis; password=Kefico!@34; database=HubX; TrustServerCertificate=true;");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{

View File

@ -1,4 +1,5 @@
using HubX.Library.Http.Packet;
using Azure.Core;
using HubX.Library.Http.Packet;
using HubX.Server.Services;
using Microsoft.AspNetCore.Mvc;
@ -47,6 +48,30 @@ namespace HubX.Server.Controllers
return Results.Ok(res);
}
[HttpGet]
public async Task<IResult> SelectUniqueKeyGet([FromQuery] string key)
{
var guid = Guid.NewGuid();
// Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/SelectUniqueKey::{request.ToJson()}", LogType.CONTROLLER);
Response_SelectUniqueKy res = await _uniqueKeyService.Request_SelectUniqueKey(new Request_SelectUniqueKey { Identity = key } );
// Log4net.WriteLine($"[Response]({guid}) UniqueKey/SelectUniqueKey::{res.ToJson()}", LogType.CONTROLLER);
return Results.Ok(res);
}
[HttpGet]
public async Task<IResult> SelectUniqueKeyGetAll()
{
var guid = Guid.NewGuid();
// Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/SelectUniqueKey::{request.ToJson()}", LogType.CONTROLLER);
var res = await _uniqueKeyService.Request_SelectUniqueKeyAll();
// Log4net.WriteLine($"[Response]({guid}) UniqueKey/SelectUniqueKey::{res.ToJson()}", LogType.CONTROLLER);
return Results.Ok(res);
}
[HttpPost]
public async Task<IResult> UpdateUniqueKey(Request_UpdateUniqueKey request)
{

View File

@ -4,6 +4,7 @@ using HubX.Library.Http.Packet;
using Microsoft.EntityFrameworkCore;
using Microsoft.Identity.Client.Extensions.Msal;
using System;
using System.Collections.Generic;
using System.Data;
using System.Xml;
using SystemX.Core.DB;
@ -116,6 +117,33 @@ namespace HubX.Server.Services
return response;
}
public async Task<List<TStorage>> Request_SelectUniqueKeyAll(string guid = "")
{
List<TStorage> result = new List<TStorage>();
using (var scope = _scopeFactory.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<HubXContext>();
if (context != null)
{
try
{
using (var transaction = await context.CreateTransactionAsync(IsolationLevel.ReadUncommitted))
{
result = await context.TStorages.AsNoTracking().ToListAsync();
await context.CloseTransactionAsync(transaction);
}
}
catch (Exception e)
{
Log4net.WriteLine($"Select Unique Key Transaction Error::{guid}", LogType.Error);
Log4net.WriteLine(e);
}
}
}
return result;
}
public async Task<Response_UpdateUniqueKy> Request_UpdateUniqueKey(Request_UpdateUniqueKey request, string guid = "")
{
Response_UpdateUniqueKy response = new Response_UpdateUniqueKy();