Magic spell for one time code

🗑️ Drop the usage of casbin
♻️ Refactor the permission service
♻️ Refactor the flow of creating an account
🧱 Email infra structure
This commit is contained in:
2025-04-29 20:37:10 +08:00
parent 82288fa52c
commit 0ebeab672b
35 changed files with 1789 additions and 5214 deletions

View File

@ -1,6 +1,7 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using System.Text.Json;
using DysonNetwork.Sphere;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@ -33,6 +34,10 @@ namespace DysonNetwork.Sphere.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant?>("ActivatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("activated_at");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
@ -167,6 +172,65 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("account_contacts", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<long?>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property<Instant?>("AffectedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("affected_at");
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<Instant?>("ExpiresAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expires_at");
b.Property<Dictionary<string, object>>("Meta")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("meta");
b.Property<string>("Spell")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("spell");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_magic_spells");
b.HasIndex("AccountId")
.HasDatabaseName("ix_magic_spells_account_id");
b.HasIndex("Spell")
.IsUnique()
.HasDatabaseName("ix_magic_spells_spell");
b.ToTable("magic_spells", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b =>
{
b.Property<Guid>("Id")
@ -427,6 +491,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property<int>("FailedAttempts")
.HasColumnType("integer")
.HasColumnName("failed_attempts");
b.Property<string>("IpAddress")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
@ -552,9 +620,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("group_id");
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property<string>("Actor")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("actor");
b.Property<Instant?>("AffectedAt")
.HasColumnType("timestamp with time zone")
@ -576,13 +645,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("GroupId", "AccountId")
.HasName("pk_permission_group_member");
b.HasKey("GroupId", "Actor")
.HasName("pk_permission_group_members");
b.HasIndex("AccountId")
.HasDatabaseName("ix_permission_group_member_account_id");
b.ToTable("permission_group_member", (string)null);
b.ToTable("permission_group_members", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b =>
@ -630,15 +696,11 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(1024)")
.HasColumnName("key");
b.Property<Guid?>("PermissionGroupId")
.HasColumnType("uuid")
.HasColumnName("permission_group_id");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<object>("Value")
b.Property<JsonDocument>("Value")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("value");
@ -649,9 +711,6 @@ namespace DysonNetwork.Sphere.Migrations
b.HasIndex("GroupId")
.HasDatabaseName("ix_permission_nodes_group_id");
b.HasIndex("PermissionGroupId")
.HasDatabaseName("ix_permission_nodes_permission_group_id");
b.HasIndex("Key", "Area", "Actor")
.HasDatabaseName("ix_permission_nodes_key_area_actor");
@ -1228,6 +1287,16 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Account");
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
.WithMany()
.HasForeignKey("AccountId")
.HasConstraintName("fk_magic_spells_accounts_account_id");
b.Navigation("Account");
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
@ -1334,36 +1403,22 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b =>
{
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
.WithMany("GroupMemberships")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_permission_group_member_accounts_account_id");
b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group")
.WithMany("Members")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_permission_group_member_permission_groups_group_id");
b.Navigation("Account");
.HasConstraintName("fk_permission_group_members_permission_groups_group_id");
b.Navigation("Group");
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b =>
{
b.HasOne("DysonNetwork.Sphere.Permission.PermissionNode", "Group")
.WithMany()
.HasForeignKey("GroupId")
.HasConstraintName("fk_permission_nodes_permission_nodes_group_id");
b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", null)
b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group")
.WithMany("Nodes")
.HasForeignKey("PermissionGroupId")
.HasConstraintName("fk_permission_nodes_permission_groups_permission_group_id");
.HasForeignKey("GroupId")
.HasConstraintName("fk_permission_nodes_permission_groups_group_id");
b.Navigation("Group");
});
@ -1557,8 +1612,6 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Contacts");
b.Navigation("GroupMemberships");
b.Navigation("IncomingRelationships");
b.Navigation("OutgoingRelationships");