guys probably we just created INTEGRATION with our library......
This commit is contained in:
parent
8c0ba59ff7
commit
720f041abf
5 changed files with 74 additions and 9 deletions
|
|
@ -1,6 +1,23 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using SurveyLib.Core.Services;
|
||||
|
||||
namespace SurveyBackend.Controllers;
|
||||
|
||||
public class TestController
|
||||
[ApiController]
|
||||
[Route("test")]
|
||||
public class TestController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly ISurveyService _surveyService;
|
||||
|
||||
public TestController(ISurveyService surveyService)
|
||||
{
|
||||
_surveyService = surveyService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
var result = await _surveyService.GetSurveysAsync();
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,11 @@ using Microsoft.EntityFrameworkCore;
|
|||
using Microsoft.IdentityModel.Tokens;
|
||||
using SurveyBackend.Infrastructure;
|
||||
using SurveyBackend.Infrastructure.Data;
|
||||
using SurveyLib.Core.Repositories;
|
||||
using SurveyLib.Core.Services;
|
||||
using SurveyLib.Infrastructure.EFCore.Data;
|
||||
using SurveyLib.Infrastructure.EFCore.Repositories;
|
||||
using SurveyLib.Infrastructure.EFCore.Services;
|
||||
|
||||
namespace SurveyBackend;
|
||||
|
||||
|
|
@ -18,9 +23,13 @@ public class Program
|
|||
builder.Services.AddAuthorization();
|
||||
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
{
|
||||
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||
});
|
||||
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||||
|
||||
builder.Services.AddScoped<SurveyDbContext>(provider => provider.GetRequiredService<ApplicationDbContext>());
|
||||
|
||||
builder.Services.AddScoped<ISurveyRepository, SurveyRepository>();
|
||||
builder.Services.AddScoped<ISurveyService, SurveyService>();
|
||||
|
||||
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddJwtBearer(options =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue