WebAPI: layer type

This commit is contained in:
2023-07-04 20:07:46 +02:00
parent 58917f97e4
commit 0b5947dda5
6 changed files with 435 additions and 201 deletions

View File

@@ -9,13 +9,13 @@ import moment, { Moment } from 'moment';
}) })
export class NotificationsService { export class NotificationsService {
public messages: Message[] = []; public messages: IMessage[] = [];
private handler?: MatBottomSheetRef; private handler?: MatBottomSheetRef;
constructor( constructor(
private bottomSheet$: MatBottomSheet private bottomSheet$: MatBottomSheet
) { } ) { }
public add(message: Message): string { public add(message: IMessage): string {
message.id = uuidv4(); message.id = uuidv4();
message.createdAt = moment(); message.createdAt = moment();
this.messages.push(message); this.messages.push(message);
@@ -55,13 +55,13 @@ export class NotificationsService {
return a.createdAt && a.createdAt.isAfter(b.createdAt) ? 1 : -1; return a.createdAt && a.createdAt.isAfter(b.createdAt) ? 1 : -1;
}) })
} }
doAction(message: Message) { doAction(message: IMessage) {
if (message.action) { message.action(); } if (message.action) { message.action(); }
this.remove(message.id, false); this.remove(message.id, false);
} }
} }
interface Message { interface IMessage {
id?: string; id?: string;
text: string; text: string;
duration?: number; duration?: number;

View File

@@ -0,0 +1,201 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebAPI;
#nullable disable
namespace WebAPI.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20230626171614_LayerType")]
partial class LayerType
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2");
b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Number")
.HasColumnType("int");
b.Property<string>("Source")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ModifiedById");
b.ToTable("Layers");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier");
b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<Guid>("LayerId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2");
b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier");
b.Property<float>("Value")
.HasColumnType("real");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("LayerId");
b.HasIndex("ModifiedById");
b.ToTable("Records");
});
modelBuilder.Entity("WebAPI.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany()
.HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.Layer", null)
.WithMany("Records")
.HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany()
.HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
});
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Navigation("Records");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebAPI.Migrations
{
/// <inheritdoc />
public partial class LayerType : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Type",
table: "Layers",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Type",
table: "Layers");
}
}
}

View File

