Action logs

This commit is contained in:
2025-05-16 01:41:24 +08:00
parent 6358c49090
commit aabe8269f5
16 changed files with 4036 additions and 52 deletions

View File

@ -7,9 +7,11 @@ using DysonNetwork.Sphere.Account;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NetTopologySuite.Geometries;
using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using NpgsqlTypes;
using Point = NetTopologySuite.Geometries.Point;
#nullable disable
@ -25,6 +27,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b =>
@ -169,6 +172,70 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("account_contacts", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("AccountId")
.HasColumnType("uuid")
.HasColumnName("account_id");
b.Property<string>("Action")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("action");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<string>("IpAddress")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasColumnName("ip_address");
b.Property<Point>("Location")
.HasColumnType("geometry")
.HasColumnName("location");
b.Property<Dictionary<string, object>>("Meta")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("meta");
b.Property<Guid?>("SessionId")
.HasColumnType("uuid")
.HasColumnName("session_id");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("UserAgent")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasColumnName("user_agent");
b.HasKey("Id")
.HasName("pk_action_logs");
b.HasIndex("AccountId")
.HasDatabaseName("ix_action_logs_account_id");
b.HasIndex("SessionId")
.HasDatabaseName("ix_action_logs_session_id");
b.ToTable("action_logs", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b =>
{
b.Property<Guid>("Id")
@ -714,6 +781,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)")
.HasColumnName("ip_address");
b.Property<Point>("Location")
.HasColumnType("geometry")
.HasColumnName("location");
b.Property<string>("Nonce")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
@ -2485,6 +2556,25 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Account");
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
.WithMany()
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_action_logs_accounts_account_id");
b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session")
.WithMany()
.HasForeignKey("SessionId")
.HasConstraintName("fk_action_logs_auth_sessions_session_id");
b.Navigation("Account");
b.Navigation("Session");
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")