Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

fix(users): Changed Birthdate variable type #17

Merged
merged 3 commits into from
Jun 11, 2022
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
2 changes: 1 addition & 1 deletion WAW.API/Auth/Domain/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class User : BaseModel {
public string FullName { get; set; } = string.Empty;
public string PreferredName { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public DateOnly Birthdate { get; set; }
public DateTime Birthdate { get; set; }
public string? Location { get; set; }
public string? Biography { get; set; }
public string? About { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion WAW.API/Auth/Resources/UserRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class UserRequest {

[SwaggerSchema("User birthdate", Nullable = false)]
[Required]
public DateOnly Birthdate { get; set; }
public DateTime Birthdate { get; set; }

[SwaggerSchema("User location (address, city or country)", Nullable = true)]
public string Location { get; set; } = string.Empty;
Expand Down
2 changes: 1 addition & 1 deletion WAW.API/Auth/Resources/UserResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class UserResource {
public string Email { get; set; } = string.Empty;

[SwaggerSchema("User birthdate", Nullable = false)]
public DateOnly Birthdate { get; set; }
public DateTime Birthdate { get; set; }

[SwaggerSchema("User location")]
public string Location { get; set; } = string.Empty;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions WAW.API/Migrations/20220611150001_ChangedBirthdateTypeInUsers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace WAW.API.Migrations
{
public partial class ChangedBirthdateTypeInUsers : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "birthdate",
table: "users",
type: "datetime(6)",
nullable: false,
oldClrType: typeof(DateOnly),
oldType: "date");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateOnly>(
name: "birthdate",
table: "users",
type: "date",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "datetime(6)");
}
}
}
4 changes: 2 additions & 2 deletions WAW.API/Migrations/AppDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("longtext")
.HasColumnName("biography");

b.Property<DateOnly>("Birthdate")
.HasColumnType("date")
b.Property<DateTime>("Birthdate")
.HasColumnType("datetime(6)")
.HasColumnName("birthdate");

b.Property<string>("Email")
Expand Down