@@ -1,196 +1,198 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebAPI; using WebAPI;
#nullable disable #nullable disable
namespace WebAPI.Migrations namespace WebAPI.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot partial class AppDbContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.0") .HasAnnotation("ProductVersion", "7.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.Layer", b => modelBuilder.Entity("WebAPI.Models.Layer", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("Number") b.Property<int>("Number")
.IsRequired() .HasColumnType("int");
.HasColumnType("int");
b.Property<string>("Source")
b.Property<string>("Source") .IsRequired()
.IsRequired() .HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(max)");
b.Property<int>("Type")
b.HasKey("Id"); .HasColumnType("int");
b.HasIndex("CreatedById"); b.HasKey("Id");
b.HasIndex("ModifiedById"); b.HasIndex("CreatedById");
b.ToTable("Layers"); b.HasIndex("ModifiedById");
});
b.ToTable("Layers");
modelBuilder.Entity("WebAPI.Models.Record", b => });
{
b.Property<Guid>("Id") modelBuilder.Entity("WebAPI.Models.Record", b =>
.ValueGeneratedOnAdd() {
.HasColumnType("uniqueidentifier"); b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
b.Property<string>("Code") .HasColumnType("uniqueidentifier");
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("Code")
.IsRequired()
b.Property<DateTime>("CreatedAt") .HasColumnType("nvarchar(max)");
.HasColumnType("datetime2");
b.Property<DateTime>("CreatedAt")
b.Property<Guid>("CreatedById") .HasColumnType("datetime2");
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CreatedById")
b.Property<string>("Desc1") .HasColumnType("uniqueidentifier");
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc1")
b.Property<string>("Desc2") .HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc2")
b.Property<string>("Desc3") .HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc3")
b.Property<string>("Desc4") .HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc4")
b.Property<string>("Desc5") .HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc5")
b.Property<bool>("IsDeleted") .HasColumnType("nvarchar(max)");
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
b.Property<Guid>("LayerId") .HasColumnType("bit");
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LayerId")
b.Property<DateTime>("ModifiedAt") .HasColumnType("uniqueidentifier");
.HasColumnType("datetime2");
b.Property<DateTime>("ModifiedAt")
b.Property<Guid>("ModifiedById") .HasColumnType("datetime2");
.HasColumnType("uniqueidentifier");
b.Property<Guid>("ModifiedById")
b.Property<float>("Value") .HasColumnType("uniqueidentifier");
.HasColumnType("real");
b.Property<float>("Value")
b.HasKey("Id"); .HasColumnType("real");
b.HasIndex("CreatedById"); b.HasKey("Id");
b.HasIndex("LayerId"); b.HasIndex("CreatedById");
b.HasIndex("ModifiedById"); b.HasIndex("LayerId");
b.ToTable("Records"); b.HasIndex("ModifiedById");
});
b.ToTable("Records");
modelBuilder.Entity("WebAPI.Models.User", b => });
{
b.Property<Guid>("Id") modelBuilder.Entity("WebAPI.Models.User", b =>
.ValueGeneratedOnAdd() {
.HasColumnType("uniqueidentifier"); b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
b.Property<DateTime>("CreatedAt") .HasColumnType("uniqueidentifier");
.HasColumnType("datetime2");
b.Property<DateTime>("CreatedAt")
b.Property<string>("Email") .HasColumnType("datetime2");
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
b.Property<string>("UserName") .HasColumnType("nvarchar(max)");
.HasMaxLength(50)
.HasColumnType("nvarchar(50)"); b.Property<string>("UserName")
.HasMaxLength(50)
b.HasKey("Id"); .HasColumnType("nvarchar(50)");
b.ToTable("Users"); b.HasKey("Id");
});
b.ToTable("Users");
modelBuilder.Entity("WebAPI.Models.Layer", b => });
{
b.HasOne("WebAPI.Models.User", "CreatedBy") modelBuilder.Entity("WebAPI.Models.Layer", b =>
.WithMany() {
.HasForeignKey("CreatedById") b.HasOne("WebAPI.Models.User", "CreatedBy")
.OnDelete(DeleteBehavior.Cascade) .WithMany()
.IsRequired(); .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
b.HasOne("WebAPI.Models.User", "ModifiedBy") .IsRequired();
.WithMany()
.HasForeignKey("ModifiedById") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.OnDelete(DeleteBehavior.Cascade) .WithMany()
.IsRequired(); .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
b.Navigation("CreatedBy"); .IsRequired();
b.Navigation("ModifiedBy"); b.Navigation("CreatedBy");
});
b.Navigation("ModifiedBy");
modelBuilder.Entity("WebAPI.Models.Record", b => });
{
b.HasOne("WebAPI.Models.User", "CreatedBy") modelBuilder.Entity("WebAPI.Models.Record", b =>
.WithMany() {
.HasForeignKey("CreatedById") b.HasOne("WebAPI.Models.User", "CreatedBy")
.OnDelete(DeleteBehavior.Cascade) .WithMany()
.IsRequired(); .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
b.HasOne("WebAPI.Models.Layer", null) .IsRequired();
.WithMany("Records")
.HasForeignKey("LayerId") b.HasOne("WebAPI.Models.Layer", null)
.OnDelete(DeleteBehavior.Cascade) .WithMany("Records")
.IsRequired(); .HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade)
b.HasOne("WebAPI.Models.User", "ModifiedBy") .IsRequired();
.WithMany()
.HasForeignKey("ModifiedById") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.OnDelete(DeleteBehavior.Cascade) .WithMany()
.IsRequired(); .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
b.Navigation("CreatedBy"); .IsRequired();
b.Navigation("ModifiedBy"); b.Navigation("CreatedBy");
});
b.Navigation("ModifiedBy");
modelBuilder.Entity("WebAPI.Models.Layer", b => });
{
b.Navigation("Records"); modelBuilder.Entity("WebAPI.Models.Layer", b =>
}); {
#pragma warning restore 612, 618 b.Navigation("Records");
} });
} #pragma warning restore 612, 618
} }
}
}

View File

@@ -19,6 +19,8 @@ namespace WebAPI.Models
[Required] [Required]
public string? Name { get; set; } public string? Name { get; set; }
[Required] [Required]
public LayerType Type { get; set; }
[Required]
public DateTime CreatedAt { get; set; } public DateTime CreatedAt { get; set; }
[Required] [Required]
public DateTime ModifiedAt { get; set; } public DateTime ModifiedAt { get; set; }

View File

@@ -8,7 +8,7 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"SQLDatabase": "Server=tcp:127.0.0.1,1433;Initial Catalog=diuna;Persist Security Info=False;User ID=SA;Password=v](8Lc|RfG;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;" "SQLDatabase": "Server=tcp:127.0.0.1,1433;Initial Catalog=diunabi-dev;Persist Security Info=False;User ID=SA;Password=v](8Lc|RfG;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;"
}, },
"GoogleClientId": "107631825312-bkfe438ehr9k9ecb2h76g802tj6advma.apps.googleusercontent.com", "GoogleClientId": "107631825312-bkfe438ehr9k9ecb2h76g802tj6advma.apps.googleusercontent.com",
"Secret": "8393AF8EAEF8478CB738D44858690F9C7E2D19F65896DD9FBAA3EB2A6F493E80", "Secret": "8393AF8EAEF8478CB738D44858690F9C7E2D19F65896DD9FBAA3EB2A6F493E80",