Skip to content

Commit

Permalink
Support for actions and events
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-YousefiTelori committed Jan 12, 2024
1 parent aafe88b commit 841da6a
Show file tree
Hide file tree
Showing 34 changed files with 4,787 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using EasyMicroservices.Cores.Relational.EntityFrameworkCore.Intrerfaces;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
using Microsoft.EntityFrameworkCore;
using System;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Contexts
{
Expand All @@ -18,7 +19,13 @@ public TemplateGeneratorContext(IEntityFrameworkCoreDatabaseBuilder builder) : b
public DbSet<FormItemEntity> FormItems { get; set; }
public DbSet<FormItemValueEntity> FormItemValues { get; set; }
public DbSet<ItemTypeEntity> ItemTypes { get; set; }

public DbSet<EventEntity> Events { get; set; }
public DbSet<ActionEntity> Actions { get; set; }
public DbSet<FormItemEventEntity> FormItemEvents { get; set; }
public DbSet<FormItemEventActionEntity> FormItemEventActions { get; set; }
public DbSet<FormItemEventActionExecutionEntity> FormItemEventActionCallHistories { get; set; }
public DbSet<FormItemActionJobEntity> FormItemActionJobs { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
Expand Down Expand Up @@ -149,6 +156,64 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
Title = "AutoIncrementNumber",
Type = DataTypes.ItemType.AutoIncrementNumber
});

modelBuilder.Entity<EventEntity>().HasData(
new EventEntity()
{
Id = 1,
CreationDateTime = DateTime.Now,
Name = "Click"
},
new EventEntity()
{
Id = 2,
CreationDateTime = DateTime.Now,
Name = "TextChanged"
},
new EventEntity()
{
Id = 3,
CreationDateTime = DateTime.Now,
Name = "ItemSelected"
});

modelBuilder.Entity<ActionEntity>().HasData(
new ActionEntity()
{
Id = 1,
CreationDateTime = DateTime.Now,
JobName = "OpenDialog"
},
new ActionEntity()
{
Id = 2,
CreationDateTime = DateTime.Now,
JobName = "OpenResponsibleDialog"
},
new ActionEntity()
{
Id = 3,
CreationDateTime = DateTime.Now,
JobName = "OpenPage"
},
new ActionEntity()
{
Id = 4,
CreationDateTime = DateTime.Now,
JobName = "CallExternalApi"
},
new ActionEntity()
{
Id = 5,
CreationDateTime = DateTime.Now,
JobName = "SendResult"
},
new ActionEntity()
{
Id = 6,
CreationDateTime = DateTime.Now,
JobName = "Close"
});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using EasyMicroservices.Cores.Interfaces;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;
using System.Collections.Generic;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
public class ActionEntity : ActionSchema, IIdSchema<long>
{
public long Id { get; set; }

public long? ParentId { get; set; }
public ActionEntity Parent { get; set; }

public ICollection<ActionEntity> Children { get; set; }

public ICollection<FormItemEventActionEntity> FormItemEventActions { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using EasyMicroservices.Cores.Interfaces;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;
using System.Collections.Generic;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
public class EventEntity : EventSchema, IIdSchema<long>
{
public long Id { get; set; }
public ICollection<FormItemEventEntity> FormItemEvents { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using EasyMicroservices.Cores.Database.Schemas;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;

/// <summary>
/// do the action on this formItem
/// </summary>
public class FormItemActionJobEntity : FullAbilityIdSchema<long>
{
public long ActionId { get; set; }
public ActionEntity Action { get; set; }

public long FormItemId { get; set; }
public FormItemEntity FormItem { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using EasyMicroservices.Cores.Interfaces;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;
using System.Collections.Generic;

Expand All @@ -23,5 +24,7 @@ public class FormItemEntity : ItemSchema, IIdSchema<long>
public ICollection<FormItemEntity> PrimaryFormItems { get; set; }

public ICollection<FormItemValueEntity> FormItemValues { get; set; }
public ICollection<FormItemEventEntity> FormItemEvents { get; set; }
public ICollection<FormItemActionJobEntity> FormItemActionJobs { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using EasyMicroservices.Cores.Database.Schemas;
using System.Collections.Generic;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
public class FormItemEventActionEntity : FullAbilityIdSchema<long>
{
public long FormItemEventId { get; set; }
public long ActionId { get; set; }
public long? FormItemId { get; set; }
public long? ParentId { get; set; }

public int OrderIndex { get; set; }

public FormItemEntity FormItem { get; set; }
public FormItemEventEntity FormItemEvent { get; set; }
public ActionEntity Action { get; set; }

public ICollection<FormItemEventActionEntity> Children { get; set; }
public ICollection<FormItemEventActionExecutionEntity> FormItemEventActionCallHistories { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using EasyMicroservices.Cores.Interfaces;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
public class FormItemEventActionExecutionEntity : FormItemEventActionExecutionSchema, IIdSchema<long>
{
public long Id { get; set; }
public long FormItemEventActionId { get; set; }

public FormItemEventActionEntity FormItemEventAction { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using EasyMicroservices.Cores.Database.Schemas;
using System.Collections.Generic;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
public class FormItemEventEntity : FullAbilityIdSchema<long>
{
public long? FormItemId { get; set; }
public long EventId { get; set; }

public FormItemEntity FormItem { get; set; }
public EventEntity Event { get; set; }

public ICollection<FormItemEventActionEntity> FormItemEventActions { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using EasyMicroservices.Cores.Database.Schemas;
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Entities;
using System.Collections.Generic;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;
public class ActionSchema : FullAbilitySchema
{
public string JobName { get; set; }
public int OrderIndex { get; set; }

public ICollection<FormItemActionJobEntity> FormItemActionJobs { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using EasyMicroservices.Cores.Database.Schemas;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;
public class EventSchema : FullAbilitySchema
{
public string Name { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using EasyMicroservices.Cores.Database.Schemas;
using EasyMicroservices.TemplateGeneratorMicroservice.DataTypes;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas;
public class FormItemEventActionExecutionSchema : FullAbilitySchema
{
public string RequestJson { get; set; }
public string ResponseJson { get; set; }

public ActionExecutionStatusType Status { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using EasyMicroservices.Cores.Database.Schemas;
using EasyMicroservices.Cores.Interfaces;
using System;

namespace EasyMicroservices.TemplateGeneratorMicroservice.Database.Schemas
{
Expand All @@ -9,5 +7,6 @@ public class ItemSchema : FullAbilitySchema
public string Title { get; set; }
public string DefaultValue { get; set; }
public int Index { get; set; }
public string LocalVariableName { get; set; }
}
}
Loading

0 comments on commit 841da6a

Please sign in to comment.