Implement dynamic group management features with exclusions and mode handling
Enhanced the group management system by introducing dynamic group capabilities, allowing for the exclusion of elements from dynamic groups. Updated the Group and GroupItem models to support a new GroupMode, enabling the distinction between static and dynamic groups. Implemented API endpoints for excluding elements and updated related services to handle group composition based on the selected mode. Improved the frontend to accommodate these changes, including new API functions and UI components for managing exclusions and group modes, thereby enhancing the overall user experience in group management.
This commit is contained in:
+1399
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TeleWave.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class DynamicGroups : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Mode",
|
||||
table: "Groups",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0
|
||||
);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Role",
|
||||
table: "GroupItems",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0
|
||||
);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(name: "Mode", table: "Groups");
|
||||
|
||||
migrationBuilder.DropColumn(name: "Role", table: "GroupItems");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,6 +803,11 @@ namespace TeleWave.Infrastructure.Migrations
|
||||
b.Property<int>("ItemCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Mode")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
@@ -839,6 +844,11 @@ namespace TeleWave.Infrastructure.Migrations
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.Property<int>("Weight")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ public class GroupConfiguration : IEntityTypeConfiguration<Group>
|
||||
// Правило набора хранится как jsonb: схему знает Application, а домен передаёт строку как есть.
|
||||
builder.Property(x => x.FilterJson).HasColumnType("jsonb");
|
||||
|
||||
builder.Property(x => x.Mode).HasDefaultValue(GroupMode.Static);
|
||||
|
||||
builder
|
||||
.HasMany(x => x.Items)
|
||||
.WithOne()
|
||||
@@ -42,5 +44,9 @@ public class GroupItemConfiguration : IEntityTypeConfiguration<GroupItem>
|
||||
// По этому индексу чистятся позиции при удалении шоу/коллекции: внешнего ключа на
|
||||
// полиморфную ссылку нет, удаление идёт командой.
|
||||
builder.HasIndex(x => new { x.ElementKind, x.ElementId });
|
||||
|
||||
// Роль читается при каждом развороте динамической группы — отдельным индексом не выделяем,
|
||||
// выборка всегда идёт по группе целиком.
|
||||
builder.Property(x => x.Role).HasDefaultValue(GroupItemRole.Member);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user