Compare commits

..

No commits in common. 'master' and 'Merge_API_EF' have entirely different histories.

@ -2,7 +2,6 @@ kind: pipeline
type: docker
name: CI_ApiPm
trigger:
event:
- push
@ -75,8 +74,8 @@ steps:
- dotnet restore WF_EF_Api/WF_EF_Api.sln
- dotnet clean WF_EF_Api/WfApi/WfApi.csproj
- cd WF_EF_Api/WfApi
- dotnet nswag aspnetcore2openapi /output:/doc/swagger.json
depends_on: [clone, restore & build , test]
- dotnet nswag aspnetcore2openapi /output:/doc/swagger.json
depends_on: [clone, restore & build,test]
- name: code-inspection
image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8
@ -93,7 +92,7 @@ steps:
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
- dotnet sonarscanner end /d:sonar.login=$${sonar_token_wtf}
depends_on: [test,generate doc]
depends_on: [test]
- name: publish
image: mcr.microsoft.com/dotnet/sdk:8.0
@ -114,7 +113,7 @@ steps:
from_secret: POSTGRES_USER_API
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
from_secret: POSTGRES_DB_API
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
ADMINS: kentinbrongniart,lenibeaulaton
- name: deploy-auth-db
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
@ -129,7 +128,7 @@ steps:
from_secret: POSTGRES_USER_AUTH
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
from_secret: POSTGRES_DB_AUTH
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
ADMINS: kentinbrongniart,lenibeaulaton
- name: deploy-test-db
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
@ -141,31 +140,15 @@ steps:
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD: "test"
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER: "test"
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB: "wtf-test"
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
- name: update-database
image: mcr.microsoft.com/dotnet/sdk:8.0
#DB_PATH_AUTH: "WhatTheFantasy-wtf-api-auth"
environment:
HOST: "WhatTheFantasy-wtf-api-test"
PASSWORD: "test"
USER: "test"
DB: "wtf-test"
commands:
- cd WF_EF_Api/StubbedContextLib
- dotnet tool install --global dotnet-ef
- export PATH="$PATH:/root/.dotnet/tools"
- dotnet ef database update --connection "Host=$${HOST};Database=$${DB};Username=$${USER};Password=$${PASSWORD};"
depends_on: [deploy-api-db,deploy-auth-db,deploy-test-db]
ADMINS: kentinbrongniart,lenibeaulaton
- name: publish-to-registry
image: plugins/docker
settings:
dockerfile: WF_EF_Api/WfApi/Dockerfile
context: WF_EF_Api/
dockerfile: src/Dockerfile
context: src/
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/whatthefantasy/wf-pmapi
repo: hub.codefirst.iut.uca.fr/WhatTheFantasy/WF-PmAPI
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
@ -175,34 +158,27 @@ steps:
- name: deploy-container
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: hub.codefirst.iut.uca.fr/whatthefantasy/wf-pmapi:latest
IMAGENAME: hub.codefirst.iut.uca.fr/WhatTheFantasy/WF-PmAPI:latest
CONTAINERNAME: web-services
COMMAND: create
OVERWRITE: true
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API: "WhatTheFantasy-wtf-api"
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API: "SAE-WHAT-THE-FANTASY-wtf-api"
CODEFIRST_CLIENTDRONE_ENV_DB_USER_API:
from_secret: POSTGRES_USER_API
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_API:
from_secret: POSTGRES_PASSWORD_API
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_API:
from_secret: POSTGRES_DB_API
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_AUTH: "WhatTheFantasy-wtf-api-auth"
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_AUTH: "SAE-WHAT-THE-FANTASY-wtf-api-auth"
CODEFIRST_CLIENTDRONE_ENV_DB_USER_AUTH:
from_secret: POSTGRES_USER_AUTH
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_AUTH:
from_secret: POSTGRES_PASSWORD_AUTH
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_AUTH:
from_secret: POSTGRES_DB_AUTH
#CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "WhatTheFantasy-wtf-api-test"
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "api-test"
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "SAE-WHAT-THE-FANTASY-wtf-api"
CODEFIRST_CLIENTDRONE_ENV_DB_USER_API_TEST: "test"
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_API_TEST: "test"
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_API_TEST: "wtf-db-test"
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
ADMINS: kentinbrongniart,lenibeaulaton
depends_on: [restore & build, test, code-inspection, publish, publish-to-registry]

@ -1,21 +1,5 @@
# WF-PmAPI
### Commandes de démarrage
Installer les outils dotnet
```bash
dotnet tool install --global dotnet-ef
```
Générer une migration
```bash
dotnet ef migrations add myFirstMigration
```
Générer la base de donnée
```bash
dotnet ef database update
```
### Paquets
- NSwag.AspNetCore <br>
@ -39,13 +23,13 @@ niveau | description | coeff | jalon | État
🟢 | Tests - Appli Console | 1 | J1 | ✅
🟢 | Tests - Tests unitaires (avec SQLite in memory) | 2 | J1 | ❌
🟢 | Tests - Données stubbées et/ou Moq | 1 | J1 | ✅
🟡 | CI : build, tests, Sonar (doc?) | 1 | J1 |
🟡 | CI : build, tests, Sonar (doc?) | 1 | J1 |
🟡 | Utilisation de relations (One-to-One, One-to-Many, Many-to-Many) (+ mapping, TU, Requêtes) | 4 | J1 | ✅
🟢 | Liens avec le web service | 2 | J1 | ✅
🟡 | Utilisation d'un *Logger* | 1 | J1 | ❌
🟡 | Déploiement | 4 | J2 |
🟡 | Déploiement | 4 | J2 |
🔴 | Unit of Work❌ / Repository✅ + extras (héritage, accès concurrents...) | 8 | J2 | 🟨
🟢 | Utilisation dans le projet | 2 | J2 |
🟢 | Utilisation dans le projet | 2 | J2 |
🟢 | mon dépôt possède un readme qui apporte quelque chose... | 2 | J2 | ✅
@ -63,13 +47,13 @@ niveau | description | coeff | jalon | État
🟢 | Requêtes GET, PUT, POST, DELETE sur des données simples (1 seul type d'objet en retour, propriétés de types natifs) | 2 | J1 | ✅
🟡 | Pagination & filtrage | 2 | J1 | ✅
🟢 | Injection de service | 2 | J1 | ✅
🟡 | Requêtes GET, PUT, POST, DELETE sur des données complexes (plusieurs données complexes en retour) | 4 | J1 |
🟢 | Tests - Appli Console (consommation des requêtes) | 4 | J1 |
🟢 | Tests - Tests unitaires (avec Stub et/ou Moq) | 2 | J1 |
🟡 | CI : build, tests, Sonar, Documentation (en particulier Swagger avec exemples...) | 1 | J1 |
🟡 | Requêtes GET, PUT, POST, DELETE sur des données complexes (plusieurs données complexes en retour) | 4 | J1 | 🟨
🟢 | Tests - Appli Console (consommation des requêtes) | 4 | J1 | 🟨
🟢 | Tests - Tests unitaires (avec Stub et/ou Moq) | 2 | J1 |
🟡 | CI : build, tests, Sonar, Documentation (en particulier Swagger avec exemples...) | 1 | J1 |
🟢 | Liens avec la persistance en base de données | 4 | J1 | ✅
🟡 | Utilisation d'un *Logger* | 1 | J1 | ❌
🟡 | Déploiement | 4 | J2 |
🟡 | Utilisation dans le projet | 4 | J2 |
🟡 | Déploiement | 4 | J2 |
🟡 | Utilisation dans le projet | 4 | J2 |
🎬 | mon dépôt possède un readme qui apporte quelque chose... | 1 | J2 | ✅

@ -12,7 +12,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.3">

@ -176,11 +176,6 @@ namespace Contextlib
u.Password = user.Password;
change = true;
}
if (user.Lang != u.Lang)
{
u.Lang = user.Lang;
change = true;
}
_repo.Update(u);
if (change)_context.SaveChanges();
}

@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Entity;
using Microsoft.EntityFrameworkCore;
namespace Contextlib
{
public class WTFContext : DbContext
@ -89,12 +90,7 @@ namespace Contextlib
{
if (!options.IsConfigured)
{
options.UseSqlServer(
$"Server={Environment.GetEnvironmentVariable("DB_SERVER_AUTH")};" +
$"Database={Environment.GetEnvironmentVariable("DB_DATABASE_AUTH")};" +
$"User Id={Environment.GetEnvironmentVariable("DB_USER_AUTH")};" +
$"Password={Environment.GetEnvironmentVariable("DB_PASSWORD_AUTH")};");
//options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Wf-Database.mdf;Trusted_Connection=True;");
options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Wf-Database.mdf;Trusted_Connection=True;");
}
}
}

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -7,7 +7,6 @@
public string Password { get; set; }
public string Email { get; set; }
public DateTime date { get; set; }
public TypeLangageDTO Lang { get; set; }
public string ImageProfil { get; set; }
}
}

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -217,7 +217,6 @@ namespace Dto2Entities
user.Email = item.Email;
user.date = item.Created;
user.ImageProfil = item.Images.ImgPath;
user.Lang = item.Lang.ToDto();
return user;
}
@ -466,7 +465,6 @@ namespace Dto2Entities
user.Created = item.date;
user.Images = new Images();
user.Images.ImgPath = item.ImageProfil;
user.Lang = item.Lang.ToEntity();
return user;
}

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -17,8 +17,6 @@ namespace Entity
[Required]
[StringLength(50)]
public string UserName { get; set; }
[Required]
public LangEnum Lang { get; set; } = LangEnum.vo;
[Required]
[StringLength(50)]

@ -28,13 +28,13 @@ namespace ServicesApi
public async Task<PaginationResult<QuoteDTO>> GetAllQuote()
{
var quotes = quoteService.GetAllQuote().Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, quotes.Count(), quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> GetAllQuoteLang(int index, int pageSize, int lang)
{
var quotes = quoteService.GetAllQuoteLang(index, pageSize,lang).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<QuoteDTO> GetDailyQuote(DateOnly date, int lang)
@ -45,19 +45,19 @@ namespace ServicesApi
public async Task<PaginationResult<QuoteDTO>> GetFavorites(int index, int pageSize, int UserId)
{
var quotes = quoteService.GetFavorites(index, pageSize, UserId).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> GetInvalidQuote(int index, int pageSize, int lang)
{
var quotes = quoteService.GetInvalidQuote(index, pageSize, lang).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> GetInvalidQuote(int index, int pageSize)
{
var quotes = quoteService.GetInvalidQuote(index, pageSize).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<int> GetLastQuoteId()
@ -75,19 +75,19 @@ namespace ServicesApi
public async Task<PaginationResult<QuoteDTO>> GetSomeQuote(int index, int pageSize)
{
var quotes = quoteService.GetSomeQuote(index, pageSize).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> GetSuggestions(int index, int pageSize, int lang)
{
var quotes = quoteService.GetSuggestions(index, pageSize, lang).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> GetValidQuote(int index, int pageSize)
{
var quotes = quoteService.GetValidQuote(index, pageSize).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task RemoveQuote(int quoteId)
@ -98,19 +98,19 @@ namespace ServicesApi
public async Task<PaginationResult<QuoteDTO>> SearchByCharacter(string character, int index, int pageSize, int lang)
{
var quotes = quoteService.SearchByCharacter(character, index, pageSize, lang).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> SearchByContent(string content, int index, int pageSize, int lang)
{
var quotes = quoteService.SearchByContent(content, index, pageSize, lang).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task<PaginationResult<QuoteDTO>> SearchBySource(string source, int index, int pageSize, int lang)
{
var quotes = quoteService.SearchBySource(source, index, pageSize, lang).Result.items;
return new PaginationResult<QuoteDTO>(quotes.Count(), index, pageSize, quotes.ToDto());
return new PaginationResult<QuoteDTO>(quotes.Count(), 0, 10, quotes.ToDto());
}
public async Task UpdateQuote(int quoteId, QuoteDTO quote)

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -2,9 +2,9 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using StubbedContextLib;
#nullable disable
@ -12,8 +12,8 @@ using StubbedContextLib;
namespace StubbedContextLib.Migrations
{
[DbContext(typeof(StubWTFContext))]
[Migration("20250403162101_myFirstMigration")]
partial class myFirstMigration
[Migration("20250402113707_pm_api")]
partial class pm_api
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,20 +21,20 @@ namespace StubbedContextLib.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
.HasAnnotation("Relational:MaxIdentifierLength", 128);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entity.Admin", b =>
{
b.Property<int>("IdUsers")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("IdUsers"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdUsers"));
b.Property<int>("UserId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("IdUsers");
@ -47,17 +47,17 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
@ -130,61 +130,59 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.Commentary", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
b.Property<int>("IdUser")
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("IdQuote")
.HasColumnType("int");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("DateCommentary")
.HasColumnType("date")
.HasColumnName("DateCommentary");
b.Property<int>("IdQuote")
.HasColumnType("integer");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("IdUser")
.HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.HasKey("Id");
b.HasKey("IdUser", "IdQuote");
b.HasIndex("IdQuote");
b.HasIndex("IdUser");
b.ToTable("comments");
b.HasData(
new
{
Id = 1,
IdUser = 2,
IdQuote = 1,
Comment = "Ce film est le meilleur",
DateCommentary = new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified),
IdQuote = 1,
IdUser = 2
Id = 1
},
new
{
Id = 2,
IdUser = 3,
IdQuote = 1,
Comment = "Very good",
DateCommentary = new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified),
IdQuote = 1,
IdUser = 3
Id = 2
});
});
modelBuilder.Entity("Entity.Favorite", b =>
{
b.Property<int>("IdQuote")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdUsers")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("IdQuote", "IdUsers");
@ -244,13 +242,13 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImgPath")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -313,42 +311,42 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AnswerA")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("AnswerB")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("AnswerC")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("AnswerD")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("CorrectAnswer")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("character varying(1)");
.HasColumnType("nvarchar(1)");
b.Property<bool>("IsValid")
.HasColumnType("boolean");
.HasColumnType("bit");
b.Property<string>("Text")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
@ -471,20 +469,20 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("NbQuestion")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
@ -512,10 +510,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.QuizQuestion", b =>
{
b.Property<int>("IdQuestion")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdQuiz")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("IdQuestion", "IdQuiz");
@ -580,32 +578,32 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("nvarchar(100)");
b.Property<int>("IdCharacter")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdSource")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int?>("IdUsersPropose")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<bool>("IsValid")
.HasColumnType("boolean");
.HasColumnType("bit");
b.Property<int>("Langage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("Likes")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -734,20 +732,20 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("nvarchar(100)");
b.Property<int>("TypeSrc")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("Year")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -795,9 +793,9 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("date")
@ -806,20 +804,20 @@ namespace StubbedContextLib.Migrations
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<int>("IdImage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
.HasColumnType("nvarchar(200)");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.HasKey("Id");

@ -1,6 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
@ -9,7 +8,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace StubbedContextLib.Migrations
{
/// <inheritdoc />
public partial class myFirstMigration : Migration
public partial class pm_api : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -18,9 +17,9 @@ namespace StubbedContextLib.Migrations
name: "images",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ImgPath = table.Column<string>(type: "text", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ImgPath = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
@ -31,15 +30,15 @@ namespace StubbedContextLib.Migrations
name: "question",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Text = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
AnswerA = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
AnswerB = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
AnswerC = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
AnswerD = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
CorrectAnswer = table.Column<string>(type: "character varying(1)", maxLength: 1, nullable: false),
IsValid = table.Column<bool>(type: "boolean", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Text = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
AnswerA = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AnswerB = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AnswerC = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AnswerD = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
CorrectAnswer = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false),
IsValid = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
@ -50,11 +49,11 @@ namespace StubbedContextLib.Migrations
name: "sources",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Year = table.Column<int>(type: "integer", nullable: false),
TypeSrc = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
TypeSrc = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -65,10 +64,10 @@ namespace StubbedContextLib.Migrations
name: "characters",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
IdImage = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
IdImage = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -85,11 +84,11 @@ namespace StubbedContextLib.Migrations
name: "quizzes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
IdImage = table.Column<int>(type: "integer", nullable: false),
NbQuestion = table.Column<int>(type: "integer", nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
IdImage = table.Column<int>(type: "int", nullable: false),
NbQuestion = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -106,12 +105,12 @@ namespace StubbedContextLib.Migrations
name: "users",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Email = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Password = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
IdImage = table.Column<int>(type: "integer", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Password = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
IdImage = table.Column<int>(type: "int", nullable: false),
Created = table.Column<DateTime>(type: "date", nullable: false)
},
constraints: table =>
@ -129,8 +128,8 @@ namespace StubbedContextLib.Migrations
name: "QuizQuestion",
columns: table => new
{
IdQuiz = table.Column<int>(type: "integer", nullable: false),
IdQuestion = table.Column<int>(type: "integer", nullable: false)
IdQuiz = table.Column<int>(type: "int", nullable: false),
IdQuestion = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -153,9 +152,9 @@ namespace StubbedContextLib.Migrations
name: "admins",
columns: table => new
{
IdUsers = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<int>(type: "integer", nullable: false)
IdUsers = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -172,15 +171,15 @@ namespace StubbedContextLib.Migrations
name: "quotes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Content = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Likes = table.Column<int>(type: "integer", nullable: false),
Langage = table.Column<int>(type: "integer", nullable: false),
IsValid = table.Column<bool>(type: "boolean", nullable: false),
IdCharacter = table.Column<int>(type: "integer", nullable: false),
IdSource = table.Column<int>(type: "integer", nullable: false),
IdUsersPropose = table.Column<int>(type: "integer", nullable: true)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Content = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Likes = table.Column<int>(type: "int", nullable: false),
Langage = table.Column<int>(type: "int", nullable: false),
IsValid = table.Column<bool>(type: "bit", nullable: false),
IdCharacter = table.Column<int>(type: "int", nullable: false),
IdSource = table.Column<int>(type: "int", nullable: false),
IdUsersPropose = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
@ -208,16 +207,16 @@ namespace StubbedContextLib.Migrations
name: "comments",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
IdUser = table.Column<int>(type: "integer", nullable: false),
IdQuote = table.Column<int>(type: "integer", nullable: false),
IdUser = table.Column<int>(type: "int", nullable: false),
IdQuote = table.Column<int>(type: "int", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DateCommentary = table.Column<DateTime>(type: "date", nullable: false),
Comment = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
Comment = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_comments", x => x.Id);
table.PrimaryKey("PK_comments", x => new { x.IdUser, x.IdQuote });
table.ForeignKey(
name: "FK_comments_quotes_IdQuote",
column: x => x.IdQuote,
@ -235,8 +234,8 @@ namespace StubbedContextLib.Migrations
name: "favorites",
columns: table => new
{
IdUsers = table.Column<int>(type: "integer", nullable: false),
IdQuote = table.Column<int>(type: "integer", nullable: false)
IdUsers = table.Column<int>(type: "int", nullable: false),
IdQuote = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -378,11 +377,11 @@ namespace StubbedContextLib.Migrations
migrationBuilder.InsertData(
table: "comments",
columns: new[] { "Id", "Comment", "DateCommentary", "IdQuote", "IdUser" },
columns: new[] { "IdQuote", "IdUser", "Comment", "DateCommentary", "Id" },
values: new object[,]
{
{ 1, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 2 },
{ 2, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 3 }
{ 1, 2, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1 },
{ 1, 3, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 2 }
});
migrationBuilder.InsertData(
@ -416,11 +415,6 @@ namespace StubbedContextLib.Migrations
table: "comments",
column: "IdQuote");
migrationBuilder.CreateIndex(
name: "IX_comments_IdUser",
table: "comments",
column: "IdUser");
migrationBuilder.CreateIndex(
name: "IX_favorites_IdUsers",
table: "favorites",

@ -0,0 +1,86 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace StubbedContextLib.Migrations
{
/// <inheritdoc />
public partial class pm_apiV2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_comments",
table: "comments");
migrationBuilder.DeleteData(
table: "comments",
keyColumns: new[] { "IdQuote", "IdUser" },
keyValues: new object[] { 1, 2 });
migrationBuilder.DeleteData(
table: "comments",
keyColumns: new[] { "IdQuote", "IdUser" },
keyValues: new object[] { 1, 3 });
migrationBuilder.AddPrimaryKey(
name: "PK_comments",
table: "comments",
column: "Id");
migrationBuilder.InsertData(
table: "comments",
columns: new[] { "Id", "Comment", "DateCommentary", "IdQuote", "IdUser" },
values: new object[,]
{
{ 1, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 2 },
{ 2, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 3 }
});
migrationBuilder.CreateIndex(
name: "IX_comments_IdUser",
table: "comments",
column: "IdUser");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_comments",
table: "comments");
migrationBuilder.DropIndex(
name: "IX_comments_IdUser",
table: "comments");
migrationBuilder.DeleteData(
table: "comments",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "comments",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.AddPrimaryKey(
name: "PK_comments",
table: "comments",
columns: new[] { "IdUser", "IdQuote" });
migrationBuilder.InsertData(
table: "comments",
columns: new[] { "IdQuote", "IdUser", "Comment", "DateCommentary", "Id" },
values: new object[,]
{
{ 1, 2, "Ce film est le meilleur", new DateTime(2025, 2, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 1 },
{ 1, 3, "Very good", new DateTime(2025, 3, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 2 }
});
}
}
}

@ -1,99 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace StubbedContextLib.Migrations
{
/// <inheritdoc />
public partial class migrLangUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Lang",
table: "users",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 1,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 2,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 3,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 4,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 5,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 6,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 7,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 8,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 9,
column: "Lang",
value: 0);
migrationBuilder.UpdateData(
table: "users",
keyColumn: "Id",
keyValue: 10,
column: "Lang",
value: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Lang",
table: "users");
}
}
}

@ -2,8 +2,8 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using StubbedContextLib;
#nullable disable
@ -18,20 +18,20 @@ namespace StubbedContextLib.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
.HasAnnotation("Relational:MaxIdentifierLength", 128);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entity.Admin", b =>
{
b.Property<int>("IdUsers")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("IdUsers"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdUsers"));
b.Property<int>("UserId")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("IdUsers");
@ -44,17 +44,17 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
@ -129,24 +129,24 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("DateCommentary")
.HasColumnType("date")
.HasColumnName("DateCommentary");
b.Property<int>("IdQuote")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdUser")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -178,10 +178,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.Favorite", b =>
{
b.Property<int>("IdQuote")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdUsers")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("IdQuote", "IdUsers");
@ -241,13 +241,13 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImgPath")
.IsRequired()
.HasColumnType("text");
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -310,42 +310,42 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AnswerA")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("AnswerB")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("AnswerC")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("AnswerD")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<string>("CorrectAnswer")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("character varying(1)");
.HasColumnType("nvarchar(1)");
b.Property<bool>("IsValid")
.HasColumnType("boolean");
.HasColumnType("bit");
b.Property<string>("Text")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
@ -468,20 +468,20 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdImage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("NbQuestion")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
@ -509,10 +509,10 @@ namespace StubbedContextLib.Migrations
modelBuilder.Entity("Entity.QuizQuestion", b =>
{
b.Property<int>("IdQuestion")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdQuiz")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("IdQuestion", "IdQuiz");
@ -577,32 +577,32 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("nvarchar(100)");
b.Property<int>("IdCharacter")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("IdSource")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int?>("IdUsersPropose")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<bool>("IsValid")
.HasColumnType("boolean");
.HasColumnType("bit");
b.Property<int>("Langage")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("Likes")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -731,20 +731,20 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("nvarchar(100)");
b.Property<int>("TypeSrc")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<int>("Year")
.HasColumnType("integer");
.HasColumnType("int");
b.HasKey("Id");
@ -792,9 +792,9 @@ namespace StubbedContextLib.Migrations
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
.HasColumnType("int");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("date")
@ -803,23 +803,20 @@ namespace StubbedContextLib.Migrations
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.Property<int>("IdImage")
.HasColumnType("integer");
b.Property<int>("Lang")
.HasColumnType("integer");
.HasColumnType("int");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
.HasColumnType("nvarchar(200)");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
@ -834,7 +831,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 5, 12, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "jhonDhoe@gmail.com",
IdImage = 1,
Lang = 0,
Password = "1234",
UserName = "Jhon-Dhoe"
},
@ -844,7 +840,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 3, 19, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "lucy_rose@outlook.com",
IdImage = 2,
Lang = 0,
Password = "abcd",
UserName = "Lucy-Rose"
},
@ -854,7 +849,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2024, 11, 2, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "mark.taylor@yahoo.com",
IdImage = 3,
Lang = 0,
Password = "5678",
UserName = "Mark-Taylor"
},
@ -864,7 +858,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 2, 28, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "sophie.martin@gmail.com",
IdImage = 4,
Lang = 0,
Password = "4321",
UserName = "Sophie-Martin"
},
@ -874,7 +867,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 1, 15, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "nathan_doe@aol.com",
IdImage = 5,
Lang = 0,
Password = "8765",
UserName = "Nathan-Doe"
},
@ -884,7 +876,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 4, 7, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "ella.brown@icloud.com",
IdImage = 6,
Lang = 0,
Password = "2468",
UserName = "Ella-Brown"
},
@ -894,7 +885,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2024, 12, 25, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "oliver_smith@gmail.com",
IdImage = 7,
Lang = 0,
Password = "1357",
UserName = "Oliver-Smith"
},
@ -904,7 +894,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 3, 5, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "mia.jones@outlook.com",
IdImage = 8,
Lang = 0,
Password = "1122",
UserName = "Mia-Jones"
},
@ -914,7 +903,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 2, 22, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "kevin_williams@aol.com",
IdImage = 9,
Lang = 0,
Password = "2233",
UserName = "Kevin-Williams"
},
@ -924,7 +912,6 @@ namespace StubbedContextLib.Migrations
Created = new DateTime(2025, 1, 3, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "olivia.white@yahoo.com",
IdImage = 10,
Lang = 0,
Password = "3344",
UserName = "Olivia-White"
});

@ -1,153 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Contextlib;
using Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Contextlib;
using Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using Npgsql.EntityFrameworkCore.PostgreSQL;
namespace StubbedContextLib
{
public class StubWTFContext : WTFContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
/*modelBuilder.Entity<Admin>().HasData(
new Admin() { IdUsers = 1 }
);*/
modelBuilder.Entity<Images>().HasData(
new Images() { Id = 1, ImgPath = "https://th.bing.com/th/id/OIP.TJuWNCsibz8MVmhdNQEdMwHaE8?w=244&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 2, ImgPath = "https://th.bing.com/th/id/OIP.NgXRQ5-IknA6_qOPFhLWIwHaHK?w=165&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 3, ImgPath = "https://th.bing.com/th/id/OIP.XcJoJ6bC9sAMjol1pJn5UQHaLH?w=118&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 4, ImgPath = "https://th.bing.com/th/id/OIP.PPIESqZaNDa-qUcfSDXhdQHaGK?w=210&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 5, ImgPath = "https://th.bing.com/th/id/OIP.XBghSl2kfRNNtQoSxc901wHaHa?w=177&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 6, ImgPath = "https://th.bing.com/th/id/OIP.af1Aid64cqEKoIOBgCPxtQHaJO?w=145&h=182&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 7, ImgPath = "https://th.bing.com/th/id/OIP.ri5vSXr5lNTLt4DO6KQXyQHaI4?w=158&h=189&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 8, ImgPath = "https://th.bing.com/th/id/OIP.uPTRLR8uspCiafiunUqKfQHaMJ?w=115&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 9, ImgPath = "https://th.bing.com/th/id/OIP.hcJis4rKbyQtugsoFJU2ngHaM_?w=118&h=207&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 10, ImgPath = "https://th.bing.com/th/id/OIP.Py1_XfUrKJY_A6tYEmFS5wHaE8?w=280&h=187&c=7&r=0&o=5&pid=1.7" }
);
modelBuilder.Entity<Users>().HasData(
new Users() { Id = 1, Email = "jhonDhoe@gmail.com", Password = "1234", Created = new DateTime(2025, 5, 12), UserName = "Jhon-Dhoe", IdImage = 1 },
new Users() { Id = 2, Email = "lucy_rose@outlook.com", Password = "abcd", Created = new DateTime(2025, 3, 19), UserName = "Lucy-Rose", IdImage = 2 },
new Users() { Id = 3, Email = "mark.taylor@yahoo.com", Password = "5678", Created = new DateTime(2024, 11, 2), UserName = "Mark-Taylor", IdImage = 3 },
new Users() { Id = 4, Email = "sophie.martin@gmail.com", Password = "4321", Created = new DateTime(2025, 2, 28), UserName = "Sophie-Martin", IdImage = 4 },
new Users() { Id = 5, Email = "nathan_doe@aol.com", Password = "8765", Created = new DateTime(2025, 1, 15), UserName = "Nathan-Doe", IdImage = 5 },
new Users() { Id = 6, Email = "ella.brown@icloud.com", Password = "2468", Created = new DateTime(2025, 4, 7), UserName = "Ella-Brown", IdImage = 6 },
new Users() { Id = 7, Email = "oliver_smith@gmail.com", Password = "1357", Created = new DateTime(2024, 12, 25), UserName = "Oliver-Smith", IdImage = 7 },
new Users() { Id = 8, Email = "mia.jones@outlook.com", Password = "1122", Created = new DateTime(2025, 3, 5), UserName = "Mia-Jones", IdImage = 8 },
new Users() { Id = 9, Email = "kevin_williams@aol.com", Password = "2233", Created = new DateTime(2025, 2, 22), UserName = "Kevin-Williams", IdImage = 9 },
new Users() { Id = 10, Email = "olivia.white@yahoo.com", Password = "3344", Created = new DateTime(2025, 1, 3), UserName = "Olivia-White", IdImage = 10 }
);
modelBuilder.Entity<Character>().HasData(
new Character() { Id = 1 , Name = "Alan Grant", IdImage = 1},
new Character() { Id = 2, Name = "Aragorn", IdImage = 2 },
new Character() { Id = 3, Name = "Legolas", IdImage = 3 },
new Character() { Id = 4, Name = "Frodon", IdImage = 4 },
new Character() { Id = 5, Name = "Dobby", IdImage = 5 },
new Character() { Id = 6, Name = "Jon Snow", IdImage = 6 },
new Character() { Id = 7, Name = "Daenerys Targaryen", IdImage = 7 },
new Character() { Id = 8, Name = "Luke Skywalker", IdImage = 8 },
new Character() { Id = 9, Name = "Princess Leia", IdImage = 9 },
new Character() { Id = 10, Name = "Harry Potter", IdImage = 10 }
);
modelBuilder.Entity<Quote>().HasData(
new Quote() { Id = 1, Content = "Je n'y crois pas. Je n'y crois pas. Ce n'est pas possible", IdCharacter = 1, IdSource = 1, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 2, Content = "There is always hope", IdCharacter = 2, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 3, Content = "A red sun rises. Blood has been spilled this night.", IdCharacter = 3, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 4, Content = "I wish the Ring had never come to me.I wish none of this had happened.", IdCharacter = 4, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 5, Content = "Dobby is a free elf!", IdCharacter = 5, IdSource = 4, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 6, Content = "Winter is comming", IdCharacter = 6, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 7, Content = "Je suis la dernière Targaryen. Je suis la reine des dragons", IdCharacter = 7, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 8, Content = "Je ne suis pas prêt à affronter ça. C'est trop pour moi.", IdCharacter = 8, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 9, Content = "Aidez-moi, Obi-Wan Kenobi, vous êtes mon seul espoir.", IdCharacter = 9, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 10, Content = "La quoi ?", IdCharacter = 10, IdSource = 4, IdUsersPropose = 1, IsValid = false, Langage = LangEnum.vf, Likes = 11025 }
);
modelBuilder.Entity<Commentary>().HasData(
new Commentary() { Id = 1, Comment = "Ce film est le meilleur", DateCommentary = new DateTime(2025,2,3), IdQuote = 1, IdUser = 2 },
new Commentary() { Id = 2, Comment = "Very good", DateCommentary = new DateTime(2025, 3, 11), IdQuote = 1, IdUser = 3 }
);
modelBuilder.Entity<Favorite>().HasData(
new Favorite() { IdQuote = 2, IdUsers = 8 },
new Favorite() { IdQuote = 5, IdUsers = 3 },
new Favorite() { IdQuote = 9, IdUsers = 1 },
new Favorite() { IdQuote = 4, IdUsers = 10 },
new Favorite() { IdQuote = 3, IdUsers = 2 },
new Favorite() { IdQuote = 6, IdUsers = 7 },
new Favorite() { IdQuote = 1, IdUsers = 6 },
new Favorite() { IdQuote = 8, IdUsers = 9 },
new Favorite() { IdQuote = 10, IdUsers = 5 }
);
modelBuilder.Entity<Question>().HasData(
new Question() { Id = 1, Text = "Qui est le leader de la Communauté de l'Anneau ?", AnswerA = "Gimli", AnswerB = "Aragorn", AnswerC = "Frodon", AnswerD = "Gandalf", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 2, Text = "Dans quelle maison Harry Potter est-il ?", AnswerA = "Serdaigle", AnswerB = "Gryffondor", AnswerC = "Serpentard", AnswerD = "Poufsouffle", CorrectAnswer = "B" },
new Question() { Id = 3, Text = "Qui est le Seigneur des Ténèbres dans la saga Le Seigneur des Anneaux ?", AnswerA = "Saroumane", AnswerB = "Sauron", AnswerC = "Gollum", AnswerD = "Gothmog", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 4, Text = "Dans le film Star Wars : Episode IV, qui sauve Luke Skywalker de l'Étoile de la Mort ?", AnswerA = "Han Solo", AnswerB = "Princesse Leia", AnswerC = "Chewbacca", AnswerD = "R2-D2", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 5, Text = "Qui est le souverain de Narnia dans Le Lion, la Sorcière Blanche et l'Armoire Magique ?", AnswerA = "Reine Jadis", AnswerB = "Aslan", AnswerC = "Edmund", AnswerD = "Lucy", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 6, Text = "Quel est le nom du dragon dans Le Hobbit ?", AnswerA = "Smaug", AnswerB = "Falkor", AnswerC = "Norbert", AnswerD = "Shenron", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 7, Text = "Qui est la première personne à être mordue par un vampire dans Twilight ?", AnswerA = "Bella Swan", AnswerB = "Edward Cullen", AnswerC = "Jacob Black", AnswerD = "Victoria", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 8, Text = "Quel personnage dit Que la Force soit avec toi dans Star Wars ?", AnswerA = "Obi-Wan Kenobi", AnswerB = "Yoda", AnswerC = "Han Solo", AnswerD = "Luke Skywalker", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 9, Text = "Dans Jurassic Park, quel est le nom du paléontologue sur l'île ?", AnswerA = "Dr. Ellie Sattler", AnswerB = "Alan Grant", AnswerC = "John Hammond", AnswerD = "Dennis Nedry", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 10, Text = "Dans Game of Thrones, qui est surnommée la Mère des Dragons ?", AnswerA = "Cersei Lannister", AnswerB = "Arya Stark", AnswerC = "Daenerys Targaryen", AnswerD = "Sansa Stark", CorrectAnswer = "C", IsValid = true }
);
modelBuilder.Entity<Quiz>().HasData(
new Quiz() { Id = 1, IdImage = 1, Title = "Quiz 1", NbQuestion = 5 },
new Quiz() { Id = 2, IdImage = 2, Title = "Quiz 2", NbQuestion = 5 }
);
modelBuilder.Entity<QuizQuestion>().HasData(
new QuizQuestion() { IdQuestion = 1, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 2, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 3, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 4, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 5, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 6, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 7, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 8, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 9, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 10, IdQuiz = 2 }
);
modelBuilder.Entity<Source>().HasData(
new Source() { Id = 1, Title = "Jurassic Park", TypeSrc = TypeSrcEnum.movie, Year = 1993 },
new Source() { Id = 2, Title = "Le Seigneur des anneaux : La Communauté de l'anneau", TypeSrc = TypeSrcEnum.movie, Year = 2001 },
new Source() { Id = 3, Title = "Game of throne", TypeSrc = TypeSrcEnum.series, Year = 2011 },
new Source() { Id = 4, Title = "Harry Potter à l'école des sorcier", TypeSrc = TypeSrcEnum.movie, Year = 1997 },
new Source() { Id = 5, Title = "Star Wars, épisode IV : Un nouvel espoir", TypeSrc = TypeSrcEnum.movie, Year = 1977 }
);
}
public StubWTFContext()
{ }
public StubWTFContext(DbContextOptions<WTFContext> options)
: base(options)
{ }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
{
options.UseNpgsql("Host=WhatTheFantasy-wtf-api-test;Database=wtf-test;Username=test;Password=test;");
//options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Wf-Database.mdf;Trusted_Connection=True;");
}
}
}
}
namespace StubbedContextLib
{
public class StubWTFContext : WTFContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
/*modelBuilder.Entity<Admin>().HasData(
new Admin() { IdUsers = 1 }
);*/
modelBuilder.Entity<Images>().HasData(
new Images() { Id = 1, ImgPath = "https://th.bing.com/th/id/OIP.TJuWNCsibz8MVmhdNQEdMwHaE8?w=244&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 2, ImgPath = "https://th.bing.com/th/id/OIP.NgXRQ5-IknA6_qOPFhLWIwHaHK?w=165&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 3, ImgPath = "https://th.bing.com/th/id/OIP.XcJoJ6bC9sAMjol1pJn5UQHaLH?w=118&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 4, ImgPath = "https://th.bing.com/th/id/OIP.PPIESqZaNDa-qUcfSDXhdQHaGK?w=210&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 5, ImgPath = "https://th.bing.com/th/id/OIP.XBghSl2kfRNNtQoSxc901wHaHa?w=177&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 6, ImgPath = "https://th.bing.com/th/id/OIP.af1Aid64cqEKoIOBgCPxtQHaJO?w=145&h=182&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 7, ImgPath = "https://th.bing.com/th/id/OIP.ri5vSXr5lNTLt4DO6KQXyQHaI4?w=158&h=189&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 8, ImgPath = "https://th.bing.com/th/id/OIP.uPTRLR8uspCiafiunUqKfQHaMJ?w=115&h=180&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 9, ImgPath = "https://th.bing.com/th/id/OIP.hcJis4rKbyQtugsoFJU2ngHaM_?w=118&h=207&c=7&r=0&o=5&pid=1.7" },
new Images() { Id = 10, ImgPath = "https://th.bing.com/th/id/OIP.Py1_XfUrKJY_A6tYEmFS5wHaE8?w=280&h=187&c=7&r=0&o=5&pid=1.7" }
);
modelBuilder.Entity<Users>().HasData(
new Users() { Id = 1, Email = "jhonDhoe@gmail.com", Password = "1234", Created = new DateTime(2025, 5, 12), UserName = "Jhon-Dhoe", IdImage = 1 },
new Users() { Id = 2, Email = "lucy_rose@outlook.com", Password = "abcd", Created = new DateTime(2025, 3, 19), UserName = "Lucy-Rose", IdImage = 2 },
new Users() { Id = 3, Email = "mark.taylor@yahoo.com", Password = "5678", Created = new DateTime(2024, 11, 2), UserName = "Mark-Taylor", IdImage = 3 },
new Users() { Id = 4, Email = "sophie.martin@gmail.com", Password = "4321", Created = new DateTime(2025, 2, 28), UserName = "Sophie-Martin", IdImage = 4 },
new Users() { Id = 5, Email = "nathan_doe@aol.com", Password = "8765", Created = new DateTime(2025, 1, 15), UserName = "Nathan-Doe", IdImage = 5 },
new Users() { Id = 6, Email = "ella.brown@icloud.com", Password = "2468", Created = new DateTime(2025, 4, 7), UserName = "Ella-Brown", IdImage = 6 },
new Users() { Id = 7, Email = "oliver_smith@gmail.com", Password = "1357", Created = new DateTime(2024, 12, 25), UserName = "Oliver-Smith", IdImage = 7 },
new Users() { Id = 8, Email = "mia.jones@outlook.com", Password = "1122", Created = new DateTime(2025, 3, 5), UserName = "Mia-Jones", IdImage = 8 },
new Users() { Id = 9, Email = "kevin_williams@aol.com", Password = "2233", Created = new DateTime(2025, 2, 22), UserName = "Kevin-Williams", IdImage = 9 },
new Users() { Id = 10, Email = "olivia.white@yahoo.com", Password = "3344", Created = new DateTime(2025, 1, 3), UserName = "Olivia-White", IdImage = 10 }
);
modelBuilder.Entity<Character>().HasData(
new Character() { Id = 1 , Name = "Alan Grant", IdImage = 1},
new Character() { Id = 2, Name = "Aragorn", IdImage = 2 },
new Character() { Id = 3, Name = "Legolas", IdImage = 3 },
new Character() { Id = 4, Name = "Frodon", IdImage = 4 },
new Character() { Id = 5, Name = "Dobby", IdImage = 5 },
new Character() { Id = 6, Name = "Jon Snow", IdImage = 6 },
new Character() { Id = 7, Name = "Daenerys Targaryen", IdImage = 7 },
new Character() { Id = 8, Name = "Luke Skywalker", IdImage = 8 },
new Character() { Id = 9, Name = "Princess Leia", IdImage = 9 },
new Character() { Id = 10, Name = "Harry Potter", IdImage = 10 }
);
modelBuilder.Entity<Quote>().HasData(
new Quote() { Id = 1, Content = "Je n'y crois pas. Je n'y crois pas. Ce n'est pas possible", IdCharacter = 1, IdSource = 1, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 2, Content = "There is always hope", IdCharacter = 2, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 3, Content = "A red sun rises. Blood has been spilled this night.", IdCharacter = 3, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 4, Content = "I wish the Ring had never come to me.I wish none of this had happened.", IdCharacter = 4, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 5, Content = "Dobby is a free elf!", IdCharacter = 5, IdSource = 4, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 6, Content = "Winter is comming", IdCharacter = 6, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
new Quote() { Id = 7, Content = "Je suis la dernière Targaryen. Je suis la reine des dragons", IdCharacter = 7, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 8, Content = "Je ne suis pas prêt à affronter ça. C'est trop pour moi.", IdCharacter = 8, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 9, Content = "Aidez-moi, Obi-Wan Kenobi, vous êtes mon seul espoir.", IdCharacter = 9, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
new Quote() { Id = 10, Content = "La quoi ?", IdCharacter = 10, IdSource = 4, IdUsersPropose = 1, IsValid = false, Langage = LangEnum.vf, Likes = 11025 }
);
modelBuilder.Entity<Commentary>().HasData(
new Commentary() { Id = 1, Comment = "Ce film est le meilleur", DateCommentary = new DateTime(2025,2,3), IdQuote = 1, IdUser = 2 },
new Commentary() { Id = 2, Comment = "Very good", DateCommentary = new DateTime(2025, 3, 11), IdQuote = 1, IdUser = 3 }
);
modelBuilder.Entity<Favorite>().HasData(
new Favorite() { IdQuote = 2, IdUsers = 8 },
new Favorite() { IdQuote = 5, IdUsers = 3 },
new Favorite() { IdQuote = 9, IdUsers = 1 },
new Favorite() { IdQuote = 4, IdUsers = 10 },
new Favorite() { IdQuote = 3, IdUsers = 2 },
new Favorite() { IdQuote = 6, IdUsers = 7 },
new Favorite() { IdQuote = 1, IdUsers = 6 },
new Favorite() { IdQuote = 8, IdUsers = 9 },
new Favorite() { IdQuote = 10, IdUsers = 5 }
);
modelBuilder.Entity<Question>().HasData(
new Question() { Id = 1, Text = "Qui est le leader de la Communauté de l'Anneau ?", AnswerA = "Gimli", AnswerB = "Aragorn", AnswerC = "Frodon", AnswerD = "Gandalf", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 2, Text = "Dans quelle maison Harry Potter est-il ?", AnswerA = "Serdaigle", AnswerB = "Gryffondor", AnswerC = "Serpentard", AnswerD = "Poufsouffle", CorrectAnswer = "B" },
new Question() { Id = 3, Text = "Qui est le Seigneur des Ténèbres dans la saga Le Seigneur des Anneaux ?", AnswerA = "Saroumane", AnswerB = "Sauron", AnswerC = "Gollum", AnswerD = "Gothmog", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 4, Text = "Dans le film Star Wars : Episode IV, qui sauve Luke Skywalker de l'Étoile de la Mort ?", AnswerA = "Han Solo", AnswerB = "Princesse Leia", AnswerC = "Chewbacca", AnswerD = "R2-D2", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 5, Text = "Qui est le souverain de Narnia dans Le Lion, la Sorcière Blanche et l'Armoire Magique ?", AnswerA = "Reine Jadis", AnswerB = "Aslan", AnswerC = "Edmund", AnswerD = "Lucy", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 6, Text = "Quel est le nom du dragon dans Le Hobbit ?", AnswerA = "Smaug", AnswerB = "Falkor", AnswerC = "Norbert", AnswerD = "Shenron", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 7, Text = "Qui est la première personne à être mordue par un vampire dans Twilight ?", AnswerA = "Bella Swan", AnswerB = "Edward Cullen", AnswerC = "Jacob Black", AnswerD = "Victoria", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 8, Text = "Quel personnage dit Que la Force soit avec toi dans Star Wars ?", AnswerA = "Obi-Wan Kenobi", AnswerB = "Yoda", AnswerC = "Han Solo", AnswerD = "Luke Skywalker", CorrectAnswer = "A", IsValid = true },
new Question() { Id = 9, Text = "Dans Jurassic Park, quel est le nom du paléontologue sur l'île ?", AnswerA = "Dr. Ellie Sattler", AnswerB = "Alan Grant", AnswerC = "John Hammond", AnswerD = "Dennis Nedry", CorrectAnswer = "B", IsValid = true },
new Question() { Id = 10, Text = "Dans Game of Thrones, qui est surnommée la Mère des Dragons ?", AnswerA = "Cersei Lannister", AnswerB = "Arya Stark", AnswerC = "Daenerys Targaryen", AnswerD = "Sansa Stark", CorrectAnswer = "C", IsValid = true }
);
modelBuilder.Entity<Quiz>().HasData(
new Quiz() { Id = 1, IdImage = 1, Title = "Quiz 1", NbQuestion = 5 },
new Quiz() { Id = 2, IdImage = 2, Title = "Quiz 2", NbQuestion = 5 }
);
modelBuilder.Entity<QuizQuestion>().HasData(
new QuizQuestion() { IdQuestion = 1, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 2, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 3, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 4, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 5, IdQuiz = 1 },
new QuizQuestion() { IdQuestion = 6, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 7, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 8, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 9, IdQuiz = 2 },
new QuizQuestion() { IdQuestion = 10, IdQuiz = 2 }
);
modelBuilder.Entity<Source>().HasData(
new Source() { Id = 1, Title = "Jurassic Park", TypeSrc = TypeSrcEnum.movie, Year = 1993 },
new Source() { Id = 2, Title = "Le Seigneur des anneaux : La Communauté de l'anneau", TypeSrc = TypeSrcEnum.movie, Year = 2001 },
new Source() { Id = 3, Title = "Game of throne", TypeSrc = TypeSrcEnum.series, Year = 2011 },
new Source() { Id = 4, Title = "Harry Potter à l'école des sorcier", TypeSrc = TypeSrcEnum.movie, Year = 1997 },
new Source() { Id = 5, Title = "Star Wars, épisode IV : Un nouvel espoir", TypeSrc = TypeSrcEnum.movie, Year = 1977 }
);
}
public StubWTFContext()
{ }
public StubWTFContext(DbContextOptions<WTFContext> options)
: base(options)
{ }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
{
options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Wf-Database.mdf;Trusted_Connection=True;");
}
}
}
}

@ -11,9 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />
@ -24,4 +21,8 @@
<ProjectReference Include="..\Entity\Entity.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.3.0" />
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.3.0" />

@ -53,7 +53,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetAllQuote([FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetAllQuote(int index = 0, int count = 10)
{
try
{
@ -77,7 +77,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetAllQuoteByLang([FromQuery] TypeLangageDTO lang, [FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetAllQuoteByLang(TypeLangageDTO lang,int index = 0, int count = 10)
{
try
{
@ -102,7 +102,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetDailyQuote([FromQuery] int year, [FromQuery] int month, [FromQuery] int day, [FromQuery] TypeLangageDTO lang)
public async Task<IActionResult> GetDailyQuote([FromQuery] int year, [FromQuery] int month, [FromQuery] int day, TypeLangageDTO lang)
{
try
{
@ -128,7 +128,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetInvalidQuote([FromQuery] TypeLangageDTO lang, [FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetInvalidQuote(TypeLangageDTO lang, int index = 0, int count = 10)
{
try
{
@ -152,7 +152,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetSuggestQuote([FromQuery] TypeLangageDTO lang, [FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetSuggestQuote(TypeLangageDTO lang, int index = 0, int count = 10)
{
try
{
@ -176,7 +176,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetQuoteSearchByCharacter([FromQuery] TypeLangageDTO lang, [FromQuery] string character, [FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetQuoteSearchByCharacter(TypeLangageDTO lang, string character, int index = 0, int count = 10)
{
try
{
@ -200,7 +200,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetQuoteSearchBySource([FromQuery] TypeLangageDTO lang, [FromQuery] string source, [FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetQuoteSearchBySource(TypeLangageDTO lang, string source, int index = 0, int count = 10)
{
try
{
@ -224,7 +224,7 @@ namespace WfApi.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetQuoteSearchByContent([FromQuery] TypeLangageDTO lang, [FromQuery] string content, [FromQuery] int index = 0, [FromQuery] int count = 10)
public async Task<IActionResult> GetQuoteSearchByContent(TypeLangageDTO lang, string content, int index = 0, int count = 10)
{
try
{

@ -64,9 +64,9 @@ namespace WfApi.Controllers
return NoContent();
}
}
catch (Exception e)
catch (Exception)
{
return StatusCode((int)HttpStatusCode.InternalServerError, new { message = "Internal Server Error" +e.Message + " --- " + Environment.GetEnvironmentVariable("DB_SERVER_AUTH") });
return StatusCode((int)HttpStatusCode.InternalServerError, new { message = "Internal Server Error" });
}
}
@ -523,29 +523,7 @@ namespace WfApi.Controllers
}
}
[HttpPut("lang")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> UpdateUserLang([FromQuery] int id, [FromBody] TypeLangageDTO lang)
{
try
{
var updateduser=await _user.GetUserById(id);
if (updateduser == null)
{
return BadRequest(new { message = "Player no found." });
}
updateduser.Lang = lang;
var result = _user.UpdateUser(id, updateduser);
return Ok(result);
}
catch (Exception)
{
return StatusCode((int)HttpStatusCode.InternalServerError, new { message = "Internal server error." });
}
}
//===================================== ROUTE POST =====================================

@ -1,25 +1,25 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WfApi/WfApi.csproj", "WfApi/"]
RUN dotnet restore "./WfApi/WfApi.csproj"
COPY . .
WORKDIR "/src/WfApi"
RUN dotnet build "./WfApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./WfApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WfApi/WfApi.csproj", "WfApi/"]
RUN dotnet restore "./WfApi/WfApi.csproj"
COPY . .
WORKDIR "/src/WfApi"
RUN dotnet build "./WfApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./WfApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WfApi.dll"]

@ -15,7 +15,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="NSwag.AspNetCore" Version="14.2.0" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />

@ -16,7 +16,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NSwag.Core" Version="14.3.0" />

Loading…
Cancel
Save