refactor : modification de "uint" en "int"

API
Damien NORTIER 1 year ago
parent 0e3032a9eb
commit 1a112874e3

@ -16,7 +16,7 @@ namespace DTOs
/// </summary> /// </summary>
public class AdministratorDto public class AdministratorDto
{ {
public uint Id { get; set; } public int Id { get; set; }
public string Username { get; set; } = null!; public string Username { get; set; } = null!;
public string HashedPassword { get; set; } = null!; public string HashedPassword { get; set; } = null!;
} }

@ -13,8 +13,8 @@ namespace DTOs
/// </summary> /// </summary>
public class AnswerDto public class AnswerDto
{ {
public uint Id { get; set; } public int Id { get; set; }
public string Content { get; set; } = null!; public string Content { get; set; } = null!;
public uint? IdQuestion { get; set; } public int? IdQuestion { get; set; }
} }
} }

@ -15,7 +15,7 @@ namespace DTOs
/// </summary> /// </summary>
public class ChapterDto public class ChapterDto
{ {
public uint Id { get; set; } public int Id { get; set; }
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
} }
} }

@ -18,10 +18,10 @@ namespace DTOs
/// </summary> /// </summary>
public class LobbyDto public class LobbyDto
{ {
public uint Id { get; set; } public int Id { get; set; }
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
public string Password { get; set; } = null!; public string Password { get; set; } = null!;
public uint NbPlayers { get; set; } public int NbPlayers { get; set; }
public uint? IdCreator { get; set; } public int? IdCreator { get; set; }
} }
} }

@ -16,7 +16,7 @@ namespace DTOs
/// </summary> /// </summary>
public class PlayerDto public class PlayerDto
{ {
public uint Id { get; set; } public int Id { get; set; }
public string Nickname { get; set; } = null!; public string Nickname { get; set; } = null!;
public string HashedPassword { get; set; } = null!; public string HashedPassword { get; set; } = null!;
} }

@ -20,11 +20,11 @@ namespace DTOs
/// </summary> /// </summary>
public class QuestionDto public class QuestionDto
{ {
public uint Id { get; set; } public int Id { get; set; }
public string Content { get; set; } = null!; public string Content { get; set; } = null!;
public byte Difficulty { get; set; } public byte Difficulty { get; set; }
public uint NbFalls { get; set; } public int NbFalls { get; set; }
public uint IdChapter { get; set; } public int IdChapter { get; set; }
public uint? IdAnswerGood { get; set; } public int? IdAnswerGood { get; set; }
} }
} }

@ -15,7 +15,7 @@ namespace Entities
{ {
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Username { get; set; } = null!; public string Username { get; set; } = null!;
[Required] [Required]

@ -16,12 +16,12 @@ namespace Entities
{ {
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Content { get; set; } = null!; public string Content { get; set; } = null!;
[ForeignKey(nameof(Question))] [ForeignKey(nameof(Question))]
public uint? IdQuestion { get; set; } public int? IdQuestion { get; set; }
public QuestionEntity? Question { get; set; } public QuestionEntity? Question { get; set; }
} }

@ -14,7 +14,7 @@ namespace Entities
{ {
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
} }

@ -18,14 +18,14 @@ namespace Entities
{ {
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
public string Password { get; set; } = null!; public string Password { get; set; } = null!;
public uint NbPlayers { get; set; } public int NbPlayers { get; set; }
[ForeignKey(nameof(Creator))] [ForeignKey(nameof(Creator))]
public uint? IdCreator { get; set; } public int? IdCreator { get; set; }
public PlayerEntity? Creator { get; set; } public PlayerEntity? Creator { get; set; }
} }

@ -14,14 +14,14 @@ namespace Entities
public class LobbyEntityPlayerEntity public class LobbyEntityPlayerEntity
{ {
[ForeignKey(nameof(Lobby))] [ForeignKey(nameof(Lobby))]
public uint IdLobby { get; set; } public int IdLobby { get; set; }
[ForeignKey(nameof(Player))] [ForeignKey(nameof(Player))]
public uint IdPlayer { get; set; } public int IdPlayer { get; set; }
public LobbyEntity Lobby { get; set; } = null!; public LobbyEntity Lobby { get; set; } = null!;
public PlayerEntity Player { get; set; } = null!; public PlayerEntity Player { get; set; } = null!;
public uint MaxScore { get; set; } public int MaxScore { get; set; }
} }
} }

@ -15,7 +15,7 @@ namespace Entities
{ {
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Nickname { get; set; } = null!; public string Nickname { get; set; } = null!;
[Required] [Required]

@ -21,16 +21,16 @@ namespace Entities
{ {
[ForeignKey(nameof(Chapter))] [ForeignKey(nameof(Chapter))]
[DatabaseGenerated(DatabaseGeneratedOption.None)] [DatabaseGenerated(DatabaseGeneratedOption.None)]
public uint IdChapter { get; set; } public int IdChapter { get; set; }
[ForeignKey(nameof(Player))] [ForeignKey(nameof(Player))]
[DatabaseGenerated(DatabaseGeneratedOption.None)] [DatabaseGenerated(DatabaseGeneratedOption.None)]
public uint IdPlayer { get; set; } public int IdPlayer { get; set; }
public ChapterEntity Chapter { get; set; } = null!; public ChapterEntity Chapter { get; set; } = null!;
public PlayerEntity Player { get; set; } = null!; public PlayerEntity Player { get; set; } = null!;
public uint MaxScore { get; set; } public int MaxScore { get; set; }
} }
} }

@ -25,18 +25,18 @@ namespace Entities
{ {
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Content { get; set; } = null!; public string Content { get; set; } = null!;
[AllowedValues(1, 2, 3)] [AllowedValues(1, 2, 3)]
public byte Difficulty { get; set; } public byte Difficulty { get; set; }
public uint NbFalls { get; set; } public int NbFalls { get; set; }
[ForeignKey(nameof(Chapter))] [ForeignKey(nameof(Chapter))]
public uint IdChapter { get; set; } public int IdChapter { get; set; }
[ForeignKey(nameof(AnswerGood))] [ForeignKey(nameof(AnswerGood))]
public uint? IdAnswerGood { get; set; } public int? IdAnswerGood { get; set; }
public ChapterEntity? Chapter { get; set; } public ChapterEntity? Chapter { get; set; }

@ -16,11 +16,11 @@ namespace Model
/// </summary> /// </summary>
public class Administrator public class Administrator
{ {
private uint id; private int id;
private string? username; private string? username;
private string? hashedPassword; private string? hashedPassword;
// getters and setters for attributes // getters and setters for attributes
public uint Id public int Id
{ {
get => id; get => id;
private set { id = value; } private set { id = value; }
@ -42,7 +42,7 @@ namespace Model
/// <param name="username">the username of the administrator</param> /// <param name="username">the username of the administrator</param>
/// <param name="hashedPassword">the hash of the password of the administrator</param> /// <param name="hashedPassword">the hash of the password of the administrator</param>
/// <param name="id">the id in the database</param> /// <param name="id">the id in the database</param>
public Administrator(string username, string hashedPassword, uint id = 0) public Administrator(string username, string hashedPassword, int id = 0)
{ {
this.Username = username; this.Username = username;
this.HashedPassword = hashedPassword; this.HashedPassword = hashedPassword;

@ -12,12 +12,12 @@ namespace Model
/// </summary> /// </summary>
public class Answer public class Answer
{ {
private uint id; private int id;
private string? content; private string? content;
private uint? idQuestion; private int? idQuestion;
// getters and setters for attributes // getters and setters for attributes
public uint Id public int Id
{ {
get => id; get => id;
private set { id = value; } private set { id = value; }
@ -27,7 +27,7 @@ namespace Model
get => content == null ? "" : content; get => content == null ? "" : content;
set { content = value == "" ? null : value; } set { content = value == "" ? null : value; }
} }
public uint? IdQuestion public int? IdQuestion
{ {
get => idQuestion; // null = no idQuestion get => idQuestion; // null = no idQuestion
set { idQuestion = value; } set { idQuestion = value; }
@ -39,7 +39,7 @@ namespace Model
/// <param name="content">the content of the answer</param> /// <param name="content">the content of the answer</param>
/// <param name="idQuestion">the id of the question which it answer to</param> /// <param name="idQuestion">the id of the question which it answer to</param>
/// <param name="id">the id in the database</param> /// <param name="id">the id in the database</param>
public Answer(string content, uint? idQuestion = null, uint id = 0) public Answer(string content, int? idQuestion = null, int id = 0)
{ {
Content = content; Content = content;
IdQuestion = idQuestion; IdQuestion = idQuestion;

@ -15,10 +15,10 @@ namespace Model
/// </summary> /// </summary>
public class Chapter public class Chapter
{ {
uint id; int id;
string? name; string? name;
// getters and setters for attributs // getters and setters for attributs
public uint Id public int Id
{ {
get => id; get => id;
private set { id = value; } private set { id = value; }
@ -34,7 +34,7 @@ namespace Model
/// </summary> /// </summary>
/// <param name="name">name of the chapter</param> /// <param name="name">name of the chapter</param>
/// <param name="id">id in the database</param> /// <param name="id">id in the database</param>
public Chapter(string name, uint id = 0) public Chapter(string name, int id = 0)
{ {
Name = name; Name = name;
Id = id; Id = id;

@ -18,13 +18,13 @@ namespace Model
/// </summary> /// </summary>
public class Lobby public class Lobby
{ {
private uint id; private int id;
private string? name; private string? name;
private string? password; private string? password;
private uint nbPlayers; private int nbPlayers;
private uint? idCreator; private int? idCreator;
// getters and setters of attributes // getters and setters of attributes
public uint Id public int Id
{ {
get => id; get => id;
private set { id = value; } private set { id = value; }
@ -39,12 +39,12 @@ namespace Model
get => password == null ? "" : password; get => password == null ? "" : password;
private set { password = value == "" ? null : value; } private set { password = value == "" ? null : value; }
} }
public uint NbPlayers public int NbPlayers
{ {
get => nbPlayers; get => nbPlayers;
set { nbPlayers = value; } set { nbPlayers = value; }
} }
public uint? IdCreator public int? IdCreator
{ {
get => idCreator; get => idCreator;
private set { idCreator = value; } private set { idCreator = value; }
@ -58,7 +58,7 @@ namespace Model
/// <param name="password">the password require to access to the lobby</param> /// <param name="password">the password require to access to the lobby</param>
/// <param name="nbPlayers">the number of players in the lobby</param> /// <param name="nbPlayers">the number of players in the lobby</param>
/// <param name="id">the id of the lobby</param> /// <param name="id">the id of the lobby</param>
public Lobby(string name, uint? idCreator, string password = "", uint nbPlayers = 0, uint id = 0) public Lobby(string name, int? idCreator, string password = "", int nbPlayers = 0, int id = 0)
{ {
Name = name; Name = name;
IdCreator = idCreator; IdCreator = idCreator;

@ -16,12 +16,12 @@ namespace Model
/// </summary> /// </summary>
public class Player public class Player
{ {
private uint id; private int id;
private string? nickname; private string? nickname;
private string? hashedPassword; private string? hashedPassword;
// getters and setters for attributes // getters and setters for attributes
public uint Id public int Id
{ {
get => id; get => id;
private set { id = value; } private set { id = value; }
@ -43,7 +43,7 @@ namespace Model
/// <param name="nickname">nickname of the player</param> /// <param name="nickname">nickname of the player</param>
/// <param name="hashedPassword">hash of the password of the player</param> /// <param name="hashedPassword">hash of the password of the player</param>
/// <param name="id">id of the player</param> /// <param name="id">id of the player</param>
public Player(string nickname, string hashedPassword = "", uint id = 0) public Player(string nickname, string hashedPassword = "", int id = 0)
{ {
Nickname = nickname; Nickname = nickname;
HashedPassword = hashedPassword; HashedPassword = hashedPassword;

@ -20,14 +20,14 @@ namespace Model
/// </summary> /// </summary>
public class Question public class Question
{ {
private uint id; private int id;
private string? content; private string? content;
private byte difficulty; private byte difficulty;
private uint nbFalls; private int nbFalls;
private uint idChapter; private int idChapter;
private uint? idAnswerGood; private int? idAnswerGood;
public uint Id public int Id
{ {
get => id; get => id;
private set { id = value; } private set { id = value; }
@ -42,23 +42,23 @@ namespace Model
get => difficulty; get => difficulty;
set { difficulty = value; } set { difficulty = value; }
} }
public uint NbFalls public int NbFalls
{ {
get => nbFalls; get => nbFalls;
set { nbFalls = value; } set { nbFalls = value; }
} }
public uint IdChapter public int IdChapter
{ {
get => idChapter; get => idChapter;
private set { idChapter = value; } private set { idChapter = value; }
} }
public uint? IdAnswerGood public int? IdAnswerGood
{ {
get => idAnswerGood; get => idAnswerGood;
set { idAnswerGood = value; } set { idAnswerGood = value; }
} }
public Question(string content, uint idChapter, uint id = 0, uint? idAnswerGood = null) public Question(string content, int idChapter, int id = 0, int? idAnswerGood = null)
{ {
Id = id; Id = id;
Content = content; Content = content;

Loading…
Cancel
Save