Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation: Part 4 #9

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.ProcessManagement.Notifications;
using EasyAbp.ProcessManagement.Processes;
using EasyAbp.ProcessManagement.ProcessStateHistories;
using EasyAbp.ProcessManagement.UserGroups;
Expand All @@ -18,6 +19,7 @@ public class DemoDataSeedContributor : IDataSeedContributor, ITransientDependenc
private readonly ProcessManager _processManager;
private readonly IProcessRepository _processRepository;
private readonly IProcessStateHistoryRepository _processStateHistoryRepository;
private readonly INotificationRepository _notificationRepository;
private readonly UserIdUserGroupContributor _userIdUserGroupContributor;

public DemoDataSeedContributor(
Expand All @@ -26,13 +28,15 @@ public DemoDataSeedContributor(
ProcessManager processManager,
IProcessRepository processRepository,
IProcessStateHistoryRepository processStateHistoryRepository,
INotificationRepository notificationRepository,
UserIdUserGroupContributor userIdUserGroupContributor)
{
_clock = clock;
_identityUserManager = identityUserManager;
_processManager = processManager;
_processRepository = processRepository;
_processStateHistoryRepository = processStateHistoryRepository;
_notificationRepository = notificationRepository;
_userIdUserGroupContributor = userIdUserGroupContributor;
}

Expand All @@ -49,6 +53,7 @@ protected virtual async Task SeedDemoProcessAsync(DataSeedContext context)
// delete all demo process entities.
await _processRepository.DeleteManyAsync(processes, true);
await _processStateHistoryRepository.DeleteAsync(x => processes.Select(y => y.Id).Contains(x.ProcessId));
await _notificationRepository.DeleteAsync(x => processes.Select(y => y.Id).Contains(x.ProcessId));

var adminUser = await _identityUserManager.FindByNameAsync("admin");
var now = _clock.Now;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,35 @@ protected override void Up(MigrationBuilder migrationBuilder)
table.PrimaryKey("PK_AbpUsers", x => x.Id);
});

migrationBuilder.CreateTable(
name: "EasyAbpProcessManagementNotifications",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ProcessId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Read = table.Column<bool>(type: "bit", nullable: false),
Dismissed = table.Column<bool>(type: "bit", nullable: false),
ProcessName = table.Column<string>(type: "nvarchar(max)", nullable: false),
CorrelationId = table.Column<string>(type: "nvarchar(max)", nullable: false),
GroupKey = table.Column<string>(type: "nvarchar(max)", nullable: false),
CompletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
StateUpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
StateName = table.Column<string>(type: "nvarchar(max)", nullable: false),
ActionName = table.Column<string>(type: "nvarchar(max)", nullable: true),
StateFlag = table.Column<int>(type: "int", nullable: false),
StateSummaryText = table.Column<string>(type: "nvarchar(max)", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EasyAbpProcessManagementNotifications", x => x.Id);
});

migrationBuilder.CreateTable(
name: "EasyAbpProcessManagementProcesses",
columns: table => new
Expand Down Expand Up @@ -422,6 +451,24 @@ protected override void Up(MigrationBuilder migrationBuilder)
table.PrimaryKey("PK_EasyAbpProcessManagementProcessStateHistories", x => x.Id);
});

migrationBuilder.CreateTable(
name: "EasyAbpProcessManagementUserGroups",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
GroupKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EasyAbpProcessManagementUserGroups", x => x.Id);
});

migrationBuilder.CreateTable(
name: "AbpAuditLogActions",
columns: table => new
Expand Down Expand Up @@ -875,6 +922,16 @@ protected override void Up(MigrationBuilder migrationBuilder)
table: "AbpUsers",
column: "UserName");

migrationBuilder.CreateIndex(
name: "IX_EasyAbpProcessManagementNotifications_CreationTime_UserId",
table: "EasyAbpProcessManagementNotifications",
columns: new[] { "CreationTime", "UserId" });

migrationBuilder.CreateIndex(
name: "IX_EasyAbpProcessManagementNotifications_ProcessId",
table: "EasyAbpProcessManagementNotifications",
column: "ProcessId");

migrationBuilder.CreateIndex(
name: "IX_EasyAbpProcessManagementProcesses_CorrelationId",
table: "EasyAbpProcessManagementProcesses",
Expand All @@ -889,6 +946,16 @@ protected override void Up(MigrationBuilder migrationBuilder)
name: "IX_EasyAbpProcessManagementProcessStateHistories_ProcessId_StateUpdateTime",
table: "EasyAbpProcessManagementProcessStateHistories",
columns: new[] { "ProcessId", "StateUpdateTime" });

migrationBuilder.CreateIndex(
name: "IX_EasyAbpProcessManagementUserGroups_GroupKey",
table: "EasyAbpProcessManagementUserGroups",
column: "GroupKey");

migrationBuilder.CreateIndex(
name: "IX_EasyAbpProcessManagementUserGroups_UserId",
table: "EasyAbpProcessManagementUserGroups",
column: "UserId");
}

/// <inheritdoc />
Expand Down Expand Up @@ -960,12 +1027,18 @@ protected override void Down(MigrationBuilder migrationBuilder)
migrationBuilder.DropTable(
name: "AbpUserTokens");

migrationBuilder.DropTable(
name: "EasyAbpProcessManagementNotifications");

migrationBuilder.DropTable(
name: "EasyAbpProcessManagementProcesses");

migrationBuilder.DropTable(
name: "EasyAbpProcessManagementProcessStateHistories");

migrationBuilder.DropTable(
name: "EasyAbpProcessManagementUserGroups");

migrationBuilder.DropTable(
name: "AbpEntityChanges");

Expand Down
Loading