Skip to content

Commit

Permalink
Updated with UxException
Browse files Browse the repository at this point in the history
  • Loading branch information
vivet committed Oct 23, 2024
1 parent dff389a commit 42721a7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Api/Nano.Template.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@
"Logging": {
"LogLevel": "Debug"
},
"WebApi": {
"Host": "nano-template-web",
"ServiceApi": {
"Host": "nano-template-service",
"Root": "api",
"Port": 8080,
"UseSsl": false,
Expand Down
2 changes: 2 additions & 0 deletions Service/Nano.Template.Service.Models/Data/Sample.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Nano.Models;
using Nano.Models.Attributes;

namespace Nano.Template.Service.Models.Data;

/// <summary>
/// Sample.
/// </summary>
[UxException("UX Sample Exception", [nameof(Name)])]
public class Sample : DefaultEntity
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Nano.Template.Service.Controllers;

/// <inheritdoc />
public class UsersController : DefaultIdentityController<User, UserQueryCriteria>
public class UsersController : BaseDefaultIdentityController<User, UserQueryCriteria>
{
/// <inheritdoc />
public UsersController(ILogger logger, IRepository repository, IEventing eventing, DefaultIdentityManager identityManager)
Expand Down
3 changes: 2 additions & 1 deletion Service/Nano.Template.Service/Data/Mappings/SampleMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public override void Map(EntityTypeBuilder<Sample> builder)
.IsRequired();

builder
.HasIndex(x => x.Name);
.HasIndex(x => x.Name)
.IsUnique();

builder
.Ignore(x => x.HasName);
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,10 @@ protected override void Up(MigrationBuilder migrationBuilder)
column: "IsDeleted");

migrationBuilder.CreateIndex(
name: "IX_Sample_Name",
name: "UX_Sample_Name_IsDeleted",
table: "Sample",
column: "Name");
columns: new[] { "Name", "IsDeleted" },
unique: true);

migrationBuilder.CreateIndex(
name: "IX_User_CreatedAt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasIndex("IsDeleted");

b.HasIndex("Name");
b.HasIndex("Name", "IsDeleted")
.IsUnique()
.HasDatabaseName("UX_Sample_Name_IsDeleted");

b.ToTable("Sample");

Expand Down

0 comments on commit 42721a7

Please sign in to comment.