Add project
This commit is contained in:
12
Api/Database/Entities/BaseEntity.cs
Normal file
12
Api/Database/Entities/BaseEntity.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Api.Database.Entities;
|
||||
|
||||
public abstract class BaseEntity
|
||||
{
|
||||
[Key]
|
||||
[Column("Id")]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
18
Api/Database/Entities/BaseEntityGuid.cs
Normal file
18
Api/Database/Entities/BaseEntityGuid.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Api.Database.Entities;
|
||||
|
||||
public abstract class BaseEntityGuid
|
||||
{
|
||||
[Key]
|
||||
[Column("Id")]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public Guid Id { get; set; } = Guid.CreateVersion7();
|
||||
|
||||
[Column("CreatedAt")]
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
|
||||
[Column("LastModifiedAt")]
|
||||
public DateTime LastModifiedAt { get; set; } = DateTime.Now;
|
||||
}
|
||||
22
Api/Database/Entities/Season.cs
Normal file
22
Api/Database/Entities/Season.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Api.Database.Entities;
|
||||
|
||||
[Table("Seasons")]
|
||||
public class Season : BaseEntity
|
||||
{
|
||||
[Column("Name")]
|
||||
[NotNull]
|
||||
[MaxLength(20)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[Column("StartDate")]
|
||||
[NotNull]
|
||||
public DateOnly StartDate { get; set; }
|
||||
|
||||
[Column("EndDate")]
|
||||
[NotNull]
|
||||
public DateOnly EndDate { get; set; }
|
||||
}
|
||||
19
Api/Database/Entities/Specialization.cs
Normal file
19
Api/Database/Entities/Specialization.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Api.Database.Entities;
|
||||
|
||||
[Table("Specializations")]
|
||||
public class Specialization : BaseEntity
|
||||
{
|
||||
[Column("Name")]
|
||||
[NotNull]
|
||||
[MaxLength(200)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[Column("ShortName")]
|
||||
[NotNull]
|
||||
[MaxLength(10)]
|
||||
public string? ShortName { get; set; }
|
||||
}
|
||||
24
Api/Database/Entities/Student.cs
Normal file
24
Api/Database/Entities/Student.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Api.Database.Entities;
|
||||
|
||||
[Table("Students")]
|
||||
public class Student : BaseEntityGuid
|
||||
{
|
||||
[Column("FirstName")]
|
||||
[NotNull]
|
||||
[MaxLength(50)]
|
||||
public string? FirstName { get; set; }
|
||||
|
||||
[Column("LastName")]
|
||||
[NotNull]
|
||||
[MaxLength(50)]
|
||||
public string? LastName { get; set; }
|
||||
|
||||
[Column("AlbumNumber")]
|
||||
[NotNull]
|
||||
[MaxLength(6)]
|
||||
public string? AlbumNumber { get; set; }
|
||||
}
|
||||
19
Api/Database/Entities/Subject.cs
Normal file
19
Api/Database/Entities/Subject.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Api.Database.Entities;
|
||||
|
||||
[Table("Subjects")]
|
||||
public class Subject : BaseEntity
|
||||
{
|
||||
[Column("Name")]
|
||||
[NotNull]
|
||||
[MaxLength(200)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[Column("ShortName")]
|
||||
[NotNull]
|
||||
[MaxLength(10)]
|
||||
public string? ShortName { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user