From 688071508778ce01c00c5683f0ea650ef970dc7e Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Sat, 7 Sep 2024 11:36:46 +0300 Subject: [PATCH] Db models --- Database/Models/Cars.cs | 19 +++++++++++++++++++ Database/Models/Polis.cs | 11 +++++++++++ Database/Models/User.cs | 16 ++++++++++++++++ Database/Models/UserPolis.cs | 16 ++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 Database/Models/Cars.cs create mode 100644 Database/Models/Polis.cs create mode 100644 Database/Models/User.cs create mode 100644 Database/Models/UserPolis.cs diff --git a/Database/Models/Cars.cs b/Database/Models/Cars.cs new file mode 100644 index 0000000..fb12387 --- /dev/null +++ b/Database/Models/Cars.cs @@ -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; } +} \ No newline at end of file diff --git a/Database/Models/Polis.cs b/Database/Models/Polis.cs new file mode 100644 index 0000000..442227c --- /dev/null +++ b/Database/Models/Polis.cs @@ -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!; +} \ No newline at end of file diff --git a/Database/Models/User.cs b/Database/Models/User.cs new file mode 100644 index 0000000..328271c --- /dev/null +++ b/Database/Models/User.cs @@ -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!; +} \ No newline at end of file diff --git a/Database/Models/UserPolis.cs b/Database/Models/UserPolis.cs new file mode 100644 index 0000000..0fda2e7 --- /dev/null +++ b/Database/Models/UserPolis.cs @@ -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; } +} \ No newline at end of file