-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9ea32a
commit aa86552
Showing
7 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Unitagram.Domain; | ||
|
||
public class OtpConfirmation | ||
{ | ||
public Guid UserId { get; set; } | ||
public string Name { get; set; } = string.Empty; | ||
public string Value { get; set; } = string.Empty; | ||
public int RetryCount { get; set; } | ||
public DateTime? RetryDateTime { get; set; } | ||
} |
28 changes: 28 additions & 0 deletions
28
Unitagram.Persistence/Configurations/OtpConfirmationConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Unitagram.Domain; | ||
|
||
namespace Unitagram.Persistence.Configurations; | ||
|
||
public class OtpConfirmationConfiguration : IEntityTypeConfiguration<OtpConfirmation> | ||
{ | ||
public void Configure(EntityTypeBuilder<OtpConfirmation> builder) | ||
{ | ||
builder.HasKey(o => new { o.UserId, o.Name}); | ||
|
||
builder.Property(o => o.Name) | ||
.HasMaxLength(50); | ||
|
||
builder.Property(o => o.RetryCount) | ||
.HasColumnType("tinyint") | ||
.HasDefaultValue((byte)0) | ||
.IsRequired(); | ||
|
||
builder.Property(o => o.Value) | ||
.IsRequired() | ||
.HasMaxLength(10); | ||
|
||
builder.Property(o => o.RetryDateTime) | ||
.IsRequired(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
Unitagram.Persistence/Migrations/20230910144223_AddOtpConfirmation.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
Unitagram.Persistence/Migrations/20230910144223_AddOtpConfirmation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Unitagram.Persistence.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class AddOtpConfirmation : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "OtpConfirmation", | ||
columns: table => new | ||
{ | ||
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), | ||
Value = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false), | ||
RetryCount = table.Column<byte>(type: "tinyint", nullable: false, defaultValue: (byte)0), | ||
RetryDateTime = table.Column<DateTime>(type: "datetime2", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_OtpConfirmation", x => new { x.UserId, x.Name }); | ||
}); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "OtpConfirmation"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters