use UUID v7

This commit is contained in:
jojo aquino 2025-01-01 16:26:01 +00:00
parent c7750730b4
commit 285ada3d13
5 changed files with 12 additions and 11 deletions

View File

@ -6,12 +6,13 @@ namespace EnotaryoPH.Web.Common.Models
{ {
internal static IdentificationDocument ToEntity(this IdentificationDocumentModel model, int userID) internal static IdentificationDocument ToEntity(this IdentificationDocumentModel model, int userID)
{ {
var now = DateTime.UtcNow;
var entity = new IdentificationDocument var entity = new IdentificationDocument
{ {
UploadedOn = DateTime.UtcNow, UploadedOn = now,
UserID = userID, UserID = userID,
IdentificationDocument_UID = Guid.NewGuid(), IdentificationDocument_UID = Guid.CreateVersion7(now),
CreatedOn = DateTime.UtcNow CreatedOn = now
}; };
return model.ToEntity(entity); return model.ToEntity(entity);

View File

@ -9,7 +9,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CompreFace.NET.Sdk" Version="1.0.2" /> <PackageReference Include="CompreFace.NET.Sdk" Version="1.0.2" />
<PackageReference Include="Coravel" Version="6.0.1" />
<PackageReference Include="Coravel.Mailer" Version="7.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0" />
<PackageReference Include="MimeKit" Version="4.9.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using NsEntities = EnotaryoPH.Data.Entities; using NsEntities = EnotaryoPH.Data.Entities;
namespace EnotaryoPH.Web.Pages.Principal.IdentificationDocument namespace EnotaryoPH.Web.Pages.Principal.IdentificationDocument
@ -84,7 +83,7 @@ namespace EnotaryoPH.Web.Pages.Principal.IdentificationDocument
{ {
entity.UserID = user.UserID; entity.UserID = user.UserID;
entity.CreatedOn = DateTime.UtcNow; entity.CreatedOn = DateTime.UtcNow;
entity.IdentificationDocument_UID = Guid.NewGuid(); entity.IdentificationDocument_UID = Guid.CreateVersion7(DateTime.UtcNow);
_notaryoDBContext.Add(entity); _notaryoDBContext.Add(entity);
} }
_notaryoDBContext.SaveChanges(); _notaryoDBContext.SaveChanges();

View File

@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using EnotaryoPH.Data; using EnotaryoPH.Data;
using EnotaryoPH.Data.Constants;
using EnotaryoPH.Data.Entities; using EnotaryoPH.Data.Entities;
using Exadel.Compreface.Clients.CompreFaceClient; using Exadel.Compreface.Clients.CompreFaceClient;
using Exadel.Compreface.DTOs.FaceVerificationDTOs.FaceVerification; using Exadel.Compreface.DTOs.FaceVerificationDTOs.FaceVerification;
@ -45,7 +44,7 @@ namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
selfieEntity = new TransactionSelfie selfieEntity = new TransactionSelfie
{ {
CreatedOn = DateTime.UtcNow, CreatedOn = DateTime.UtcNow,
TransactionSelfie_UID = Guid.NewGuid(), TransactionSelfie_UID = Guid.CreateVersion7(DateTime.UtcNow),
UserID = user.UserID UserID = user.UserID
}; };
TransactionSelfie_UID = selfieEntity.TransactionSelfie_UID.Value; TransactionSelfie_UID = selfieEntity.TransactionSelfie_UID.Value;
@ -101,13 +100,13 @@ namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
CreatedOn = DateTime.UtcNow, CreatedOn = DateTime.UtcNow,
PrincipalID = user.UserID, PrincipalID = user.UserID,
Status = nameof(TransactionStatus.New), Status = nameof(TransactionStatus.New),
Transaction_UID = Guid.NewGuid() Transaction_UID = Guid.CreateVersion7(DateTime.UtcNow)
}; };
_notaryoDBContext.Transactions.Add(newTransaction); _notaryoDBContext.Transactions.Add(newTransaction);
selfieEntity.Transaction = newTransaction; selfieEntity.Transaction = newTransaction;
_notaryoDBContext.SaveChanges(); _notaryoDBContext.SaveChanges();
return RedirectToPage($"/Principal/NotaryoSteps/UploadDocument/{newTransaction.Transaction_UID}"); return Redirect($"/Principal/NotaryoSteps/UploadDocument/{newTransaction.Transaction_UID}");
} }
ModelState.AddModelError("", "Face Verification Failed"); ModelState.AddModelError("", "Face Verification Failed");
} }

View File

@ -3,7 +3,6 @@ using EnotaryoPH.Data;
using EnotaryoPH.Data.Entities; using EnotaryoPH.Data.Entities;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
namespace EnotaryoPH.Web.Pages namespace EnotaryoPH.Web.Pages
{ {
@ -68,7 +67,7 @@ namespace EnotaryoPH.Web.Pages
Rollnumber = RollNumber, Rollnumber = RollNumber,
Status = "New", Status = "New",
CreatedOn = DateTime.UtcNow, CreatedOn = DateTime.UtcNow,
Lawyer_UID = Guid.NewGuid() Lawyer_UID = Guid.CreateVersion7(DateTime.UtcNow)
}; };
_notaryoDBContext.Lawyers.Add(newLawyer); _notaryoDBContext.Lawyers.Add(newLawyer);
} }