начал

This commit is contained in:
328p
2026-09-17 15:54:12 +03:00
parent 2f6bdf2c72
commit e6a2231e89
15 changed files with 485 additions and 1 deletions
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApi.Data.Models;
[Table("ability")]
[Index(nameof(Name), IsUnique = true)]
public class Ability
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("ability_id")]
public int AbilityId { get; set; }
[Column("ability_name")]
[Required]
[MaxLength(100)]
public string Name { get; set; }
[Column("ability_description")]
[Required]
public string Description { get; set; }
}
@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApi.Data.Models;
[Table("pokemon")]
[Index(nameof(Name), IsUnique = true)]
public class Pokemon
{
[Key]
[Column("pokemon_id")]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; }
[Column("pokemon_name")]
[Required]
[MaxLength(30)]
public string Name { get; set; }
[Column("pokemon_height_m")]
[Required]
public double Height { get; set; }
[Column("pokemon_weight_kg")]
[Required]
public double Weight { get; set; }
}
@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApi.Data.Models;
[Table("pokemonAbility")]
[Index(nameof(Name), IsUnique = true)]
public class PokemonAbility
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("pokemon_ability_id")]
public int AbilityId { get; set; }
[Column("pokemon_ability_name")]
[Required]
public string Name { get; set; }
[Column("IsHidden")]
[Required]
public bool IsHidden { get; set; }
}
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace PokedexApi.Data.Models;
[Table("type")]
[Index(nameof(Name), IsUnique = true)]
public class Type
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("type_id")]
public int TypeId { get; set; }
[Column("type_name")]
public string Name { get; set; }
}