forked from ardalis/CleanArchitecture
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example value object for phone number
- Loading branch information
Showing
22 changed files
with
240 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
72 changes: 72 additions & 0 deletions
72
src/Clean.Architecture.Infrastructure/Data/Migrations/20231218143922_PhoneNumber.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
src/Clean.Architecture.Infrastructure/Data/Migrations/20231218143922_PhoneNumber.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 Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Clean.Architecture.Infrastructure.Data.Migrations; | ||
|
||
/// <inheritdoc /> | ||
public partial class PhoneNumber : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Contributors", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(type: "INTEGER", nullable: false) | ||
.Annotation("Sqlite:Autoincrement", true), | ||
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false), | ||
Status = table.Column<int>(type: "INTEGER", nullable: false), | ||
PhoneNumber_CountryCode = table.Column<string>(type: "TEXT", nullable: true), | ||
PhoneNumber_Number = table.Column<string>(type: "TEXT", nullable: true), | ||
PhoneNumber_Extension = table.Column<string>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Contributors", x => x.Id); | ||
}); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Contributors"); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/Clean.Architecture.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.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,69 @@ | ||
// <auto-generated /> | ||
using Clean.Architecture.Infrastructure.Data; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
|
||
#nullable disable | ||
|
||
namespace Clean.Architecture.Infrastructure.Data.Migrations | ||
{ | ||
[DbContext(typeof(AppDbContext))] | ||
partial class AppDbContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
#pragma warning disable 612, 618 | ||
modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); | ||
|
||
modelBuilder.Entity("Clean.Architecture.Core.ContributorAggregate.Contributor", b => | ||
{ | ||
b.Property<int>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("INTEGER"); | ||
|
||
b.Property<string>("Name") | ||
.IsRequired() | ||
.HasMaxLength(100) | ||
.HasColumnType("TEXT"); | ||
|
||
b.Property<int>("Status") | ||
.HasColumnType("INTEGER"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.ToTable("Contributors"); | ||
}); | ||
|
||
modelBuilder.Entity("Clean.Architecture.Core.ContributorAggregate.Contributor", b => | ||
{ | ||
b.OwnsOne("Clean.Architecture.Core.ContributorAggregate.PhoneNumber", "PhoneNumber", b1 => | ||
{ | ||
b1.Property<int>("ContributorId") | ||
.HasColumnType("INTEGER"); | ||
|
||
b1.Property<string>("CountryCode") | ||
.IsRequired() | ||
.HasColumnType("TEXT"); | ||
|
||
b1.Property<string>("Extension") | ||
.HasColumnType("TEXT"); | ||
|
||
b1.Property<string>("Number") | ||
.IsRequired() | ||
.HasColumnType("TEXT"); | ||
|
||
b1.HasKey("ContributorId"); | ||
|
||
b1.ToTable("Contributors"); | ||
|
||
b1.WithOwner() | ||
.HasForeignKey("ContributorId"); | ||
}); | ||
|
||
b.Navigation("PhoneNumber"); | ||
}); | ||
#pragma warning restore 612, 618 | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
namespace Clean.Architecture.UseCases.Contributors; | ||
public record ContributorDTO(int Id, string Name); | ||
public record ContributorDTO(int Id, string Name, string PhoneNumber); |
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
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace Clean.Architecture.Web.ContributorEndpoints; | ||
|
||
public record ContributorRecord(int Id, string Name); | ||
public record ContributorRecord(int Id, string Name, string PhoneNumber); |
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
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
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
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
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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ GET http://{{hostname}}:{{port}}/Contributors | |
### | ||
|
||
// Get a specific contributor | ||
@id_to_get=1 | ||
@id_to_get=8 | ||
GET http://{{hostname}}:{{port}}/Contributors/{{id_to_get}} | ||
|
||
### | ||
|
@@ -18,8 +18,9 @@ POST http://{{hostname}}:{{port}}/Contributors | |
Content-Type: application/json | ||
|
||
{ | ||
"name": "John Doe", | ||
"email": "[email protected]" | ||
"name": "John Doe 2", | ||
"email": "[email protected]", | ||
"phoneNumber": "1234567890" | ||
} | ||
|
||
### | ||
|
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