2024-05-13 14:29:34 +04:00
|
|
|
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
using TaskTrackerBusinessLogics.BusinessLogic;
|
|
|
|
using TaskTrackerContracts.BusinessLogicsContracts;
|
|
|
|
using TaskTrackerContracts.StoragesContracts;
|
|
|
|
using TaskTrackerDatabase.Implements;
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
builder.Services.AddTransient<ITaskStorage, TaskStorage>();
|
|
|
|
builder.Services.AddTransient<IProjectStorage, ProjectStorage>();
|
|
|
|
builder.Services.AddTransient<ITaskLogic, TaskLogic>();
|
|
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
builder.Services.AddTransient<IProjectLogic, ProjectLogic>();
|
2024-05-14 23:07:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
builder.Services.AddTransient<ISubjectStorage, SubjectStorage>();
|
|
|
|
builder.Services.AddTransient<IDirectionStorage, DirectionStorage>();
|
|
|
|
builder.Services.AddTransient<IResultStorage, ResultStorage>();
|
|
|
|
builder.Services.AddTransient<IStudentStorage, StudentStorage>();
|
|
|
|
builder.Services.AddTransient<IExamStorage, ExamStorage>();
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IStudentLogic, StudentLogic>();
|
|
|
|
builder.Services.AddTransient<ISubjectLogic, SubjectLogic>();
|
|
|
|
builder.Services.AddTransient<IExamLogic, ExamLogic>();
|
|
|
|
builder.Services.AddTransient<IResultLogic, ResultLogic>();
|
|
|
|
builder.Services.AddTransient<IDirectionLogic, DirectionLogic>();
|
2024-05-13 14:29:34 +04:00
|
|
|
builder.Services.AddControllers();
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
|
|
{
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo
|
|
|
|
{
|
|
|
|
Title = "TaskTrackerRestApi",
|
|
|
|
Version
|
|
|
|
= "v1"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseSwagger();
|
|
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
|
|
|
|
"TaskTrackerRestApi v1"));
|
|
|
|
}
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
app.Run();
|