optimization update, web scheduler test-integration
This commit is contained in:
parent
3c9ccaafeb
commit
1591618c2c
103 changed files with 4826 additions and 1502 deletions
|
|
@ -6,11 +6,12 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>Insight.Domain</RootNamespace>
|
||||
<Product>Insight</Product>
|
||||
<AssemblyVersion>2023.11.17.0</AssemblyVersion>
|
||||
<AssemblyVersion>2023.12.14.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Vaitr.Network" Version="2023.10.22" />
|
||||
<PackageReference Include="Vaitr.Bus" Version="2023.12.13" />
|
||||
<PackageReference Include="Vaitr.Network" Version="2023.12.14" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
|
|
|||
43
src/Core/Insight.Infrastructure/Entities/Scheduler/Job.cs
Normal file
43
src/Core/Insight.Infrastructure/Entities/Scheduler/Job.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Json.Serialization;
|
||||
using Vaitr.Scheduler;
|
||||
|
||||
namespace Insight.Infrastructure.Entities;
|
||||
|
||||
public static partial class MongoDatabaseExtensions
|
||||
{
|
||||
public static IMongoCollection<JobEntity> Job(this IMongoDatabase database) => database.GetCollection<JobEntity>("job");
|
||||
}
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class JobEntity
|
||||
{
|
||||
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("insert")]
|
||||
public DateTime? Insert { get; set; }
|
||||
|
||||
[BsonElement("update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
[BsonElement("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[BsonElement("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[BsonElement("state"), BsonRepresentation(BsonType.String)]
|
||||
public TaskState State { get; set; }
|
||||
|
||||
[BsonElement("timeout")]
|
||||
public TimeSpan Timeout { get; set; }
|
||||
|
||||
[BsonElement("executed")]
|
||||
public DateTime Executed { get; set; }
|
||||
|
||||
[BsonElement("disabled")]
|
||||
public bool Disabled { get; set; }
|
||||
}
|
||||
38
src/Core/Insight.Infrastructure/Entities/Scheduler/JobLog.cs
Normal file
38
src/Core/Insight.Infrastructure/Entities/Scheduler/JobLog.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Json.Serialization;
|
||||
using Vaitr.Scheduler;
|
||||
using static Insight.Infrastructure.Entities.TriggerEntity;
|
||||
|
||||
namespace Insight.Infrastructure.Entities;
|
||||
|
||||
public static partial class MongoDatabaseExtensions
|
||||
{
|
||||
public static IMongoCollection<AgentLogEntity> JobLog(this IMongoDatabase database) => database.GetCollection<AgentLogEntity>("job_log");
|
||||
}
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class JobLogEntity
|
||||
{
|
||||
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("_job"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("job")]
|
||||
public string? Job { get; set; }
|
||||
|
||||
[BsonElement("insert")]
|
||||
public DateTime? Insert { get; set; }
|
||||
|
||||
[BsonElement("timestamp")]
|
||||
public DateTime? Timestamp { get; set; }
|
||||
|
||||
[BsonElement("status"), BsonRepresentation(BsonType.String)]
|
||||
public TaskState? Status { get; set; }
|
||||
|
||||
[BsonElement("mode"), BsonRepresentation(BsonType.String)]
|
||||
public ScheduleMode? Mode { get; set; }
|
||||
|
||||
[BsonElement("message")]
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Insight.Infrastructure.Entities;
|
||||
|
||||
public static partial class MongoDatabaseExtensions
|
||||
{
|
||||
public static IMongoCollection<JobTaskEntity> JobTask(this IMongoDatabase database) => database.GetCollection<JobTaskEntity>("job_task");
|
||||
}
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class JobTaskEntity
|
||||
{
|
||||
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("_job"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("job")]
|
||||
public string? Job { get; set; }
|
||||
|
||||
[BsonElement("_task"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("task")]
|
||||
public string? Task { get; set; }
|
||||
|
||||
[BsonElement("insert")]
|
||||
public DateTime? Insert { get; set; }
|
||||
|
||||
[BsonElement("update")]
|
||||
public DateTime? Update { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Insight.Infrastructure.Entities;
|
||||
|
||||
public static partial class MongoDatabaseExtensions
|
||||
{
|
||||
public static IMongoCollection<JobTriggerEntity> JobTrigger(this IMongoDatabase database) => database.GetCollection<JobTriggerEntity>("job_trigger");
|
||||
}
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class JobTriggerEntity
|
||||
{
|
||||
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("_job"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("job")]
|
||||
public string? Job { get; set; }
|
||||
|
||||
[BsonElement("_trigger"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("trigger")]
|
||||
public string? Trigger { get; set; }
|
||||
|
||||
[BsonElement("insert")]
|
||||
public DateTime? Insert { get; set; }
|
||||
|
||||
[BsonElement("update")]
|
||||
public DateTime? Update { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Insight.Infrastructure.Entities;
|
||||
|
||||
public static partial class MongoDatabaseExtensions
|
||||
{
|
||||
public static IMongoCollection<TaskEntity> Task(this IMongoDatabase database) => database.GetCollection<TaskEntity>("task");
|
||||
}
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class TaskEntity
|
||||
{
|
||||
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("insert")]
|
||||
public DateTime? Insert { get; set; }
|
||||
|
||||
[BsonElement("update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
[BsonElement("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[BsonElement("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[BsonIgnore]
|
||||
public Func<CancellationToken, Task>? Action { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Insight.Infrastructure.Entities;
|
||||
|
||||
public static partial class MongoDatabaseExtensions
|
||||
{
|
||||
public static IMongoCollection<TriggerEntity> Trigger(this IMongoDatabase database) => database.GetCollection<TriggerEntity>("trigger");
|
||||
}
|
||||
|
||||
public class TriggerEntity
|
||||
{
|
||||
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("insert")]
|
||||
public DateTime? Insert { get; set; }
|
||||
|
||||
[BsonElement("update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
[BsonElement("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[BsonElement("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[BsonElement("mode")]
|
||||
public ScheduleMode Mode { get; set; }
|
||||
|
||||
[BsonElement("date_start")]
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
[BsonElement("date_end")]
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
[BsonElement("interval")]
|
||||
public TimeSpan? Interval { get; set; }
|
||||
|
||||
public enum ScheduleMode
|
||||
{
|
||||
Single, Loop
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RootNamespace>Insight.Infrastructure</RootNamespace>
|
||||
<Product>Insight</Product>
|
||||
<AssemblyVersion>2023.11.17.0</AssemblyVersion>
|
||||
<AssemblyVersion>2023.12.14.0</AssemblyVersion>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
|
@ -19,9 +19,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.13" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.22.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.23.0" />
|
||||
<PackageReference Include="AspNetCore.Identity.MongoDbCore" Version="3.1.2" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
||||
<PackageReference Include="Vaitr.Scheduler" Version="2023.12.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue