diff --git a/EntityFramework_LoL/Sources/.dockerignore b/EntityFramework_LoL/Sources/.dockerignore new file mode 100644 index 0000000..bdca33b --- /dev/null +++ b/EntityFramework_LoL/Sources/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/EntityFramework_LoL/Sources/API_LoL_Project/API_LoL_Project.csproj b/EntityFramework_LoL/Sources/API_LoL_Project/API_LoL_Project.csproj index 20a2363..72706e0 100644 --- a/EntityFramework_LoL/Sources/API_LoL_Project/API_LoL_Project.csproj +++ b/EntityFramework_LoL/Sources/API_LoL_Project/API_LoL_Project.csproj @@ -4,9 +4,12 @@ net6.0 enable enable + c1310bab-6367-419f-9338-2a73d29996c3 + Linux + diff --git a/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/ChampionsController.cs b/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/ChampionsController.cs index d2f06f2..c2558a0 100644 --- a/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/ChampionsController.cs +++ b/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/ChampionsController.cs @@ -28,7 +28,7 @@ namespace API_LoL_Project.Controllers // GET: api/ [HttpGet] - public async Task>> Get() + public async Task>> Get() { var champions = await dataManager.GetItems(0, await dataManager.GetNbItems()); IEnumerable res = champions.Select(c => c.toDTO()); @@ -40,7 +40,7 @@ namespace API_LoL_Project.Controllers // GET api//5 [HttpGet("{name}")] - public async Task> Get(string name) + public async Task> Get(string name) { var champion = await dataManager @@ -80,16 +80,44 @@ namespace API_LoL_Project.Controllers return NotFound(); } return Ok(); - } - - /* [HttpGet] - public async Task NbChampions() + } + + /* [HttpGet] + public async Task NbChampions() + { + var champions = await dataManager.GetItems(0, await dataManager.GetNbItems()); + IEnumerable res = champions.Select(c => c.toDTO()); + return Ok(res); + + }*/ + + [HttpGet("/{name}/skins")] + public async Task> GetChampionsSkins(string name) { - var champions = await dataManager.GetItems(0, await dataManager.GetNbItems()); - IEnumerable res = champions.Select(c => c.toDTO()); - return Ok(res); + var champions = await dataManager.GetItemsByName(name, 0, await dataManager.GetNbItems()); + //skinsDTO + IEnumerable res = champions.First().Skins; - }*/ + return Ok(res); + } + + [HttpGet("/{name}/skills")] + public async Task> GetChampionsSkills(string name) + { + var champions = await dataManager.GetItemsByName(name, 0, await dataManager.GetNbItems()); + //SkillDTO + IEnumerable res = champions.First().Skills; + return Ok(res); + } + + /*[HttpGet("/{name}/skins")] + public async Task NbChampions() + { + var champions = await dataManager.GetItems(0, await dataManager.GetNbItems()); + IEnumerable res = champions.Select(c => c.toDTO()); + return Ok(res); + + }*/ } } diff --git a/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/RuneController.cs b/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/RuneController.cs index 91ed8a8..f7a386e 100644 --- a/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/RuneController.cs +++ b/EntityFramework_LoL/Sources/API_LoL_Project/Controllers/RuneController.cs @@ -9,14 +9,14 @@ namespace API_LoL_Project.Controllers [ApiController] public class RuneController : ControllerBase { - IRunesManager runesManager; + public IRunesManager runesManager; // you should create a custom logger to be prety private readonly ILogger _logger; public RuneController(IDataManager dataManager,ILogger _logger) { - this.dataManager = dataManager.RunesMgr; + this.runesManager = dataManager.RunesMgr; } // GET: api/ diff --git a/EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile b/EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile new file mode 100644 index 0000000..96bbc0b --- /dev/null +++ b/EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile @@ -0,0 +1,26 @@ +#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 . +ENTRYPOINT ["dotnet", "API_LoL_Project.dll"] \ No newline at end of file diff --git a/EntityFramework_LoL/Sources/API_LoL_Project/Mapper/ChampionMapper.cs b/EntityFramework_LoL/Sources/API_LoL_Project/Mapper/ChampionMapper.cs index 779d951..3d175c7 100644 --- a/EntityFramework_LoL/Sources/API_LoL_Project/Mapper/ChampionMapper.cs +++ b/EntityFramework_LoL/Sources/API_LoL_Project/Mapper/ChampionMapper.cs @@ -21,8 +21,8 @@ namespace API_LoL_Project.Mapper if (dto == null) { var message = string.Format("Champion with name = {} not found", dto.Name); - throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, message)); - } + /*throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, message)); + */} return new Champion(dto.Name); } diff --git a/EntityFramework_LoL/Sources/API_LoL_Project/Properties/launchSettings.json b/EntityFramework_LoL/Sources/API_LoL_Project/Properties/launchSettings.json index 646c440..3f06632 100644 --- a/EntityFramework_LoL/Sources/API_LoL_Project/Properties/launchSettings.json +++ b/EntityFramework_LoL/Sources/API_LoL_Project/Properties/launchSettings.json @@ -1,31 +1,38 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:45539", - "sslPort": 44382 - } - }, - "profiles": { - "API_LoL_Project": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7041;http://localhost:5233", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:45539", + "sslPort": 44382 + } + }, + "profiles": { + "API_LoL_Project": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:7041;http://localhost:5233", + "dotnetRunMessages": true + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/EntityFramework_LoL/Sources/DTO/ChampionDTO.cs b/EntityFramework_LoL/Sources/DTO/ChampionDTO.cs index 2a8f880..5d0e9f6 100644 --- a/EntityFramework_LoL/Sources/DTO/ChampionDTO.cs +++ b/EntityFramework_LoL/Sources/DTO/ChampionDTO.cs @@ -1,8 +1,23 @@ -namespace DTO +using Model; + +namespace DTO { public class ChampionDTO { public string Name { get; set; } public string Bio { get; set; } + /*public string Icon { get; set; } + */ + } + public class ChampionFullDTO + { + public string Name { get; set; } + public string Bio { get; set; } + public string Characteristics { get; set; } + public byte[] LargeImage { get; set; } + + public IEnumerable skins { get; set; } + public IEnumerable skills { get; set; } + } } \ No newline at end of file diff --git a/EntityFramework_LoL/Sources/DTO/DTO.csproj b/EntityFramework_LoL/Sources/DTO/DTO.csproj index 132c02c..27fd28d 100644 --- a/EntityFramework_LoL/Sources/DTO/DTO.csproj +++ b/EntityFramework_LoL/Sources/DTO/DTO.csproj @@ -6,4 +6,8 @@ enable + + + +