Skip to content

Unrelated PR #24

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
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
7 changes: 1 addition & 6 deletions core/Controllers/EventsController.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using api.core.data.entities;
using api.core.Data;
using api.core.Data.Entities;
using api.core.Data.Exceptions;
using api.core.Data.requests;
using api.core.Data.Enums;
using api.core.Data.Requests;
using api.core.Data.Responses;
using api.core.Misc;
using api.core.services.abstractions;

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OutputCaching;
using Microsoft.Extensions.Logging;

namespace api.core.controllers;

Expand Down
3 changes: 2 additions & 1 deletion core/Controllers/ModeratorEventsController.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using api.core.controllers;
using api.core.Data.Entities;
using api.core.Data.Enums;
using api.core.Data.Exceptions;
using api.core.Data.Requests;
using api.core.Data.Responses;
using api.core.Misc;
using api.core.services.abstractions;

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

Expand Down
2 changes: 1 addition & 1 deletion core/Controllers/ModeratorUserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task<IActionResult> CreateOrganizer([FromBody] UserCreateDTO organi
Guid.TryParse(supabaseUser, out Guid userId);
var created = userService.AddOrganizer(userId, organizer);
var frontBaseUrl = Environment.GetEnvironmentVariable("FRONTEND_BASE_URL") ?? throw new Exception("FRONTEND_BASE_URL is not set");
await emailService.SendEmailAsync<UserCreationModel>(
await emailService.SendEmailAsync(
organizer.Email,
"Votre compte Hello!",
new UserCreationModel
Expand Down
2 changes: 1 addition & 1 deletion core/Controllers/OrganizerEventsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using api.core.Data.Entities;
using api.core.Data.Requests;
using api.core.Data.Enums;

namespace api.core.Controllers;

Expand Down
2 changes: 1 addition & 1 deletion core/Data/Entities/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

using api.core.Data.Entities;
using api.core.Data.Enums;

using Microsoft.EntityFrameworkCore;

Expand Down
2 changes: 1 addition & 1 deletion core/Data/Entities/State.cs → core/Data/Enums/State.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace api.core.Data.Entities;
namespace api.core.Data.Enums;

/// <summary>
/// 1 - OnHold
Expand Down
5 changes: 1 addition & 4 deletions core/Data/Requests/EventRequestDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using api.core.data.entities;
using api.core.Data.Entities;

namespace api.core.Data.requests;
namespace api.core.Data.requests;

public class EventRequestDTO
{
Expand Down
2 changes: 1 addition & 1 deletion core/Data/Responses/EventResponseDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections;

using api.core.data.entities;
using api.core.Data.Entities;
using api.core.Data.Enums;

namespace api.core.Data.Responses;

Expand Down
11 changes: 11 additions & 0 deletions core/Extensions/ExceptionMiddlewareExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using api.core.Misc;

namespace api.core.Extensions;

public static class ExceptionMiddlewareExtensions
{
public static IApplicationBuilder UseExceptionMiddleware(this IApplicationBuilder iBuilder)
{
return iBuilder.UseMiddleware<CustomExceptionsCheckerMiddleware>();
}
}
11 changes: 9 additions & 2 deletions core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.OpenApi.Models;
using api.core.Misc;
using api.emails;
using System.Reflection;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -94,9 +95,14 @@
Id = "Bearer"
}
},
new string[] {}
Array.Empty<string>()
}
});
options.UseInlineDefinitionsForEnums();

var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
options.IncludeXmlComments(xmlPath);
});

builder.Services.AddEmailService(builder.Configuration);
Expand All @@ -112,7 +118,8 @@
app.UseSwagger();
app.UseSwaggerUI();

app.UseMiddleware<CustomExceptionsCheckerMiddleware>();

app.UseExceptionMiddleware();

// app.UseHttpsRedirection();

Expand Down
3 changes: 1 addition & 2 deletions core/Repositories/EventRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public IEnumerable<Event> GetAll()
.Include(x => x.Publication)
.ThenInclude(x => x.Tags)
.Include(x => x.Publication)
.ThenInclude(x => x.Organizer)
.ToList();
.ThenInclude(x => x.Organizer);
}

public bool Update(Guid id, Event entity)
Expand Down
2 changes: 1 addition & 1 deletion core/Services/Abstractions/IEventService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using api.core.Data.Entities;
using api.core.Data.Enums;
using api.core.Data.requests;
using api.core.Data.Responses;

Expand Down
2 changes: 1 addition & 1 deletion core/Services/EventService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using api.core.data.entities;
using api.core.Data.Entities;
using api.core.Data.Enums;
using api.core.Data.Exceptions;
using api.core.Data.requests;
using api.core.Data.Responses;
Expand Down
5 changes: 1 addition & 4 deletions core/Services/Jobs/SetPublicationEventJob.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Reflection.Metadata;

using api.core.Data.Entities;
using api.core.Misc;
using api.core.Misc;
using api.core.services.abstractions;

using Quartz;
Expand Down
3 changes: 2 additions & 1 deletion core/api.core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<UserSecretsId>d65d8ed2-e38b-45b2-b24e-88385df1ce57</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<PreserveCompilationContext>true</PreserveCompilationContext>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>
Expand All @@ -32,7 +33,7 @@
<PackageReference Include="Quartz.Serialization.Json" Version="3.8.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" />
<PackageReference Include="supabase-csharp" Version="0.15.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion tests/Tests/Services/EventServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using api.core.data.entities;
using api.core.Data.Entities;
using api.core.Data.Enums;
using api.core.Data.Exceptions;
using api.core.Data.requests;
using api.core.repositories.abstractions;
using api.core.Services;
using api.emails.Models;
using api.emails.Services.Abstractions;
using api.files.Services.Abstractions;

using Microsoft.Extensions.Configuration;

using Moq;
Expand Down
Loading