diff --git a/Config/SQLQuery_insert test values.sql b/Config/SQLQuery_insert test values.sql
index 6b1d8631a4..c879625f33 100644
--- a/Config/SQLQuery_insert test values.sql
+++ b/Config/SQLQuery_insert test values.sql
@@ -41,8 +41,8 @@ INSERT INTO [dbo].[AspNetUsers]
,[IsRegistered])
VALUES
('16575ce5-38e3-4ae7-b991-4508ed488369' --Id
- ,'2021-06-04 10:06:32.9282504'
- ,'0001-01-01 00:00:00.0000000'
+ ,'2021-06-04 10:06:32.9282504 +00:00' --[CreatingTime]
+ ,'0001-01-01 00:00:00.0000000 +00:00' --LastLogin
,'Батькоперший' --last name
,'Іванович' --middle name
,'Іван' --first name
@@ -64,8 +64,8 @@ INSERT INTO [dbo].[AspNetUsers]
,0) --is registered
,('7604a851-66db-4236-9271-1f037ffe3a81' --Id
- ,'2021-06-04 10:24:40.8990089'
- ,'0001-01-01 00:00:00.0000000'
+ ,'2021-06-04 10:24:40.8990089 +00:00' --[CreatingTime]
+ ,'0001-01-01 00:00:00.0000000 +00:00' --LastLogin
,'Батькодругий' --last name
,'Петрович' --middle name
,'Петро' --first name
@@ -87,8 +87,8 @@ INSERT INTO [dbo].[AspNetUsers]
,0) --is registered
,('47802b21-2fb5-435e-9057-75c43d002cef' --Id
- ,'2021-06-04 10:29:56.7988521'
- ,'0001-01-01 00:00:00.0000000'
+ ,'2021-06-04 10:29:56.7988521 +00:00' --[CreatingTime]
+ ,'0001-01-01 00:00:00.0000000 +00:00' --LastLogin
,'Провайдерперший' --last name
,'Семенович' --middle name
,'Семен' --first name
@@ -110,8 +110,8 @@ INSERT INTO [dbo].[AspNetUsers]
,0) --is registered
,('5bff5f95-1848-4c87-9846-a567aeb407ea' --Id
- ,'2021-06-04 10:33:26.6295481'
- ,'0001-01-01 00:00:00.0000000'
+ ,'2021-06-04 10:33:26.6295481 +00:00' --[CreatingTime]
+ ,'0001-01-01 00:00:00.0000000 +00:00' --LastLogin
,'Провайдердругий' --last name
,'Борисович' --middle name
,'Борис' --first name
@@ -133,22 +133,22 @@ INSERT INTO [dbo].[AspNetUsers]
,0) --is registered
GO
---Change roles' Ids according to your data in [AspNetRoles].
+--Roles' Ids according to your data in [AspNetRoles].
INSERT INTO [dbo].[AspNetUserRoles]
([UserId]
,[RoleId])
VALUES
('16575ce5-38e3-4ae7-b991-4508ed488369' --UserId (test1)
- ,'3022b015-a2e4-496d-92d1-ead5b41f7dba') --roleId (parent)
+ ,(SELECT TOP (1) [Id] FROM [AspNetRoles] WHERE [Name] LIKE('parent'))) --roleId (parent)
,('7604a851-66db-4236-9271-1f037ffe3a81' --UserId (test2)
- ,'3022b015-a2e4-496d-92d1-ead5b41f7dba') --roleId (parent)
+ ,(SELECT TOP (1) [Id] FROM [AspNetRoles] WHERE [Name] LIKE('parent'))) --roleId (parent)
,('47802b21-2fb5-435e-9057-75c43d002cef' --UserId (test3)
- ,'a9179c0c-e1c6-4d50-b1c8-1f3266cf4bba') --roleId (provider)
+ ,(SELECT TOP (1) [Id] FROM [AspNetRoles] WHERE [Name] LIKE('provider'))) --roleId (provider)
,('5bff5f95-1848-4c87-9846-a567aeb407ea' --UserId (test4)
- ,'a9179c0c-e1c6-4d50-b1c8-1f3266cf4bba') --roleId (provider)
+ ,(SELECT TOP (1) [Id] FROM [AspNetRoles] WHERE [Name] LIKE('provider'))) --roleId (provider)
GO
--====================PARENTS AND CHILDREN================================
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Application.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Application.cs
index 587b3a347b..796a131a45 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/Application.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Application.cs
@@ -12,7 +12,7 @@ public class Application
public ApplicationStatus Status { get; set; } = ApplicationStatus.Pending;
[Required]
- public DateTime CreationTime { get; set; }
+ public DateTimeOffset CreationTime { get; set; }
[Required]
[Range(1, long.MaxValue, ErrorMessage = "Workshop id should be grater than 0")]
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/BirthCertificate.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/BirthCertificate.cs
index 400aa65a5d..d825e0d5df 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/BirthCertificate.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/BirthCertificate.cs
@@ -1,8 +1,6 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Text;
namespace OutOfSchool.Services.Models
{
@@ -32,6 +30,8 @@ public class BirthCertificate
///
/// Gets or sets date of issue of the birth certificate.
///
+ [DataType(DataType.Date)]
+ [Column(TypeName = "date")]
public DateTime SvidDate { get; set; }
public virtual Child Child { get; set; }
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/ChatMessage.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/ChatMessage.cs
index 58fdd6b9c1..76619b06f9 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/ChatMessage.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/ChatMessage.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace OutOfSchool.Services.Models
@@ -20,7 +19,7 @@ public class ChatMessage
public string Text { get; set; }
[Required]
- public DateTime CreatedTime { get; set; }
+ public DateTimeOffset CreatedTime { get; set; }
[Required]
public bool IsRead { get; set; }
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Child.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Child.cs
index 430e230b65..40a8004ed1 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/Child.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Child.cs
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
using OutOfSchool.Services.Enums;
namespace OutOfSchool.Services.Models
@@ -25,6 +26,8 @@ public class Child
[RegularExpression(@"[\w\-\']*", ErrorMessage = "Middle name cannot contains digits and special symbols")]
public string MiddleName { get; set; } = string.Empty;
+ [DataType(DataType.Date)]
+ [Column(TypeName = "date")]
public DateTime DateOfBirth { get; set; }
public Gender Gender { get; set; }
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Provider.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Provider.cs
index b120580539..ff17a8bd9e 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/Provider.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Provider.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
using OutOfSchool.Services.Enums;
namespace OutOfSchool.Services.Models
@@ -54,6 +55,7 @@ public class Provider
public string Director { get; set; } = string.Empty;
[DataType(DataType.Date)]
+ [Column(TypeName = "date")]
public DateTime DirectorDateOfBirth { get; set; } = default;
[DataType(DataType.PhoneNumber)]
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Rating.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Rating.cs
index f1aa7df4ee..b2884a9d8f 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/Rating.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Rating.cs
@@ -24,7 +24,7 @@ public class Rating
public long ParentId { get; set; }
[Required]
- public DateTime CreationTime { get; set; }
+ public DateTimeOffset CreationTime { get; set; }
public virtual Parent Parent { get; set; }
}
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Teacher.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Teacher.cs
index 5dda87449c..482be30dc0 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/Teacher.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Teacher.cs
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
namespace OutOfSchool.Services.Models
{
@@ -27,6 +28,7 @@ public class Teacher
[Required(ErrorMessage = "Date of birth is required")]
[DataType(DataType.Date)]
+ [Column(TypeName = "date")]
public DateTime DateOfBirth { get; set; }
[Required(ErrorMessage = "Description is required")]
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs
index 4c5d3124a5..70d0457930 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs
@@ -8,10 +8,10 @@ namespace OutOfSchool.Services.Models
public class User : IdentityUser
{
[DataType(DataType.DateTime)]
- public DateTime CreatingTime { get; set; }
+ public DateTimeOffset CreatingTime { get; set; }
[DataType(DataType.DateTime)]
- public DateTime LastLogin { get; set; }
+ public DateTimeOffset LastLogin { get; set; }
[Required(ErrorMessage = "LastName is required")]
[MaxLength(30)]
diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs
index 565cf4263f..a763f789f6 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs
@@ -73,6 +73,7 @@ public class Workshop
[Required(ErrorMessage = "Head's date of birth is required")]
[DataType(DataType.Date)]
+ [Column(TypeName = "date")]
public DateTime HeadDateOfBirth { get; set; }
[Required]
diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs
index 549ac2ddd4..f8807f66f1 100644
--- a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs
+++ b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs
@@ -165,7 +165,7 @@ public async Task Register(RegisterViewModel model)
MiddleName = model.MiddleName,
Email = model.Email,
PhoneNumber = model.PhoneNumber,
- CreatingTime = DateTime.Now,
+ CreatingTime = DateTimeOffset.UtcNow,
Role = model.Role,
IsRegistered = false,
};
diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210809130350_Datetime_changeTypes.Designer.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210809130350_Datetime_changeTypes.Designer.cs
new file mode 100644
index 0000000000..7e15672266
--- /dev/null
+++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210809130350_Datetime_changeTypes.Designer.cs
@@ -0,0 +1,1288 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using OutOfSchool.Services;
+
+namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations
+{
+ [DbContext(typeof(OutOfSchoolDbContext))]
+ [Migration("20210809130350_Datetime_changeTypes")]
+ partial class Datetime_changeTypes
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .UseIdentityColumns()
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.2");
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("char(36)")
+ .IsFixedLength(true);
+
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex")
+ .HasFilter("[NormalizedName] IS NOT NULL");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .UseIdentityColumn();
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RoleId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .UseIdentityColumn();
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProviderKey")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Address", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("BuildingNumber")
+ .IsRequired()
+ .HasMaxLength(15)
+ .HasColumnType("nvarchar(15)");
+
+ b.Property("City")
+ .IsRequired()
+ .HasMaxLength(15)
+ .HasColumnType("nvarchar(15)");
+
+ b.Property("District")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("Latitude")
+ .HasColumnType("float");
+
+ b.Property("Longitude")
+ .HasColumnType("float");
+
+ b.Property("Region")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("Street")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Addresses");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Application", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("ChildId")
+ .HasColumnType("bigint");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("WorkshopId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChildId");
+
+ b.HasIndex("ParentId");
+
+ b.HasIndex("WorkshopId");
+
+ b.ToTable("Applications");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.BirthCertificate", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("bigint");
+
+ b.Property("SvidDate")
+ .HasColumnType("date");
+
+ b.Property("SvidNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SvidNumMD5")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SvidSer")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SvidWho")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("BirthCertificates");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("ChatRoomId")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("IsRead")
+ .HasColumnType("bit");
+
+ b.Property("Text")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChatRoomId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("ChatMessages");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatRoom", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("WorkshopId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("WorkshopId");
+
+ b.ToTable("ChatRooms");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatRoomUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("ChatRoomId")
+ .HasColumnType("bigint");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChatRoomId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("ChatRoomUsers");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Child", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("DateOfBirth")
+ .HasColumnType("date");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)");
+
+ b.Property("Gender")
+ .HasColumnType("int");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)");
+
+ b.Property("MiddleName")
+ .HasMaxLength(40)
+ .HasColumnType("nvarchar(40)");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.Property("SocialGroupId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.HasIndex("SocialGroupId");
+
+ b.ToTable("Children");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.City", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("District")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("Latitude")
+ .HasColumnType("float");
+
+ b.Property("Longitude")
+ .HasColumnType("float");
+
+ b.Property("Name")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("Region")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Cities");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Class", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("DepartmentId")
+ .HasColumnType("bigint");
+
+ b.Property("Description")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DepartmentId");
+
+ b.ToTable("Classes");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Department", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("Description")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("DirectionId")
+ .HasColumnType("bigint");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DirectionId");
+
+ b.ToTable("Departments");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Direction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("Description")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Directions");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Favorite", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("WorkshopId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("WorkshopId");
+
+ b.ToTable("Favorites");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Parents");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Provider", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("ActualAddressId")
+ .HasColumnType("bigint");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("Director")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("DirectorDateOfBirth")
+ .HasColumnType("date");
+
+ b.Property("EdrpouIpn")
+ .IsRequired()
+ .HasMaxLength(12)
+ .HasColumnType("nvarchar(12)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("Facebook")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("Founder")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("FullTitle")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.Property("Instagram")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("LegalAddressId")
+ .HasColumnType("bigint");
+
+ b.Property("Ownership")
+ .HasColumnType("int");
+
+ b.Property("PhoneNumber")
+ .HasMaxLength(15)
+ .HasColumnType("nvarchar(15)");
+
+ b.Property("ShortTitle")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.Property("Status")
+ .HasColumnType("bit");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Website")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ActualAddressId");
+
+ b.HasIndex("LegalAddressId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Providers");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Rating", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("CreationTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("EntityId")
+ .HasColumnType("bigint");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.Property("Rate")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Ratings");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.SocialGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("Name")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("Id");
+
+ b.ToTable("SocialGroups");
+
+ b.HasData(
+ new
+ {
+ Id = 1L,
+ Name = "Діти із багатодітних сімей"
+ },
+ new
+ {
+ Id = 2L,
+ Name = "Діти із малозабезпечених сімей"
+ },
+ new
+ {
+ Id = 3L,
+ Name = "Діти з інвалідністю"
+ },
+ new
+ {
+ Id = 4L,
+ Name = "Діти-сироти"
+ },
+ new
+ {
+ Id = 5L,
+ Name = "Діти, позбавлені батьківського піклування"
+ });
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Teacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("DateOfBirth")
+ .HasColumnType("date");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(300)
+ .HasColumnType("nvarchar(300)");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("Image")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("MiddleName")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("WorkshopId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("WorkshopId");
+
+ b.ToTable("Teachers");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.User", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("char(36)")
+ .IsFixedLength(true);
+
+ b.Property("CreatingTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Email")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("IsRegistered")
+ .HasColumnType("bit");
+
+ b.Property("LastLogin")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("MiddleName")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("PasswordHash")
+ .HasMaxLength(84)
+ .IsUnicode(false)
+ .HasColumnType("char(84)")
+ .IsFixedLength(true);
+
+ b.Property("PhoneNumber")
+ .HasMaxLength(15)
+ .IsUnicode(false)
+ .HasColumnType("varchar(15)")
+ .IsFixedLength(false);
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("Role")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("SecurityStamp")
+ .IsRequired()
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("varchar(36)")
+ .IsFixedLength(false);
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex")
+ .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Workshop", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint")
+ .UseIdentityColumn();
+
+ b.Property("AddressId")
+ .HasColumnType("bigint");
+
+ b.Property("ClassId")
+ .HasColumnType("bigint");
+
+ b.Property("DaysPerWeek")
+ .HasColumnType("int");
+
+ b.Property("DepartmentId")
+ .HasColumnType("bigint");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("DirectionId")
+ .HasColumnType("bigint");
+
+ b.Property("DisabilityOptionsDesc")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("Facebook")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("Head")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("HeadDateOfBirth")
+ .HasColumnType("date");
+
+ b.Property("Instagram")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("IsPerMonth")
+ .HasColumnType("bit");
+
+ b.Property("Keywords")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("Logo")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("MaxAge")
+ .HasColumnType("int");
+
+ b.Property("MinAge")
+ .HasColumnType("int");
+
+ b.Property("Phone")
+ .IsRequired()
+ .HasMaxLength(15)
+ .HasColumnType("nvarchar(15)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("ProviderId")
+ .HasColumnType("bigint");
+
+ b.Property("ProviderTitle")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.Property("Website")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("WithDisabilityOptions")
+ .HasColumnType("bit");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AddressId");
+
+ b.HasIndex("ClassId");
+
+ b.HasIndex("DirectionId");
+
+ b.HasIndex("ProviderId");
+
+ b.ToTable("Workshops");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.User", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.User", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.User", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.User", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Application", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Child", "Child")
+ .WithMany()
+ .HasForeignKey("ChildId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Parent", "Parent")
+ .WithMany()
+ .HasForeignKey("ParentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Workshop", "Workshop")
+ .WithMany("Applications")
+ .HasForeignKey("WorkshopId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Child");
+
+ b.Navigation("Parent");
+
+ b.Navigation("Workshop");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.BirthCertificate", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Child", "Child")
+ .WithOne("BirthCertificate")
+ .HasForeignKey("OutOfSchool.Services.Models.BirthCertificate", "Id")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Child");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatMessage", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.ChatRoom", "ChatRoom")
+ .WithMany("ChatMessages")
+ .HasForeignKey("ChatRoomId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.User", "User")
+ .WithMany("ChatMessages")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ChatRoom");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatRoom", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Workshop", "Workshop")
+ .WithMany("ChatRooms")
+ .HasForeignKey("WorkshopId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Workshop");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatRoomUser", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.ChatRoom", "ChatRoom")
+ .WithMany("ChatRoomUsers")
+ .HasForeignKey("ChatRoomId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.User", "User")
+ .WithMany("ChatRoomUsers")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ChatRoom");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Child", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Parent", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.SocialGroup", "SocialGroup")
+ .WithMany("Children")
+ .HasForeignKey("SocialGroupId");
+
+ b.Navigation("Parent");
+
+ b.Navigation("SocialGroup");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Class", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Department", "Department")
+ .WithMany("Classes")
+ .HasForeignKey("DepartmentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Department");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Department", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Direction", "Direction")
+ .WithMany("Departments")
+ .HasForeignKey("DirectionId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Direction");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Favorite", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Workshop", "Workshop")
+ .WithMany()
+ .HasForeignKey("WorkshopId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+
+ b.Navigation("Workshop");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Provider", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Address", "ActualAddress")
+ .WithMany()
+ .HasForeignKey("ActualAddressId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Address", "LegalAddress")
+ .WithMany()
+ .HasForeignKey("LegalAddressId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ActualAddress");
+
+ b.Navigation("LegalAddress");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Rating", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Parent", "Parent")
+ .WithMany()
+ .HasForeignKey("ParentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Parent");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Teacher", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Workshop", "Workshop")
+ .WithMany("Teachers")
+ .HasForeignKey("WorkshopId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Workshop");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Workshop", b =>
+ {
+ b.HasOne("OutOfSchool.Services.Models.Address", "Address")
+ .WithMany()
+ .HasForeignKey("AddressId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Class", "Class")
+ .WithMany()
+ .HasForeignKey("ClassId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Direction", "Direction")
+ .WithMany()
+ .HasForeignKey("DirectionId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OutOfSchool.Services.Models.Provider", "Provider")
+ .WithMany("Workshops")
+ .HasForeignKey("ProviderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Address");
+
+ b.Navigation("Class");
+
+ b.Navigation("Direction");
+
+ b.Navigation("Provider");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.ChatRoom", b =>
+ {
+ b.Navigation("ChatMessages");
+
+ b.Navigation("ChatRoomUsers");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Child", b =>
+ {
+ b.Navigation("BirthCertificate");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Department", b =>
+ {
+ b.Navigation("Classes");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Direction", b =>
+ {
+ b.Navigation("Departments");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b =>
+ {
+ b.Navigation("Children");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Provider", b =>
+ {
+ b.Navigation("Workshops");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.SocialGroup", b =>
+ {
+ b.Navigation("Children");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.User", b =>
+ {
+ b.Navigation("ChatMessages");
+
+ b.Navigation("ChatRoomUsers");
+ });
+
+ modelBuilder.Entity("OutOfSchool.Services.Models.Workshop", b =>
+ {
+ b.Navigation("Applications");
+
+ b.Navigation("ChatRooms");
+
+ b.Navigation("Teachers");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210809130350_Datetime_changeTypes.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210809130350_Datetime_changeTypes.cs
new file mode 100644
index 0000000000..6f3af7929f
--- /dev/null
+++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210809130350_Datetime_changeTypes.cs
@@ -0,0 +1,174 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations
+{
+ public partial class Datetime_changeTypes : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "HeadDateOfBirth",
+ table: "Workshops",
+ type: "date",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "DateOfBirth",
+ table: "Teachers",
+ type: "date",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "CreationTime",
+ table: "Ratings",
+ type: "datetimeoffset",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "DirectorDateOfBirth",
+ table: "Providers",
+ type: "date",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "DateOfBirth",
+ table: "Children",
+ type: "date",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "CreatedTime",
+ table: "ChatMessages",
+ type: "datetimeoffset",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "SvidDate",
+ table: "BirthCertificates",
+ type: "date",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "LastLogin",
+ table: "AspNetUsers",
+ type: "datetimeoffset",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "CreatingTime",
+ table: "AspNetUsers",
+ type: "datetimeoffset",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+
+ migrationBuilder.AlterColumn(
+ name: "CreationTime",
+ table: "Applications",
+ type: "datetimeoffset",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime2");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "HeadDateOfBirth",
+ table: "Workshops",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "date");
+
+ migrationBuilder.AlterColumn(
+ name: "DateOfBirth",
+ table: "Teachers",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "date");
+
+ migrationBuilder.AlterColumn(
+ name: "CreationTime",
+ table: "Ratings",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "datetimeoffset");
+
+ migrationBuilder.AlterColumn(
+ name: "DirectorDateOfBirth",
+ table: "Providers",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "date");
+
+ migrationBuilder.AlterColumn(
+ name: "DateOfBirth",
+ table: "Children",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "date");
+
+ migrationBuilder.AlterColumn(
+ name: "CreatedTime",
+ table: "ChatMessages",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "datetimeoffset");
+
+ migrationBuilder.AlterColumn(
+ name: "SvidDate",
+ table: "BirthCertificates",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "date");
+
+ migrationBuilder.AlterColumn(
+ name: "LastLogin",
+ table: "AspNetUsers",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "datetimeoffset");
+
+ migrationBuilder.AlterColumn(
+ name: "CreatingTime",
+ table: "AspNetUsers",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "datetimeoffset");
+
+ migrationBuilder.AlterColumn(
+ name: "CreationTime",
+ table: "Applications",
+ type: "datetime2",
+ nullable: false,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "datetimeoffset");
+ }
+ }
+}
diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs
index 2205d02941..0f31b88603 100644
--- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs
+++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs
@@ -205,8 +205,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("ChildId")
.HasColumnType("bigint");
- b.Property("CreationTime")
- .HasColumnType("datetime2");
+ b.Property("CreationTime")
+ .HasColumnType("datetimeoffset");
b.Property("ParentId")
.HasColumnType("bigint");
@@ -234,7 +234,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("bigint");
b.Property("SvidDate")
- .HasColumnType("datetime2");
+ .HasColumnType("date");
b.Property("SvidNum")
.HasColumnType("nvarchar(max)");
@@ -263,8 +263,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("ChatRoomId")
.HasColumnType("bigint");
- b.Property("CreatedTime")
- .HasColumnType("datetime2");
+ b.Property("CreatedTime")
+ .HasColumnType("datetimeoffset");
b.Property("IsRead")
.HasColumnType("bit");
@@ -337,7 +337,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.UseIdentityColumn();
b.Property("DateOfBirth")
- .HasColumnType("datetime2");
+ .HasColumnType("date");
b.Property("FirstName")
.IsRequired()
@@ -535,7 +535,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("nvarchar(50)");
b.Property("DirectorDateOfBirth")
- .HasColumnType("datetime2");
+ .HasColumnType("date");
b.Property("EdrpouIpn")
.IsRequired()
@@ -612,8 +612,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("bigint")
.UseIdentityColumn();
- b.Property("CreationTime")
- .HasColumnType("datetime2");
+ b.Property("CreationTime")
+ .HasColumnType("datetimeoffset");
b.Property("EntityId")
.HasColumnType("bigint");
@@ -685,7 +685,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.UseIdentityColumn();
b.Property("DateOfBirth")
- .HasColumnType("datetime2");
+ .HasColumnType("date");
b.Property("Description")
.IsRequired()
@@ -737,8 +737,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("char(36)")
.IsFixedLength(true);
- b.Property("CreatingTime")
- .HasColumnType("datetime2");
+ b.Property("CreatingTime")
+ .HasColumnType("datetimeoffset");
b.Property("Email")
.HasMaxLength(256)
@@ -755,8 +755,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("IsRegistered")
.HasColumnType("bit");
- b.Property("LastLogin")
- .HasColumnType("datetime2");
+ b.Property("LastLogin")
+ .HasColumnType("datetimeoffset");
b.Property("LastName")
.IsRequired()
@@ -873,7 +873,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("nvarchar(50)");
b.Property("HeadDateOfBirth")
- .HasColumnType("datetime2");
+ .HasColumnType("date");
b.Property("Instagram")
.HasMaxLength(256)
diff --git a/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs b/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs
index 33ac37daa0..3b2c89f3ea 100644
--- a/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs
+++ b/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs
@@ -37,10 +37,10 @@ public class RegisterViewModel
public string PhoneNumber { get; set; }
[DataType(DataType.DateTime)]
- public DateTime CreatingTime { get; set; }
+ public DateTimeOffset CreatingTime { get; set; }
[DataType(DataType.DateTime)]
- public DateTime? LastLogin { get; set; }
+ public DateTimeOffset? LastLogin { get; set; }
public string ReturnUrl { get; set; }
diff --git a/OutOfSchool/OutOfSchool.WebApi.Tests/Controllers/ChatControllerTests.cs b/OutOfSchool/OutOfSchool.WebApi.Tests/Controllers/ChatControllerTests.cs
index 425c65468e..364598ace1 100644
--- a/OutOfSchool/OutOfSchool.WebApi.Tests/Controllers/ChatControllerTests.cs
+++ b/OutOfSchool/OutOfSchool.WebApi.Tests/Controllers/ChatControllerTests.cs
@@ -209,7 +209,7 @@ public async Task CreateMessage_WhenChatRoomIdIsSetAndIsValid_ReturnsCreatedAtAc
UserId = userId,
ChatRoomId = 1,
Text = "new text",
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
messageServiceMoq.Setup(x => x.Create(It.IsAny()))
@@ -258,7 +258,7 @@ public async Task CreateMessage_WhenChatRoomIdIsNotSetChatCanBeCreted_ReturnsCre
UserId = userId,
ChatRoomId = 1,
Text = "new text",
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
roomServiceMoq.Setup(x => x.UsersCanChatBetweenEachOther(It.IsAny(), It.IsAny(), It.IsAny()))
@@ -548,7 +548,7 @@ public void UpdateMessagesStatus_WhenServerErrorOccured_ThrowsDbUpdateConcurrenc
Id = 1,
UserId = userId,
ChatRoomId = roomId,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
},
};
@@ -584,7 +584,7 @@ public async Task UpdateMessagesStatus_WhenStatusCanBeUpdated_ReturnsOkObjectRes
Id = 1,
UserId = userId,
ChatRoomId = roomId,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
},
};
@@ -727,7 +727,7 @@ public async Task UpdateMessage_WhenMessageIsTooOldToBeUpdated_Returns403ObjectR
Id = id,
UserId = userId,
ChatRoomId = 1,
- CreatedTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0)),
+ CreatedTime = DateTimeOffset.UtcNow.Subtract(new TimeSpan(1, 0, 0)),
});
// Act
@@ -750,7 +750,7 @@ public void UpdateMessage_WhenServerErrorOccured_ThrowsDbUpdateConcurrencyExcept
Id = id,
UserId = userId,
ChatRoomId = 1,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
Text = "new text",
};
@@ -777,7 +777,7 @@ public async Task UpdateMessage_WhenMessageCanBeUpdated_ReturnsOkObjectResul(lon
Id = id,
UserId = userId,
ChatRoomId = 1,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
Text = "new text",
};
@@ -837,7 +837,7 @@ public async Task DeleteMessage_WhenUserIsNotItsOwner_Returns403ObjectResult(lon
.ReturnsAsync(new ChatMessageDto()
{
UserId = "NotCurrentUserId",
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
});
// Act
@@ -861,7 +861,7 @@ public async Task DeleteMessage_WhenMessageIsTooOldToBeDeleted_Returns403ObjectR
Id = id,
UserId = userId,
ChatRoomId = 1,
- CreatedTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0)),
+ CreatedTime = DateTimeOffset.UtcNow.Subtract(new TimeSpan(1, 0, 0)),
});
// Act
@@ -883,7 +883,7 @@ public void DeleteMessage_WhenServerErrorOccured_ThrowsDbUpdateConcurrencyExcept
.ReturnsAsync(new ChatMessageDto()
{
UserId = userId,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
});
messageServiceMoq.Setup(x => x.Delete(id))
@@ -905,7 +905,7 @@ public void DeleteMessage_WhenMessageWasDeletedBeforeMethodCallsDelete_ThrowsArg
.ReturnsAsync(new ChatMessageDto()
{
UserId = userId,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
});
messageServiceMoq.Setup(x => x.Delete(id))
@@ -927,7 +927,7 @@ public async Task DeleteMessage_WhenMessageCanBeDeleted_ReturnsNoContentResult(l
.ReturnsAsync(new ChatMessageDto()
{
UserId = userId,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
});
messageServiceMoq.Setup(x => x.Delete(id))
diff --git a/OutOfSchool/OutOfSchool.WebApi.Tests/Extensions/MappingExtensionsTests.cs b/OutOfSchool/OutOfSchool.WebApi.Tests/Extensions/MappingExtensionsTests.cs
index 0c8a34aabe..f2cc494a56 100644
--- a/OutOfSchool/OutOfSchool.WebApi.Tests/Extensions/MappingExtensionsTests.cs
+++ b/OutOfSchool/OutOfSchool.WebApi.Tests/Extensions/MappingExtensionsTests.cs
@@ -23,7 +23,7 @@ public void Mapping_ChatMessageDtoToDomain_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = true,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
};
// Act
@@ -54,7 +54,7 @@ public void Mapping_ChatMessageToModel_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = true,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
User = Mock.Of(),
ChatRoom = Mock.Of(),
};
@@ -88,7 +88,7 @@ public void Mapping_ChatRoomDtoToDomain_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = true,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
};
var chatMessage2 = new ChatMessageDto()
{
@@ -97,7 +97,7 @@ public void Mapping_ChatRoomDtoToDomain_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = false,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:20", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:20", new CultureInfo("uk-UA", false)),
};
var listOfUsers = new List() { user1, user2 };
@@ -147,7 +147,7 @@ public void Mapping_ChatRoomToModel_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = true,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
User = Mock.Of(),
ChatRoom = Mock.Of(),
};
@@ -158,7 +158,7 @@ public void Mapping_ChatRoomToModel_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = false,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:20", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:20", new CultureInfo("uk-UA", false)),
User = Mock.Of(),
ChatRoom = Mock.Of(),
};
@@ -210,7 +210,7 @@ public void Mapping_ChatRoomToModelWithoutCHatMessages_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = true,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:12", new CultureInfo("uk-UA", false)),
User = Mock.Of(),
ChatRoom = Mock.Of(),
};
@@ -221,7 +221,7 @@ public void Mapping_ChatRoomToModelWithoutCHatMessages_IsCorrect()
ChatRoomId = 2,
Text = "test mess",
IsRead = false,
- CreatedTime = DateTime.Parse("2021-05-24T12:15:20", new CultureInfo("uk-UA", false)),
+ CreatedTime = DateTimeOffset.Parse("2021-05-24T12:15:20", new CultureInfo("uk-UA", false)),
User = Mock.Of(),
ChatRoom = Mock.Of(),
};
diff --git a/OutOfSchool/OutOfSchool.WebApi.Tests/Hubs/ChatHubTests.cs b/OutOfSchool/OutOfSchool.WebApi.Tests/Hubs/ChatHubTests.cs
index a3e8e27373..88ca125fb3 100644
--- a/OutOfSchool/OutOfSchool.WebApi.Tests/Hubs/ChatHubTests.cs
+++ b/OutOfSchool/OutOfSchool.WebApi.Tests/Hubs/ChatHubTests.cs
@@ -116,7 +116,7 @@ public async Task SendMessageToOthersInGroup_WhenChatRoomIdIsSetAndValid_ShouldN
UserId = userId,
Text = "hi",
ChatRoomId = 1,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
messageServiceMoq.Setup(x => x.Create(It.IsAny()))
@@ -157,7 +157,7 @@ public async Task SendMessageToOthersInGroup_WhenChatRoomDoesNotExistUsersCanCha
UserId = userId,
Text = "hi",
ChatRoomId = 3,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
messageServiceMoq.Setup(x => x.Create(It.IsAny()))
diff --git a/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatMessageServiceTests.cs b/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatMessageServiceTests.cs
index 7a8b355051..400b9e3453 100644
--- a/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatMessageServiceTests.cs
+++ b/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatMessageServiceTests.cs
@@ -161,7 +161,7 @@ public async Task Update_WhenEntityIsValid_ShouldUpdateEntity()
UserId = "user1",
Text = "newtext",
ChatRoomId = 1,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = true,
};
@@ -186,7 +186,7 @@ public void Update_WhenIdIsInvalid_ShouldThrowArgumentOutOfRangeException()
UserId = "user1",
Text = "newtext",
ChatRoomId = 1,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = true,
};
@@ -294,7 +294,7 @@ private void SeedDatabase()
UserId = "user1",
Text = "text5",
ChatRoomId = 1,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
@@ -305,10 +305,10 @@ private void SeedDatabase()
var messages = new List()
{
- new ChatMessage() { Id = 1, UserId = "user1", ChatRoomId = 1, Text = "text1", CreatedTime = DateTime.Parse("2021-06-18 15:47"), IsRead = false },
- new ChatMessage() { Id = 2, UserId = "user2", ChatRoomId = 1, Text = "text2", CreatedTime = DateTime.Parse("2021-06-18 15:48"), IsRead = false },
- new ChatMessage() { Id = 3, UserId = "user1", ChatRoomId = 2, Text = "text3", CreatedTime = DateTime.Now, IsRead = false },
- new ChatMessage() { Id = 4, UserId = "user2", ChatRoomId = 2, Text = "text4", CreatedTime = DateTime.Now, IsRead = false },
+ new ChatMessage() { Id = 1, UserId = "user1", ChatRoomId = 1, Text = "text1", CreatedTime = DateTimeOffset.Parse("2021-06-18 15:47"), IsRead = false },
+ new ChatMessage() { Id = 2, UserId = "user2", ChatRoomId = 1, Text = "text2", CreatedTime = DateTimeOffset.Parse("2021-06-18 15:48"), IsRead = false },
+ new ChatMessage() { Id = 3, UserId = "user1", ChatRoomId = 2, Text = "text3", CreatedTime = DateTimeOffset.UtcNow, IsRead = false },
+ new ChatMessage() { Id = 4, UserId = "user2", ChatRoomId = 2, Text = "text4", CreatedTime = DateTimeOffset.UtcNow, IsRead = false },
};
context.ChatMessages.AddRangeAsync(messages);
diff --git a/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatRoomServiceTests.cs b/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatRoomServiceTests.cs
index 87ea262477..6743e7a58f 100644
--- a/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatRoomServiceTests.cs
+++ b/OutOfSchool/OutOfSchool.WebApi.Tests/Services/ChatRoomServiceTests.cs
@@ -237,10 +237,10 @@ private void SeedDatabase()
var messages = new List()
{
- new ChatMessage() { Id = 1, UserId = "user1", ChatRoomId = 1, Text = "text1", CreatedTime = DateTime.Parse("2021-06-18 15:47"), IsRead = false },
- new ChatMessage() { Id = 2, UserId = "user3", ChatRoomId = 1, Text = "text2", CreatedTime = DateTime.Parse("2021-06-18 15:48"), IsRead = false },
- new ChatMessage() { Id = 3, UserId = "user1", ChatRoomId = 2, Text = "text3", CreatedTime = DateTime.Now, IsRead = false },
- new ChatMessage() { Id = 4, UserId = "user4", ChatRoomId = 2, Text = "text4", CreatedTime = DateTime.Now, IsRead = false },
+ new ChatMessage() { Id = 1, UserId = "user1", ChatRoomId = 1, Text = "text1", CreatedTime = DateTimeOffset.Parse("2021-06-18 15:47"), IsRead = false },
+ new ChatMessage() { Id = 2, UserId = "user3", ChatRoomId = 1, Text = "text2", CreatedTime = DateTimeOffset.Parse("2021-06-18 15:48"), IsRead = false },
+ new ChatMessage() { Id = 3, UserId = "user1", ChatRoomId = 2, Text = "text3", CreatedTime = DateTimeOffset.UtcNow, IsRead = false },
+ new ChatMessage() { Id = 4, UserId = "user4", ChatRoomId = 2, Text = "text4", CreatedTime = DateTimeOffset.UtcNow, IsRead = false },
};
context.ChatMessages.AddRangeAsync(messages);
diff --git a/OutOfSchool/OutOfSchool.WebApi/Controllers/ApplicationController.cs b/OutOfSchool/OutOfSchool.WebApi/Controllers/ApplicationController.cs
index 8b4abbffa8..8a36044dc8 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Controllers/ApplicationController.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Controllers/ApplicationController.cs
@@ -306,7 +306,7 @@ public async Task Create(ApplicationDto applicationDto)
applicationDto.Id = default;
- applicationDto.CreationTime = DateTime.Now;
+ applicationDto.CreationTime = DateTimeOffset.UtcNow;
applicationDto.Status = 0;
@@ -402,7 +402,7 @@ private static IEnumerable CreateMultiple(ApplicationApiModel ap
var applications = applicationApiModel.Children.Select(child => new ApplicationDto
{
ChildId = child.Id,
- CreationTime = DateTime.Now,
+ CreationTime = DateTimeOffset.UtcNow,
WorkshopId = applicationApiModel.WorkshopId,
});
diff --git a/OutOfSchool/OutOfSchool.WebApi/Controllers/ChatController.cs b/OutOfSchool/OutOfSchool.WebApi/Controllers/ChatController.cs
index f36239e9ea..5868a9be6a 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Controllers/ChatController.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Controllers/ChatController.cs
@@ -63,7 +63,7 @@ public async Task CreateMessage(ChatNewMessageDto chatNewMessageD
UserId = senderUserId,
ChatRoomId = 0,
Text = chatNewMessageDto.Text,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
@@ -282,7 +282,7 @@ public async Task UpdateMessage(ChatMessageDto chatMessageDto)
var whenMessageBecomesOld = new TimeSpan(0, 10, 0);
- if (oldChatMessage.CreatedTime.CompareTo(DateTime.Now.Subtract(whenMessageBecomesOld)) < 0)
+ if (oldChatMessage.CreatedTime.CompareTo(DateTimeOffset.UtcNow.Subtract(whenMessageBecomesOld)) < 0)
{
return StatusCode(403, "Forbidden to change old messages.");
}
@@ -324,7 +324,7 @@ public async Task DeleteMessage(long id)
var whenMessageBecomesOld = new TimeSpan(0, 10, 0);
- if (oldChatMessage.CreatedTime.CompareTo(DateTime.Now.Subtract(whenMessageBecomesOld)) < 0)
+ if (oldChatMessage.CreatedTime.CompareTo(DateTimeOffset.UtcNow.Subtract(whenMessageBecomesOld)) < 0)
{
return StatusCode(403, "Forbidden to delete old messages.");
}
diff --git a/OutOfSchool/OutOfSchool.WebApi/Hubs/ChatHub.cs b/OutOfSchool/OutOfSchool.WebApi/Hubs/ChatHub.cs
index 62224dacd0..c7c4b97f9d 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Hubs/ChatHub.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Hubs/ChatHub.cs
@@ -90,7 +90,7 @@ public async Task SendMessageToOthersInGroup(string chatNewMessage)
UserId = senderUserId,
ChatRoomId = 0,
Text = chatNewMessageDto.Text,
- CreatedTime = DateTime.Now,
+ CreatedTime = DateTimeOffset.UtcNow,
IsRead = false,
};
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/ApplicationDTO.cs b/OutOfSchool/OutOfSchool.WebApi/Models/ApplicationDTO.cs
index 86aea61a87..9d6d760486 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/ApplicationDTO.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/ApplicationDTO.cs
@@ -11,7 +11,7 @@ public class ApplicationDto
[Range(1, 5, ErrorMessage = "Status should be from 1 to 5")]
public ApplicationStatus Status { get; set; } = ApplicationStatus.Pending;
- public DateTime CreationTime { get; set; }
+ public DateTimeOffset CreationTime { get; set; }
[Required]
[Range(1, long.MaxValue, ErrorMessage = "Workshop id should be grater than 0")]
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/BirthCertificateDTO.cs b/OutOfSchool/OutOfSchool.WebApi/Models/BirthCertificateDTO.cs
index 3251ca7241..b5219d258c 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/BirthCertificateDTO.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/BirthCertificateDTO.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
namespace OutOfSchool.WebApi.Models
{
@@ -17,6 +15,7 @@ public class BirthCertificateDto
public string SvidWho { get; set; } = string.Empty;
+ [DataType(DataType.Date)]
public DateTime SvidDate { get; set; } = default;
public long ChildId { get; set; }
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/ChatMessageDto.cs b/OutOfSchool/OutOfSchool.WebApi/Models/ChatMessageDto.cs
index 73b5e7790f..9c38257545 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/ChatMessageDto.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/ChatMessageDto.cs
@@ -17,7 +17,7 @@ public class ChatMessageDto
[MaxLength(200)]
public string Text { get; set; }
- public DateTime CreatedTime { get; set; }
+ public DateTimeOffset CreatedTime { get; set; }
public bool IsRead { get; set; }
}
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/ParentDTO.cs b/OutOfSchool/OutOfSchool.WebApi/Models/ParentDTO.cs
index 2e792c15a7..e5e07241ec 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/ParentDTO.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/ParentDTO.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace OutOfSchool.WebApi.Models
+namespace OutOfSchool.WebApi.Models
{
public class ParentDTO
{
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/ProviderDTO.cs b/OutOfSchool/OutOfSchool.WebApi/Models/ProviderDTO.cs
index f6fe501151..0dbb13cca8 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/ProviderDTO.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/ProviderDTO.cs
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
-using System.Text.Json.Serialization;
using OutOfSchool.Services.Enums;
namespace OutOfSchool.WebApi.Models
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/RatingDTO.cs b/OutOfSchool/OutOfSchool.WebApi/Models/RatingDTO.cs
index b0fbd277a1..a3c0d88ed4 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/RatingDTO.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/RatingDTO.cs
@@ -23,7 +23,7 @@ public class RatingDto
[Range(1, long.MaxValue, ErrorMessage = "The ParentId field should be bigger than 0")]
public long ParentId { get; set; }
- public DateTime CreationTime { get; set; } = DateTime.Now;
+ public DateTimeOffset CreationTime { get; set; } = DateTimeOffset.UtcNow;
public string FirstName { get; set; }
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/ShortUserDto.cs b/OutOfSchool/OutOfSchool.WebApi/Models/ShortUserDto.cs
index 85e204a598..cb504921ef 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/ShortUserDto.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/ShortUserDto.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
namespace OutOfSchool.WebApi.Models
{
diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/UserDto.cs b/OutOfSchool/OutOfSchool.WebApi/Models/UserDto.cs
index 0898e8a4e6..0ecade13d8 100644
--- a/OutOfSchool/OutOfSchool.WebApi/Models/UserDto.cs
+++ b/OutOfSchool/OutOfSchool.WebApi/Models/UserDto.cs
@@ -7,10 +7,10 @@ namespace OutOfSchool.WebApi.Models
public class UserDto : IdentityUser
{
[DataType(DataType.DateTime)]
- public DateTime CreatingTime { get; set; }
+ public DateTimeOffset CreatingTime { get; set; }
[DataType(DataType.DateTime)]
- public DateTime LastLogin { get; set; }
+ public DateTimeOffset LastLogin { get; set; }
[MaxLength(30)]
public string LastName { get; set; }