Skip to content

Commit

Permalink
New Migration Add Talent. New Controller Talent. New IRepository.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyveth committed Oct 19, 2022
1 parent c61e1df commit de94b5a
Show file tree
Hide file tree
Showing 27 changed files with 4,240 additions and 172 deletions.
3 changes: 3 additions & 0 deletions WebApiScrapingData.Domain/Class/Pokemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class Pokemon : Identity
public List<Pokemon_TypePok> Pokemon_TypePoks { get; set; }
[DataMember(Name = "Weaknesses")]
public List<Pokemon_Weakness> Pokemon_Weaknesses { get; set; }
[DataMember(Name = "Talents")]
public List<Pokemon_Talent> Pokemon_Talents { get; set; }

//Type Evolution : Normal, Méga, Gigamax, Alola, Galar, Hisui
[DataMember(Name = DataMember.TypeEvolution)]
Expand Down Expand Up @@ -129,6 +131,7 @@ public Pokemon()

Pokemon_TypePoks = new();
Pokemon_Weaknesses = new();
Pokemon_Talents = new();
}
}
}
25 changes: 25 additions & 0 deletions WebApiScrapingData.Domain/Class/Pokemon_Talent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using WebApiScrapingData.Domain.Abstract;

namespace WebApiScrapingData.Domain.Class
{
[DataContract]
public class Pokemon_Talent : Identity
{
public long PokemonId { get; set; }
[ForeignKey("PokemonId")]
public virtual Pokemon? Pokemon { get; set; }

public long TalentId { get; set; }
[ForeignKey("TalentId")]
[DataMember]
public virtual Talent? Talent { get; set; }
}
}
4 changes: 2 additions & 2 deletions WebApiScrapingData.Domain/Class/Pokemon_TypePok.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public class Pokemon_TypePok : Identity
{
public long PokemonId { get; set; }
[ForeignKey("PokemonId")]
public virtual Pokemon Pokemon { get; set; }
public virtual Pokemon? Pokemon { get; set; }

public long TypePokId { get; set; }
[ForeignKey("TypePokId")]
[DataMember]
public virtual TypePok TypePok { get; set; }
public virtual TypePok? TypePok { get; set; }
}
}
2 changes: 1 addition & 1 deletion WebApiScrapingData.Domain/Class/Quizz/QuestionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public class QuestionType : Identity
public bool IsSameType { get; set; }

//Difficulté
public QuizzDifficulty? DifficultyID { get; set; }
public Difficulty? DifficultyID { get; set; }
}
}
2 changes: 1 addition & 1 deletion WebApiScrapingData.Domain/Class/Quizz/Quizz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public class Quizz : Identity
public bool Done { get; set; }

//Identifiant du Profil
public IdentityUser identityUser { get; set; }
public IdentityUser? IdentityUser { get; set; }
}
}
71 changes: 71 additions & 0 deletions WebApiScrapingData.Domain/Class/Talent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using WebApiScrapingData.Domain.Abstract;
using WebApiScrapingData.Domain.Constantes;

namespace WebApiScrapingData.Domain.Class
{
[DataContract]
public class Talent : Identity
{
[DataMember(Name = DataMember.Name_FR)]
public string? Name_FR { get; set; }

[DataMember(Name = DataMember.Description_FR)]
public string? Description_FR { get; set; }

[DataMember(Name = DataMember.Name_EN)]
public string? Name_EN { get; set; }

[DataMember(Name = DataMember.Description_EN)]
public string? Description_EN { get; set; }

[DataMember(Name = DataMember.Name_ES)]
public string? Name_ES { get; set; }

[DataMember(Name = DataMember.Description_ES)]
public string? Description_ES { get; set; }

[DataMember(Name = DataMember.Name_IT)]
public string? Name_IT { get; set; }

[DataMember(Name = DataMember.Description_IT)]
public string? Description_IT { get; set; }

[DataMember(Name = DataMember.Name_DE)]
public string? Name_DE { get; set; }

[DataMember(Name = DataMember.Description_DE)]
public string? Description_DE { get; set; }

[DataMember(Name = DataMember.Name_RU)]
public string? Name_RU { get; set; }

[DataMember(Name = DataMember.Description_RU)]
public string? Description_RU { get; set; }

[DataMember(Name = DataMember.Name_CO)]
public string? Name_CO { get; set; }

[DataMember(Name = DataMember.Description_CO)]
public string? Description_CO { get; set; }

[DataMember(Name = DataMember.Name_CN)]
public string? Name_CN { get; set; }

[DataMember(Name = DataMember.Description_CN)]
public string? Description_CN { get; set; }

[DataMember(Name = DataMember.Name_JP)]
public string? Name_JP { get; set; }

[DataMember(Name = DataMember.Description_JP)]
public string? Description_JP { get; set; }

public List<Pokemon_Talent>? Pokemon_TypePoks { get; set; }
}
}
20 changes: 20 additions & 0 deletions WebApiScrapingData.Domain/Constantes/DataMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,25 @@ public static class DataMember

public const string DataSprite = "DataSprite";
#endregion

#region Talent
public const string Description_FR = "Description_FR";

public const string Description_EN = "Description_EN";

public const string Description_ES = "Description_ES";

public const string Description_IT = "Description_IT";

public const string Description_DE = "Description_DE";

public const string Description_RU = "Description_RU";

public const string Description_CO = "Description_CO";

public const string Description_CN = "Description_CN";

public const string Description_JP = "Description_JP";
#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WebApiScrapingData.Domain.Class.Quizz;
using WebApiScrapingData.Framework;

namespace WebApiScrapingData.Core.Repositories.RepositoriesQuizz
{
public interface IRepositoryExtendsPokemon<TEntity> : IRepository<TEntity> where TEntity : class
{
Task<IEnumerable<TEntity>> GetAllLight();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebApiScrapingData.Domain.Abstract;
using WebApiScrapingData.Domain.Class.Quizz;
using WebApiScrapingData.Domain.Class;

namespace WebApiScrapingData.Core.Repositories.RepositoriesQuizz
{
public interface IRepositoryExtendsAnswer<TEntity> : IRepository<TEntity> where TEntity : class
{
Task<string> GenerateCorrectAnswers(QuestionType questionType, List<Pokemon> pokemonsAnswer);
Task<string> GenerateCorrectAnswers(QuestionType questionType, List<TypePok> typesAnswer);
Task<string> GenerateCorrectAnswers(QuestionType questionType, List<Talent> talentsAnswer, bool Reverse);
Task<string> GenerateCorrectAnswers(QuestionType questionType, List<Talent> talentsAnswer);
Task<string> GenerateCorrectAnswersDesc(QuestionType questionType, List<Pokemon> pokemonsAnswer);
Task<string> GenerateCorrectAnswersStat(QuestionType questionType, List<Pokemon> pokemonsAnswer, string typeStat);
Task<List<Answer>> GenerateAnswers(Quizz quizz, QuestionType questionType, List<Answer> answers);
Task<string> ConvertDescription(Pokemon pokemon);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebApiScrapingData.Domain.Abstract;

namespace WebApiScrapingData.Core.Repositories.RepositoriesQuizz
{
public interface IRepositoryExtendsQuestion<TEntity> : IRepository<TEntity> where TEntity : class
{
Task<string> GenerateQuestions(bool gen1, bool gen2, bool gen3, bool gen4, bool gen5, bool gen6, bool gen7, bool gen8, bool genArceus, bool easy, bool normal, bool hard);
Task<int> GetNbQuestionByDifficulty(bool easy, bool normal, bool hard);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WebApiScrapingData.Domain.Class.Quizz;
using WebApiScrapingData.Framework;

namespace WebApiScrapingData.Core.Repositories.RepositoriesQuizz
{
public interface IRepositoryExtendsQuizz<TEntity> : IRepository<TEntity> where TEntity : class
{
Task<TEntity> GenerateQuizz(IdentityUser profile, bool gen1, bool gen2, bool gen3, bool gen4, bool gen5, bool gen6, bool gen7, bool gen8, bool genArceus, bool easy, bool normal, bool hard);
}
}
2 changes: 2 additions & 0 deletions WebApiScrapingData.Infrastructure/Data/ScrapingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ protected override void OnModelCreating(ModelBuilder builder)
public virtual DbSet<Pokemon> Pokemons { get; set; }
public virtual DbSet<DataInfo> DataInfos { get; set; }
public virtual DbSet<TypePok> TypesPok { get; set; }
public virtual DbSet<Talent> Talents { get; set; }
public virtual DbSet<Pokemon_TypePok> Pokemon_TypePok { get; set; }
public virtual DbSet<Pokemon_Weakness> Pokemon_Weakness { get; set; }
public virtual DbSet<Pokemon_Talent> Pokemon_Talent { get; set; }

public virtual DbSet<Quizz> Quizzs { get; set; }
public virtual DbSet<Question> Questions { get; set; }
Expand Down
Loading

0 comments on commit de94b5a

Please sign in to comment.