Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Olhaholiak/changed some columns types of datetime #265

Merged
merged 3 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Config/SQLQuery_insert test values.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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================================
Expand Down
2 changes: 1 addition & 1 deletion OutOfSchool/OutOfSchool.DataAccess/Models/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions OutOfSchool/OutOfSchool.DataAccess/Models/BirthCertificate.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -32,6 +30,8 @@ public class BirthCertificate
/// <summary>
/// Gets or sets date of issue of the birth certificate.
/// </summary>
[DataType(DataType.Date)]
[Column(TypeName = "date")]
public DateTime SvidDate { get; set; }

public virtual Child Child { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions OutOfSchool/OutOfSchool.DataAccess/Models/ChatMessage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace OutOfSchool.Services.Models
Expand All @@ -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; }
Expand Down
3 changes: 3 additions & 0 deletions OutOfSchool/OutOfSchool.DataAccess/Models/Child.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using OutOfSchool.Services.Enums;

namespace OutOfSchool.Services.Models
Expand All @@ -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; }
Expand Down
2 changes: 2 additions & 0 deletions OutOfSchool/OutOfSchool.DataAccess/Models/Provider.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion OutOfSchool/OutOfSchool.DataAccess/Models/Rating.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Expand Down
2 changes: 2 additions & 0 deletions OutOfSchool/OutOfSchool.DataAccess/Models/Teacher.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace OutOfSchool.Services.Models
{
Expand Down Expand Up @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions OutOfSchool/OutOfSchool.DataAccess/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 1 addition & 0 deletions OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public async Task<IActionResult> Register(RegisterViewModel model)
MiddleName = model.MiddleName,
Email = model.Email,
PhoneNumber = model.PhoneNumber,
CreatingTime = DateTime.Now,
CreatingTime = DateTimeOffset.UtcNow,
Role = model.Role,
IsRegistered = false,
};
Expand Down
Loading