Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nox.Generators] CreateEntityDto and UpdateEntityDto Required fields#455 #513

Merged
merged 1 commit into from
Aug 16, 2023
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
4 changes: 4 additions & 0 deletions src/Nox.Generator/Application/Dto/EntityUpdateDto.template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace {{codeGeneratorState.ApplicationNameSpace }}.Dto;

Expand All @@ -18,6 +19,9 @@ public partial class {{className}}
/// <summary>
/// {{attribute.Description}} ({{if attribute.IsRequired}}Required{{else}}Optional{{end}}).
/// </summary>
{{- if attribute.IsRequired}}
[Required(ErrorMessage = "{{attribute.Name}} is required")]
{{ end}}
{{ if componentsInfo[attribute.Name].IsSimpleType -}}
public {{componentsInfo[attribute.Name].ComponentType}}{{ if !attribute.IsRequired}}?{{end}} {{attribute.Name}} { get; set; } {{if attribute.IsRequired}}= default!;{{end}}
{{- else -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SampleWebApp.Application.Dto;

Expand All @@ -25,10 +26,14 @@ public partial class AllNoxTypeUpdateDto
/// <summary>
/// CountryCode2 Nox Type (Required).
/// </summary>
[Required(ErrorMessage = "CountryCode2Field is required")]

public System.String CountryCode2Field { get; set; } = default!;
/// <summary>
/// CountryCode3 Nox Type (Required).
/// </summary>
[Required(ErrorMessage = "CountryCode3Field is required")]

public System.String CountryCode3Field { get; set; } = default!;
/// <summary>
/// CountryNumber Nox Type (Optional).
Expand Down Expand Up @@ -81,6 +86,8 @@ public partial class AllNoxTypeUpdateDto
/// <summary>
/// Text Nox Type (Required).
/// </summary>
[Required(ErrorMessage = "TextField is required")]

public System.String TextField { get; set; } = default!;
/// <summary>
/// StreetAddress Nox Type (Optional).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SampleWebApp.Application.Dto;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SampleWebApp.Application.Dto;

Expand All @@ -17,22 +18,32 @@ public partial class CountryUpdateDto
/// <summary>
/// The country's common name (Required).
/// </summary>
[Required(ErrorMessage = "Name is required")]

public System.String Name { get; set; } = default!;
/// <summary>
/// The country's official name (Required).
/// </summary>
[Required(ErrorMessage = "FormalName is required")]

public System.String FormalName { get; set; } = default!;
/// <summary>
/// The country's official ISO 4217 alpha-3 code (Required).
/// </summary>
[Required(ErrorMessage = "AlphaCode3 is required")]

public System.String AlphaCode3 { get; set; } = default!;
/// <summary>
/// The country's official ISO 4217 alpha-2 code (Required).
/// </summary>
[Required(ErrorMessage = "AlphaCode2 is required")]

public System.String AlphaCode2 { get; set; } = default!;
/// <summary>
/// The country's official ISO 4217 alpha-3 code (Required).
/// </summary>
[Required(ErrorMessage = "NumericCode is required")]

public System.Int16 NumericCode { get; set; } = default!;
/// <summary>
/// The country's phone dialing codes (comma-delimited) (Optional).
Expand All @@ -49,6 +60,8 @@ public partial class CountryUpdateDto
/// <summary>
/// Country area in square kilometers (Required).
/// </summary>
[Required(ErrorMessage = "AreaInSquareKilometres is required")]

public System.Decimal AreaInSquareKilometres { get; set; } = default!;
/// <summary>
/// The the position of the workplace's point on the surface of the Earth (Optional).
Expand All @@ -57,14 +70,20 @@ public partial class CountryUpdateDto
/// <summary>
/// The region the country is in (Required).
/// </summary>
[Required(ErrorMessage = "GeoRegion is required")]

public System.String GeoRegion { get; set; } = default!;
/// <summary>
/// The sub-region the country is in (Required).
/// </summary>
[Required(ErrorMessage = "GeoSubRegion is required")]

public System.String GeoSubRegion { get; set; } = default!;
/// <summary>
/// The world region the country is in (Required).
/// </summary>
[Required(ErrorMessage = "GeoWorldRegion is required")]

public System.String GeoWorldRegion { get; set; } = default!;
/// <summary>
/// The estimated population of the country (Optional).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SampleWebApp.Application.Dto;

Expand All @@ -17,5 +18,7 @@ public partial class CurrencyUpdateDto
/// <summary>
/// The currency's name (Required).
/// </summary>
[Required(ErrorMessage = "Name is required")]

public System.String Name { get; set; } = default!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SampleWebApp.Application.Dto;

Expand All @@ -17,9 +18,13 @@ public partial class StoreSecurityPasswordsUpdateDto
/// <summary>
/// (Required).
/// </summary>
[Required(ErrorMessage = "Name is required")]

public System.String Name { get; set; } = default!;
/// <summary>
/// (Required).
/// </summary>
[Required(ErrorMessage = "SecurityCamerasPassword is required")]

public System.String SecurityCamerasPassword { get; set; } = default!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nox.Abstractions;
using Nox.Types;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SampleWebApp.Application.Dto;

Expand All @@ -17,9 +18,13 @@ public partial class StoreUpdateDto
/// <summary>
/// Store Name (Required).
/// </summary>
[Required(ErrorMessage = "Name is required")]

public System.String Name { get; set; } = default!;
/// <summary>
/// Physical Money in the Physical Store (Required).
/// </summary>
[Required(ErrorMessage = "PhysicalMoney is required")]

public MoneyDto PhysicalMoney { get; set; } = default!;
}