Db models

This commit is contained in:
Nikolai Papin 2024-09-07 11:36:46 +03:00
parent 1408bee259
commit 6880715087
4 changed files with 62 additions and 0 deletions

19
Database/Models/Cars.cs Normal file
View File

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
namespace Renis.Database.Models;
public class Cars
{
[Key]
public long Id { get; set; }
[Required]
public string Number { get; set; } = null!;
[Required]
Polis Polis { get; set; } = null!;
[Required]
long PolisId { get; set; }
[Required]
User Resp { get; set; } = null!;
[Required]
long RespId { get; set; }
}

11
Database/Models/Polis.cs Normal file
View File

@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
namespace Renis.Database.Models;
public class Polis
{
[Key]
public long Id { get; set; }
[Required]
public string Number { get; set; } = null!;
}

16
Database/Models/User.cs Normal file
View File

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace Renis.Database.Models;
public class User
{
[Key]
public long Id { get; set; }
[Required]
public string Name { get; set; } = null!;
[Phone]
[Required]
public string Phone { get; set; } = null!;
[Required]
public string Password { get; set; } = null!;
}

View File

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace Renis.Database.Models;
public class UserPolis
{
[Key]
public long Id { get; set; }
[Required]
public long UserId { get; set; }
public User User { get; set; } = null!;
[Required]
public long PolisId { get; set; }
public Polis Polis { get; set; } = null!;
public bool IsOwner { get; set; }
}