Compare commits

..

23 Commits

Author SHA1 Message Date
David D'ALMEIDA de2daa5693 Mise à jour de 'EntityFramework_LoL/Sources/API_LoL_Project/Program.cs'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8f150d8db0 Mise à jour de 'EntityFramework_LoL/Sources/API_LoL_Project/Program.cs'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 13bb701d1d Mise à jour de 'EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8d50285de5 Mise à jour de 'EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 78290912be Mise à jour de 'EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
Arthur VALIN c0afc8a4a3 revert 37afa9436d
continuous-integration/drone/push Build is passing Details
2 years ago
Arthur VALIN 37afa9436d Supprimer 'EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile'
continuous-integration/drone/push Build was killed Details
2 years ago
David D'ALMEIDA 1402ae1b95 Mise à jour de 'EntityFramework_LoL/Sources/API_LoL_Project/Controllers/version2/RuneController.cs'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA dd0d45f131 Mise à jour de 'EntityFramework_LoL/Sources/ApiMappeur/ChampionMapper.cs'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 9707d2ce23 Mise à jour de 'EntityFramework_LoL/Sources/ApiMappeur/ChampionMapper.cs'
continuous-integration/drone/push Build is failing Details
2 years ago
David D'ALMEIDA 5b5fbc4e29 Mise à jour de 'EntityFramework_LoL/Sources/DTO/ChampionDTO.cs'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA c1dbb0c469 Mise à jour de 'EntityFramework_LoL/Sources/ApiMappeur/ImageMappeur.cs'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 9a65aae7c1 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 62e10a01c5 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 043826bcaa Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 9e74449ef7 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 72b88d04d4 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 80a880ebdc Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA c686ee9737 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 9792fb3325 Merge pull request 'fixing' (#12) from Cleaning into master
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 911acb9cb6 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 3c174bf47c Transférer les fichiers vers 'doc/images'
continuous-integration/drone/push Build is passing Details
2 years ago
David D'ALMEIDA 554f254a2c Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago

@ -97,7 +97,7 @@ namespace API_LoL_Project.Controllers.version2
var runes = await dataManager.GetItems(request.index, totalcount, request.orderingPropertyName, (request.descending == null ? false : (bool)request.descending));
IEnumerable<RuneDTO> res = runes.Select(c => c.ToDTO());
if (res.Count() >= 0 || res == null)
if (res == null)
{
_logger.LogWarning("No runes found with Id");
return BadRequest("No runes found with Id ");

@ -1,26 +1,27 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["API_LoL_Project/API_LoL_Project.csproj", "API_LoL_Project/"]
COPY ["StubLib/StubLib.csproj", "StubLib/"]
COPY ["Model/Model.csproj", "Model/"]
COPY ["Shared/Shared.csproj", "Shared/"]
COPY ["DTO/DTO.csproj", "DTO/"]
RUN dotnet restore "API_LoL_Project/API_LoL_Project.csproj"
COPY . .
WORKDIR "/src/API_LoL_Project"
RUN dotnet build "API_LoL_Project.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "API_LoL_Project.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["API_LoL_Project/API_LoL_Project.csproj", "API_LoL_Project/"]
COPY ["StubLib/StubLib.csproj", "StubLib/"]
COPY ["Model/Model.csproj", "Model/"]
COPY ["Shared/Shared.csproj", "Shared/"]
COPY ["DTO/DTO.csproj", "DTO/"]
RUN dotnet restore "API_LoL_Project/API_LoL_Project.csproj"
COPY . .
WORKDIR "/src/API_LoL_Project"
RUN dotnet build "API_LoL_Project.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "API_LoL_Project.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN ls -R
ENTRYPOINT ["dotnet", "API_LoL_Project.dll"]

@ -1,108 +1,107 @@
using Business;
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Versioning;
using Model;
using StubLib;
using API_LoL_Project;
using API_LoL_Project.JsonConverter;
using API_LoL_Project.Middleware.Auth;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("LolDatabase");
builder.Services.AddDbContext<LolDbContext>(options =>
options.UseSqlite(connectionString), ServiceLifetime.Singleton);
builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new ReadOnlyDictionaryConverter<string, int>());
});
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen( cont =>
{
cont.AddSecurityDefinition("ApiKey", new Microsoft.OpenApi.Models.OpenApiSecurityScheme
{
Description = "The Key to acces to the API",
Type = SecuritySchemeType.ApiKey,
Name = "x-api-key",
In = ParameterLocation.Header,
Scheme = "ApiKeyScheme"
});
var scheme = new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "ApiKey"
},
In = ParameterLocation.Header
};
var requirement = new OpenApiSecurityRequirement
{
{
scheme, new List<string>()
}
};
cont.AddSecurityRequirement(requirement);
}
);
builder.Services.AddApiVersioning(opt =>
{
opt.DefaultApiVersion = new Microsoft.AspNetCore.Mvc.ApiVersion(1, 0);
opt.AssumeDefaultVersionWhenUnspecified = true;
opt.ReportApiVersions = true;
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader());
});
builder.Services.ConfigureOptions<LolSwaggerOptions>();
builder.Services.AddVersionedApiExplorer(setup =>
{
setup.GroupNameFormat = "'v'VVV";
setup.SubstituteApiVersionInUrl = true;
});
builder.Services.AddScoped<AuthMiddlewareFliter>();
builder.Services.AddSingleton<IDataManager, DbData>();
//builder.Services.AddSingleton<IDataManager, StubData>();
var app = builder.Build();
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
app?.Services?.GetService<LolDbContext>()?.Database.EnsureCreated();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
/* app.UseSwaggerUI();*/
app.UseSwaggerUI(options =>
{
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
{
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
description.GroupName.ToUpperInvariant());
}
});
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
using Business;
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Versioning;
using Model;
using StubLib;
using API_LoL_Project;
using API_LoL_Project.JsonConverter;
using API_LoL_Project.Middleware.Auth;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("LolDatabase");
builder.Services.AddDbContext<LolDbContext>(options =>
options.UseSqlite(connectionString), ServiceLifetime.Singleton);
builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new ReadOnlyDictionaryConverter<string, int>());
});
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen( cont =>
{
cont.AddSecurityDefinition("ApiKey", new Microsoft.OpenApi.Models.OpenApiSecurityScheme
{
Description = "The Key to acces to the API",
Type = SecuritySchemeType.ApiKey,
Name = "x-api-key",
In = ParameterLocation.Header,
Scheme = "ApiKeyScheme"
});
var scheme = new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "ApiKey"
},
In = ParameterLocation.Header
};
var requirement = new OpenApiSecurityRequirement
{
{
scheme, new List<string>()
}
};
cont.AddSecurityRequirement(requirement);
}
);
builder.Services.AddApiVersioning(opt =>
{
opt.DefaultApiVersion = new Microsoft.AspNetCore.Mvc.ApiVersion(1, 0);
opt.AssumeDefaultVersionWhenUnspecified = true;
opt.ReportApiVersions = true;
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader());
});
builder.Services.ConfigureOptions<LolSwaggerOptions>();
builder.Services.AddVersionedApiExplorer(setup =>
{
setup.GroupNameFormat = "'v'VVV";
setup.SubstituteApiVersionInUrl = true;
});
builder.Services.AddScoped<AuthMiddlewareFliter>();
builder.Services.AddSingleton<IDataManager, DbData>();
//builder.Services.AddSingleton<IDataManager, StubData>();
var app = builder.Build();
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
app?.Services?.GetService<LolDbContext>()?.Database.EnsureCreated();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(options =>
{
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
{
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
description.GroupName.ToUpperInvariant());
}
});
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

@ -9,13 +9,7 @@ namespace ApiMappeur
public static ChampionDTO ToDTO(this Champion item)
{
/*if (item == null)
{
var message = string.Format("Champion cannot be empty");
*//*throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, message));
*//*
throw new Exception(message);
}*/
return new ChampionDTO()
{
Icon = item.Icon,
@ -40,9 +34,8 @@ namespace ApiMappeur
{
if (item == null)
{
var message = string.Format("Champion with name = {} not found", item.Name);
/*throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, message));
*/
var message = string.Format("Champion is null cannot null it");
throw new Exception(message);
}
@ -66,8 +59,6 @@ namespace ApiMappeur
if (dto == null)
{
var message = string.Format("Champion cannot be empty");
/*throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, message));
*/
throw new Exception(message);
}

@ -15,7 +15,7 @@ namespace ApiMappeur
}
return new ImageDTO()
{
base64 = item.Base64
base64 = item?.Base64 ?? ""
};
}

@ -1,74 +1,47 @@
using Model;
using Shared;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using static System.Net.Mime.MediaTypeNames;
namespace DTO
{
public class ChampionDTO
{
public string Name { get; set; }
public string Bio { get; set; }
public string Icon { get; set; }
public ChampionClass Class { get; set; }
}
/*public class ChampionFullDTO
{
*//*[Required(ErrorMessage = "Name is required")]
[StringLength(60, ErrorMessage = "Name can't be longer than 60 characters")]*//*
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("bio")]
public string Bio { get; set; }
public ChampionClass Class {get; set;}
public string Icon {get; set;}
public ReadOnlyDictionary<string, int> Characteristics { get; set; }
public ImageDTO LargeImage { get; set; }
public IEnumerable<SkinDto> skins { get; set; }
public IEnumerable<Skill> skills { get; set; }
public ChampionFullDTO()
{
Characteristics = new ReadOnlyDictionary<string, int>(new Dictionary<string, int>());
}
}
*/
public class ChampionFullDTO
{
[JsonPropertyName("characteristics")]
public ReadOnlyDictionary<string, int> Characteristics { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("bio")]
public string Bio { get; set; }
[JsonPropertyName("class")]
public ChampionClass Class { get; set; }
[JsonPropertyName("icon")]
public string Icon { get; set; }
[JsonPropertyName("largeImage")]
public ImageDTO LargeImage { get; set; }
[JsonPropertyName("skins")]
public IEnumerable<SkinDto> Skins { get; set; }
[JsonPropertyName("skills")]
public IEnumerable<Skill> Skills { get; set; }
}
using Model;
using Shared;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using static System.Net.Mime.MediaTypeNames;
namespace DTO
{
public class ChampionDTO
{
public string Name { get; set; }
public string Bio { get; set; }
public string Icon { get; set; }
public ChampionClass Class { get; set; }
}
public class ChampionFullDTO
{
[JsonPropertyName("characteristics")]
public ReadOnlyDictionary<string, int> Characteristics { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("bio")]
public string Bio { get; set; }
[JsonPropertyName("class")]
public ChampionClass Class { get; set; }
[JsonPropertyName("icon")]
public string Icon { get; set; }
[JsonPropertyName("largeImage")]
public ImageDTO LargeImage { get; set; }
[JsonPropertyName("skins")]
public IEnumerable<SkinDto> Skins { get; set; }
[JsonPropertyName("skills")]
public IEnumerable<Skill> Skills { get; set; }
}
}

@ -10,7 +10,7 @@ La racine de notre git est composée de deux dossiers essentiels au projet:
[**src**](src) : **Toute la partie code de l'application** (ne contient que le serveur TypeScript à l'heure actuelle sans l'implémentation du service de mail)
[**src**](EntityFramework_LoL/Sources) : **Toute la partie code de l'application** (ne contient que le serveur TypeScript à l'heure actuelle sans l'implémentation du service de mail)
@ -56,7 +56,7 @@ Tout d'abord, si ce n'est pas fait, clonez le dépôt de la branche **master**,
Ensuite, dans un terminal, assurez-vous que vous possédez les dépendances nécessaires, pour cela : ...
👉 [**Solution de l'application**](src//.sln)
👉 [**Solution de l'application**](EntityFramework_LoL/Sources/LeagueOfLegends.sln)
# Fonctionnement
@ -123,9 +123,9 @@ Nous injectons la chaîne de connexion depuis [appsettings.json](./EntityFramewo
- [x] &nbsp; ![Dto](./)
- [x] &nbsp; ![Dto](EntityFramework_LoL/Sources/DTO)
- [x] &nbsp; ![Mappeur](./)
- [x] &nbsp; ![Mappeur](EntityFramework_LoL/Sources/ApiMappeur)
* Toutes les données qu'expose l'API sont des DTOs mappés par ces mapper [**Mappeur**](./).
@ -133,27 +133,33 @@ Nous injectons la chaîne de connexion depuis [appsettings.json](./EntityFramewo
* Les réponse de l'API respectent les normes de code de retour. Vous pouvez retrouver ici un tableau les récapitulant [**Code de Retour**](./).
- [x] &nbsp; ![Manager EF](./)
- [x] &nbsp; ![Manager EF](EntityFramework_LoL/Sources/EntityMappers)
- [x] &nbsp; ![Test Unitaires EF](./)
- [x] &nbsp; ![Test Unitaires EF](EntityFramework_LoL/Sources/TestEF)
- [x] &nbsp; ![Test Unitaires Api](./)
- [x] &nbsp; ![Test Unitaires Api](EntityFramework_LoL/Sources/Test_Api)
- [x] &nbsp; ![Versioning](./)
- [x] &nbsp; ![Versioning]
- [x] &nbsp; ![Controller](./)
- [x] &nbsp; ![Controller](EntityFramework_LoL/Sources/API_LoL_Project/Controllers/version2)
* Toutes les opérations crud on été réalisées avec l'inclusion de réponse HATEOS.
- [x] &nbsp; ![Liason Bdd](./)
- [x] &nbsp; ![Client Console](./)
- [x] &nbsp; ![Client Console]()
:warning ![Client MAUI http](./)
:warning ![Client MAUI http](EntityFramework_LoL/Sources/ApiLib)
* Etant donné que l'on ne pouvait pas faire compiler le client sans les dépendances, nous avons fait le client en console vous pouvez le retrouvez ici - De plus étant donné que le model client est le même que ceului api, il était logique d'utiliser les même mappeur et les DTO c'est pour sa que le cient à la référence au Mappeur API et au DTO API **[Bibliothèque du Client http ](EntityFramework_LoL/Sources/ApiLib)**.
- [x] &nbsp; ![Déploiment & Hébergement Docker](./drone/yml)
- [x] &nbsp; ![Sécurité](EntityFramework_LoL/Sources/API_LoL_Project/Middleware/Auth/AuthMiddlewareFliter.cs)
* Minimal Sécurité juste sur les actions du Controller de rune page il faut faire attention a inculure la key : "ViveC#" dans votre request . (swgagger à été configuré pour l'autification il vous suffit de cadena pour vous authentifier) .
<div align = center>
* Etant donné que l'on ne pouvait pas faire compiler le client sans les dépendances, nous avons fait le client en console vous pouvez le retrouvez ici - De plus étant donné que le model client est le même que ceului api, il était logique d'utiliser les même mappeur et les DTO c'est pour sa que le cient à la référence au Mappeur API et au DTO API **[Bibliothèque du Client http ](./)**.
![Comment s'authentifier sur swagger](doc/images/AuthSwag.png)
- [x] &nbsp; ![Déploiment & Hébergement Docker](./drone/yml)
</div>
<>
</br>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Loading…
Cancel
Save