Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/InterviewAssistant.ApiService/Endpoints/ReportEndpoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using InterviewAssistant.ApiService.Services;
using InterviewAssistant.Common.Models;
using Microsoft.AspNetCore.Mvc;

namespace InterviewAssistant.ApiService.Endpoints;

public static class ReportEndpoint
{
public static IEndpointRouteBuilder MapReportEndpoint(this IEndpointRouteBuilder routeBuilder)
{
var api = routeBuilder.MapGroup("api/report").WithTags("Report");

api.MapPost("generate-pdf", GeneratePdfReport)
.Accepts<InterviewReport>(contentType: "application/json")
.Produces<FileContentResult>(statusCode: StatusCodes.Status200OK, contentType: "application/pdf")
.WithName("GeneratePdfReport")
.WithOpenApi();

return routeBuilder;
}

private static IResult GeneratePdfReport(
[FromBody] InterviewReport report,
IPdfReportService pdfService)
{
try
{
var pdfBytes = pdfService.GenerateInterviewReport(report);
var fileName = $"면접리포트_{report.CandidateName}_{DateTime.Now:yyyyMMdd}.pdf";

return Results.File(pdfBytes, "application/pdf", fileName);
}
catch (Exception ex)
{
return Results.Problem(
title: "PDF 생성 오류",
detail: ex.Message,
statusCode: StatusCodes.Status500InternalServerError
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="Microsoft.SemanticKernel.Agents.core" Version="1.*" />
<PackageReference Include="Microsoft.SemanticKernel.Yaml" Version="1.*" />
<PackageReference Include="ModelContextProtocol" Version="0.*-*" />
<PackageReference Include="QuestPDF" Version="2024.*" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions src/InterviewAssistant.ApiService/Models/InterviewSession.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace InterviewAssistant.ApiService.Models;

public class InterviewSession
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ResumeId { get; set; }
public Guid JobDescriptionId { get; set; }
public DateTime StartedAt { get; set; } = DateTime.UtcNow;
public DateTime? CompletedAt { get; set; }
public bool IsCompleted { get; set; }
public string QuestionsAndAnswers { get; set; } = "[]"; // JSON 형태로 저장
public string? FinalFeedback { get; set; }
}
4 changes: 4 additions & 0 deletions src/InterviewAssistant.ApiService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

builder.Services.AddScoped<IKernelService, KernelService>();
builder.Services.AddScoped<IInterviewRepository, InterviewRepository>();
builder.Services.AddScoped<IPdfReportService, PdfReportService>();

//OpenAPI 설정
builder.Services.AddOpenApi();
Expand Down Expand Up @@ -99,6 +100,9 @@
// Chat Completion 엔드포인트 매핑
app.MapChatCompletionEndpoint();

// Report 엔드포인트 매핑
app.MapReportEndpoint();

// .NET Aspire 헬스체크 및 모니터링 엔드포인트 매핑
app.MapDefaultEndpoints();

Expand Down
13 changes: 13 additions & 0 deletions src/InterviewAssistant.ApiService/Services/IPdfReportService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using InterviewAssistant.Common.Models;

namespace InterviewAssistant.ApiService.Services;

public interface IPdfReportService
{
/// <summary>
/// 면접 리포트를 PDF로 생성합니다.
/// </summary>
/// <param name="report">면접 리포트 데이터</param>
/// <returns>PDF 바이트 배열</returns>
byte[] GenerateInterviewReport(InterviewReport report);
}
Loading