Merge pull request '#24225635 Поля "Email" и "Телефон" формы создания контактов - необязательны к заполнению' (#153) from fix/#24225635-contacts-inputs-rewrite-3 into dev

Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/153
This commit is contained in:
Никита Фролов 2023-11-16 10:28:04 +05:00
commit 8f2208cac6
5 changed files with 8963 additions and 8 deletions

View File

@ -34,16 +34,14 @@ namespace AsbCloudApp.Data.User
/// <summary> /// <summary>
/// Email /// Email
/// </summary> /// </summary>
[Required]
[RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Некорректный email")] [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Некорректный email")]
public string Email { get; set; } = null!; public string? Email { get; set; }
/// <summary> /// <summary>
/// Phone /// Phone
/// </summary> /// </summary>
[Required]
[RegularExpression(@"^(?:\+7|8)\s?(?:\(\d{3}\)|\d{3})\s?\d{3}-?\d{2}-?\d{2}$", ErrorMessage = "Некорректный номер телефона")] [RegularExpression(@"^(?:\+7|8)\s?(?:\(\d{3}\)|\d{3})\s?\d{3}-?\d{2}-?\d{2}$", ErrorMessage = "Некорректный номер телефона")]
public string Phone { get; set; } = null!; public string? Phone { get; set; }
/// <summary> /// <summary>
/// Должность /// Должность

View File

@ -0,0 +1,67 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class UpdateTable_t_contact_Set_Email_and_Phone_Nullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "phone",
table: "t_contact",
type: "character varying(50)",
maxLength: 50,
nullable: true,
comment: "номер телефона",
oldClrType: typeof(string),
oldType: "character varying(50)",
oldMaxLength: 50,
oldComment: "номер телефона");
migrationBuilder.AlterColumn<string>(
name: "email",
table: "t_contact",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "email",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldComment: "email");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "phone",
table: "t_contact",
type: "character varying(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "номер телефона",
oldClrType: typeof(string),
oldType: "character varying(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "номер телефона");
migrationBuilder.AlterColumn<string>(
name: "email",
table: "t_contact",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
comment: "email",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true,
oldComment: "email");
}
}
}

View File

@ -214,7 +214,6 @@ namespace AsbCloudDb.Migrations
.HasComment("компания"); .HasComment("компания");
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)") .HasColumnType("character varying(255)")
.HasColumnName("email") .HasColumnName("email")
@ -240,7 +239,6 @@ namespace AsbCloudDb.Migrations
.HasComment("ключ скважины"); .HasComment("ключ скважины");
b.Property<string>("Phone") b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("character varying(50)") .HasColumnType("character varying(50)")
.HasColumnName("phone") .HasColumnName("phone")

View File

@ -26,11 +26,11 @@ namespace AsbCloudDb.Model
[Column("email"), Comment("email")] [Column("email"), Comment("email")]
[StringLength(255)] [StringLength(255)]
public string Email { get; set; } = string.Empty; public string? Email { get; set; }
[Column("phone"), Comment("номер телефона")] [Column("phone"), Comment("номер телефона")]
[StringLength(50)] [StringLength(50)]
public string Phone { get; set; } = string.Empty; public string? Phone { get; set; }
[Column("position"), Comment("должность")] [Column("position"), Comment("должность")]
[StringLength(255)] [StringLength(255)]