avancement
continuous-integration/drone/push Build is failing Details

master
Jolys Enzo 2 years ago
parent eb4fb9c92f
commit f162af1a0a

@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\DTO\DTO.csproj" />
<ProjectReference Include="..\EntityFramwork\EntityFramwork.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\StubLib\StubLib.csproj" />
</ItemGroup>

@ -110,11 +110,18 @@ namespace Api_lol.Controllers
return Ok(champion.ModelToDto());
}
/*
public IActionResult GetVersion2()
[HttpGet]
[Route("/GetItems")]
public async Task<IEnumerable<Champion?>> GetItems(int index,int count,string? propertyName = null, bool descending = false)
{
return await data.ChampionsMgr.GetItems(index, count, propertyName, descending);
}
[HttpGet]
[Route("/GetNbItems")]
public async Task<int> GetNbItems()
{
return Ok("La version 2.0 est en cours de construction. PS : j'ai plusieur version !!");
return await data.ChampionsMgr.GetNbItems();
}
*/
}
}

@ -1,3 +1,4 @@
using EntityFramwork.Manager;
using Microsoft.AspNetCore.Mvc.Versioning;
using Model;
using StubLib;
@ -11,9 +12,9 @@ builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<IDataManager, StubData>();
builder.Services.AddSingleton<IDataManager,Manager>();
builder.Services.AddApiVersioning(o => o.ApiVersionReader = new UrlSegmentApiVersionReader());
//builder.Services.AddApiVersioning(o => o.ApiVersionReader = new UrlSegmentApiVersionReader());
var app = builder.Build();

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EntityFramwork\EntityFramwork.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,14 @@
// See https://aka.ms/new-console-template for more information
using EntityFramwork.Manager;
using Model;
Console.WriteLine("Start !");
Manager manager = new Manager();
//IEnumerable<Champion?> tmp = await manager.ChampionsMgr.GetItems(2, 4);
Console.WriteLine(await manager.ChampionsMgr.GetNbItems());
Console.WriteLine("End !");

@ -181,7 +181,8 @@ namespace EntityFramwork
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlite($"Data Source=BDD-APILOL.db");
//optionsBuilder.UseSqlite($"Data Source=BDD-APILOL.db");
optionsBuilder.UseSqlite($"Data Source=C:\\Users\\Jolys Enzo\\home\\BUT\\Projet\\TMP\\Api-LOL\\Sources\\EntityFramwork\\BDD-APILOL.db");
}
}
}

@ -52,9 +52,6 @@ namespace EntityFramwork.Factories
return new Champion(entity.Name,champClass:classe,icon:entity.Icon,bio:entity.Bio);
}
public
// Skins
public static EntitySkins SkinsModelToEntity(this Skin skin,int id)
{

@ -50,14 +50,14 @@ namespace EntityFramwork.Manager
{
if ( descending == false)
{
items = db.Champions.Skip(index).Take(count).OrderBy(e => e.Name).Select(e => e.EntityChampionToModele());
items = db.Champions.Skip(index).Take(count).OrderBy(e => e.Name).Select(e => e.EntityChampionToModele()).ToList();
}
else
{
items = db.Champions.Skip(index).Take(count).OrderByDescending(e => e.Name).Select(e => e.EntityChampionToModele());
items = db.Champions.Skip(index).Take(count).OrderByDescending(e => e.Name).Select(e => e.EntityChampionToModele()).ToList();
}
}
return Task.FromResult<IEnumerable<Champion?>>(items);
return Task.FromResult(items);
}
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
@ -92,7 +92,13 @@ namespace EntityFramwork.Manager
public Task<int> GetNbItems()
{
throw new NotImplementedException();
int nb = 0;
using (BDDContext db = new BDDContext())
{
nb = db.Champions.Count();
}
return Task.FromResult(nb);
}
public Task<int> GetNbItemsByCharacteristic(string charName)

@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFramwork.Migrations
{
[DbContext(typeof(BDDContext))]
[Migration("20230301140337_tp")]
partial class tp
[Migration("20230321151711_test")]
partial class test
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -19,7 +19,55 @@ namespace EntityFramwork.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("DTO.EntityChampions", b =>
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -111,54 +159,6 @@ namespace EntityFramwork.Migrations
});
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
@ -598,17 +598,6 @@ namespace EntityFramwork.Migrations
});
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
@ -628,6 +617,17 @@ namespace EntityFramwork.Migrations
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("EntityFramwork.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
@ -641,7 +641,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("DTO.EntityChampions", "Champions")
b.HasOne("EntityFramwork.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
@ -652,7 +652,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("DTO.EntityChampions", "Champion")
b.HasOne("EntityFramwork.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
@ -669,7 +669,7 @@ namespace EntityFramwork.Migrations
b.Navigation("Image");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.Navigation("Skills");

@ -7,7 +7,7 @@
namespace EntityFramwork.Migrations
{
/// <inheritdoc />
public partial class tp : Migration
public partial class test : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

@ -16,7 +16,55 @@ namespace EntityFramwork.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("DTO.EntityChampions", b =>
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -108,54 +156,6 @@ namespace EntityFramwork.Migrations
});
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
@ -595,17 +595,6 @@ namespace EntityFramwork.Migrations
});
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
@ -625,6 +614,17 @@ namespace EntityFramwork.Migrations
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("EntityFramwork.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
@ -638,7 +638,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("DTO.EntityChampions", "Champions")
b.HasOne("EntityFramwork.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
@ -649,7 +649,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("DTO.EntityChampions", "Champion")
b.HasOne("EntityFramwork.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
@ -666,7 +666,7 @@ namespace EntityFramwork.Migrations
b.Navigation("Image");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.Navigation("Skills");

@ -35,7 +35,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViewModels", "..\SourcesMob
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "..\SourcesMobileApp\Model\Model.csproj", "{59ADCCA8-AD1D-42FB-AA6E-3A8D8AAE26C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelationApi", "RelationApi\RelationApi.csproj", "{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RelationApi", "RelationApi\RelationApi.csproj", "{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "Console\Console.csproj", "{D00C8129-D2BC-4710-BDC0-FAAA640B0871}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -101,6 +103,10 @@ Global
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Release|Any CPU.Build.0 = Release|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -115,6 +121,7 @@ Global
{2F0E00EA-4A5A-48C9-B0AA-1A4AA015B372} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67}
{59ADCCA8-AD1D-42FB-AA6E-3A8D8AAE26C5} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67}
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67}
{D00C8129-D2BC-4710-BDC0-FAAA640B0871} = {C76D0C23-1FFA-4963-93CD-E12BD643F030}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {92F3083D-793F-4552-8A9A-0AD6534159C9}

@ -22,7 +22,7 @@ namespace RelationApi
public async Task<Champion?> AddItem(Champion? item)
{
HttpResponseMessage response = await _httpClient.PostAsJsonAsync();
throw new NotImplementedException();
}
public Task<bool> DeleteItem(Champion? item)
@ -30,9 +30,9 @@ namespace RelationApi
throw new NotImplementedException();
}
public Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
return await _httpClient.GetFromJsonAsync<IEnumerable<Champion?>>(IpApi + "GetItems");
}
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
@ -65,9 +65,9 @@ namespace RelationApi
throw new NotImplementedException();
}
public Task<int> GetNbItems()
public async Task<int> GetNbItems()
{
throw new NotImplementedException();
return await _httpClient.GetFromJsonAsync<int>(IpApi + "GetNbItems");
}
public Task<int> GetNbItemsByCharacteristic(string charName)

@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\EntityFramwork\EntityFramwork.csproj" />
<ProjectReference Include="..\..\Model\Model.csproj" />
<ProjectReference Include="..\..\StubLib\StubLib.csproj" />
</ItemGroup>

@ -1,5 +1,6 @@
using System.Collections.Immutable;
using System.Diagnostics;
using EntityFramwork.Manager;
using Microsoft.Extensions.DependencyInjection;
using Model;
using StubLib;
@ -16,7 +17,7 @@ namespace ConsoleTests
try
{
using var servicesProvider = new ServiceCollection()
.AddSingleton<IDataManager, StubData>()
.AddSingleton<IDataManager, Manager>()
.BuildServiceProvider();
dataManager = servicesProvider.GetRequiredService<IDataManager>();

@ -82,6 +82,7 @@
<MauiImage Include="Resources\Images\rp.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Sources\RelationApi\RelationApi.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
<ProjectReference Include="..\StubLib\StubLib.csproj" />

@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
using Model;
using RelationApi;
using StubLib;
using ViewModels;
@ -23,15 +24,22 @@ public static class MauiProgram
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("Font Awesome 6 Free-Solid-900.otf", "FASolid");
});
/// ICI CHANGER LE SINGLETON
/// ICI CHANGER LE SINGLETON
/*
builder.Services.AddSingleton<IDataManager, StubData>()
.AddSingleton<ChampionsMgrVM>()
.AddSingleton<SkinsMgrVM>()
.AddSingleton<ApplicationVM>()
.AddSingleton<ChampionsPage>();
*/
builder.Services.AddSingleton<IDataManager,Relation>()
.AddSingleton<ChampionsMgrVM>()
.AddSingleton<SkinsMgrVM>()
.AddSingleton<ApplicationVM>()
.AddSingleton<ChampionsPage>();
#if DEBUG
builder.Logging.AddDebug();
builder.Logging.AddDebug();
#endif
return builder.Build();

Loading…
Cancel
Save