реализация методов ChangeLogService
This commit is contained in:
parent
3b4af1fd8d
commit
032d783d40
@ -14,15 +14,19 @@ namespace DD.Persistence.API.Controllers;
|
|||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class ChangeLogController : ControllerBase, IChangeLogApi
|
public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||||
{
|
{
|
||||||
|
private readonly IChangeLogRepository repository;
|
||||||
|
|
||||||
public ChangeLogService service { get; }
|
public ChangeLogService service { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="service"></param>
|
/// <param name="service"></param>
|
||||||
public ChangeLogController(ChangeLogService service)
|
/// <param name="repository"></param>
|
||||||
|
public ChangeLogController(ChangeLogService service, IChangeLogRepository repository)
|
||||||
{
|
{
|
||||||
this.service = service;
|
this.service = service;
|
||||||
|
this.repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("{idDiscriminator}")]
|
[HttpPost("{idDiscriminator}")]
|
||||||
@ -36,7 +40,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
//var userId = User.GetUserId<Guid>();
|
//var userId = User.GetUserId<Guid>();
|
||||||
var userId = Guid.NewGuid();
|
var userId = Guid.NewGuid();
|
||||||
var changeLogCommit = new ChangeLogCommitDto(userId, comment, [dto]);
|
var changeLogCommit = new ChangeLogCommitDto(userId, comment, [dto]);
|
||||||
var result = await service.(idDiscriminator, changeLogCommit, token);
|
var result = await service.AddRange(idDiscriminator, changeLogCommit, token);
|
||||||
|
|
||||||
return CreatedAtAction(nameof(Add), result);
|
return CreatedAtAction(nameof(Add), result);
|
||||||
}
|
}
|
||||||
@ -52,7 +56,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
//var userId = User.GetUserId<Guid>();
|
//var userId = User.GetUserId<Guid>();
|
||||||
var userId = Guid.NewGuid();
|
var userId = Guid.NewGuid();
|
||||||
var changeLogCommit = new ChangeLogCommitDto(userId, comment, dtos);
|
var changeLogCommit = new ChangeLogCommitDto(userId, comment, dtos);
|
||||||
var result = await repository.AddRange(idDiscriminator, changeLogCommit, token);
|
var result = await service.AddRange(idDiscriminator, changeLogCommit, token);
|
||||||
|
|
||||||
return CreatedAtAction(nameof(AddRange), result);
|
return CreatedAtAction(nameof(AddRange), result);
|
||||||
}
|
}
|
||||||
@ -62,7 +66,13 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
public async Task<IActionResult> Delete(Guid id, string comment, CancellationToken token)
|
public async Task<IActionResult> Delete(Guid id, string comment, CancellationToken token)
|
||||||
{
|
{
|
||||||
var userId = User.GetUserId<Guid>();
|
var userId = User.GetUserId<Guid>();
|
||||||
var result = await repository.MarkAsDeleted(userId, [id], comment, token);
|
var changeLogCommit = new ChangeLogCommitDto()
|
||||||
|
{
|
||||||
|
Comment = comment,
|
||||||
|
IdAuthor = userId,
|
||||||
|
Creation = DateTimeOffset.UtcNow,
|
||||||
|
};
|
||||||
|
var result = await service.MarkAsDeleted([id], changeLogCommit, token);
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
@ -72,7 +82,13 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
public async Task<IActionResult> DeleteRange(IEnumerable<Guid> ids, string comment, CancellationToken token)
|
public async Task<IActionResult> DeleteRange(IEnumerable<Guid> ids, string comment, CancellationToken token)
|
||||||
{
|
{
|
||||||
var userId = User.GetUserId<Guid>();
|
var userId = User.GetUserId<Guid>();
|
||||||
var result = await repository.MarkAsDeleted(userId, ids, comment, token);
|
var changeLogCommit = new ChangeLogCommitDto()
|
||||||
|
{
|
||||||
|
Comment = comment,
|
||||||
|
IdAuthor = userId,
|
||||||
|
Creation = DateTimeOffset.UtcNow,
|
||||||
|
};
|
||||||
|
var result = await service.MarkAsDeleted(ids, changeLogCommit, token);
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
@ -88,7 +104,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
//var userId = User.GetUserId<Guid>();
|
//var userId = User.GetUserId<Guid>();
|
||||||
var userId = Guid.NewGuid();
|
var userId = Guid.NewGuid();
|
||||||
var changeLogCommit = new ChangeLogCommitDto(userId, comment, dtos);
|
var changeLogCommit = new ChangeLogCommitDto(userId, comment, dtos);
|
||||||
var result = await repository.ClearAndAddRange(idDiscriminator, changeLogCommit, token);
|
var result = await service.ClearAndAddRange(idDiscriminator, changeLogCommit, token);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +118,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
//var userId = User.GetUserId<Guid>();
|
//var userId = User.GetUserId<Guid>();
|
||||||
var userId = Guid.NewGuid();
|
var userId = Guid.NewGuid();
|
||||||
var changeLogCommit = new ChangeLogCommitDto(userId, comment, [dto]);
|
var changeLogCommit = new ChangeLogCommitDto(userId, comment, [dto]);
|
||||||
var result = await repository.UpdateRange(changeLogCommit, token);
|
var result = await service.UpdateRange(changeLogCommit, token);
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
@ -117,7 +133,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
|||||||
//var userId = User.GetUserId<Guid>();
|
//var userId = User.GetUserId<Guid>();
|
||||||
var userId = Guid.NewGuid();
|
var userId = Guid.NewGuid();
|
||||||
var changeLogCommit = new ChangeLogCommitDto(userId, comment, dtos);
|
var changeLogCommit = new ChangeLogCommitDto(userId, comment, dtos);
|
||||||
var result = await repository.UpdateRange(changeLogCommit, token);
|
var result = await service.UpdateRange(changeLogCommit, token);
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using Swashbuckle.AspNetCore.SwaggerGen;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using DD.Persistence.Database.Entity;
|
using DD.Persistence.Database.Entity;
|
||||||
|
using DD.Persistence.API.Services;
|
||||||
|
|
||||||
namespace DD.Persistence.API;
|
namespace DD.Persistence.API;
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ public static class DependencyInjection
|
|||||||
{
|
{
|
||||||
services.AddTransient<IWitsDataService, WitsDataService>();
|
services.AddTransient<IWitsDataService, WitsDataService>();
|
||||||
services.AddTransient<ITimestampedValuesService, TimestampedValuesService>();
|
services.AddTransient<ITimestampedValuesService, TimestampedValuesService>();
|
||||||
|
services.AddTransient<ChangeLogService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Authentication
|
#region Authentication
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
using DD.Persistence.Repositories;
|
using DD.Persistence.Database.Entity;
|
||||||
|
using DD.Persistence.Models.Requests;
|
||||||
|
using DD.Persistence.Repositories;
|
||||||
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace DD.Persistence.API.Services;
|
namespace DD.Persistence.API.Services;
|
||||||
public class ChangeLogService
|
public class ChangeLogService
|
||||||
@ -19,24 +23,56 @@ public class ChangeLogService
|
|||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Guid> GetOrCreateAsync(Guid idUser, string comment, CancellationToken token)
|
private async Task<Guid> GetOrCreateAsync(ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var key = (idUser, comment);
|
var key = (commitDto.IdAuthor, commitDto.Comment);
|
||||||
var commitId = await memoryCache.GetOrCreateAsync(key, async (cacheEntry) =>
|
var commitId = await memoryCache.GetOrCreateAsync(key, async (cacheEntry) =>
|
||||||
{
|
{
|
||||||
cacheEntry.AbsoluteExpirationRelativeToNow = AbsoluteExpirationRelativeToNow;
|
cacheEntry.AbsoluteExpirationRelativeToNow = AbsoluteExpirationRelativeToNow;
|
||||||
|
|
||||||
var commitId = await commitRepository.Add(idUser, comment, token);
|
var commitId = await commitRepository.Add(commitDto, token);
|
||||||
|
|
||||||
return commitId;
|
return commitId;
|
||||||
});
|
});
|
||||||
|
|
||||||
return commitId;
|
return commitId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> AddRange( Guid idUser, string comment, CancellationToken token)
|
public async Task<int> AddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var cimmitId = await GetOrCreateAsync(idUser, comment, token);
|
var commitId = await GetOrCreateAsync(commitDto, token);
|
||||||
repository.AddRange(new);
|
commitDto.Id = commitId;
|
||||||
|
|
||||||
|
var result = await repository.AddRange(idDiscriminator, commitDto, token);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> MarkAsDeleted(IEnumerable<Guid> ids, ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
|
{
|
||||||
|
var commitId = await GetOrCreateAsync(commitDto, token);
|
||||||
|
commitDto.Id = commitId;
|
||||||
|
|
||||||
|
var result = await repository.MarkAsDeleted(commitId, ids, commitDto.Creation, token);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> ClearAndAddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
|
{
|
||||||
|
var commitId = await GetOrCreateAsync(commitDto, token);
|
||||||
|
commitDto.Id = commitId;
|
||||||
|
|
||||||
|
var result = await repository.ClearAndAddRange(idDiscriminator, commitDto, token);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> UpdateRange(ChangeLogCommitDto changeLogCommit, CancellationToken token)
|
||||||
|
{
|
||||||
|
var commitId = await GetOrCreateAsync(changeLogCommit, token);
|
||||||
|
changeLogCommit.Id = commitId;
|
||||||
|
|
||||||
|
var result = await repository.UpdateRange(changeLogCommit, token);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\DD.Persistence.API\DD.Persistence.API.csproj" />
|
||||||
<ProjectReference Include="..\DD.Persistence.Database.Postgres\DD.Persistence.Database.Postgres.csproj" />
|
<ProjectReference Include="..\DD.Persistence.Database.Postgres\DD.Persistence.Database.Postgres.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace DD.Persistence.Database.Postgres.Migrations
|
namespace DD.Persistence.Database.Postgres.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PersistencePostgresContext))]
|
[DbContext(typeof(PersistencePostgresContext))]
|
||||||
[Migration("20250211124554_Init")]
|
[Migration("20250214113032_Initial")]
|
||||||
partial class Init
|
partial class Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -85,7 +85,7 @@ namespace DD.Persistence.Database.Postgres.Migrations
|
|||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasComment("Дата создания коммита");
|
.HasComment("Дата создания коммита");
|
||||||
|
|
||||||
b.Property<Guid>("IdCommitAuthor")
|
b.Property<Guid>("IdAuthor")
|
||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasComment("Пользователь, создавший коммит");
|
.HasComment("Пользователь, создавший коммит");
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace DD.Persistence.Database.Postgres.Migrations
|
namespace DD.Persistence.Database.Postgres.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Init : Migration
|
public partial class Initial : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -17,7 +17,7 @@ namespace DD.Persistence.Database.Postgres.Migrations
|
|||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false, comment: "Id коммита"),
|
Id = table.Column<Guid>(type: "uuid", nullable: false, comment: "Id коммита"),
|
||||||
IdCommitAuthor = table.Column<Guid>(type: "uuid", nullable: false, comment: "Пользователь, создавший коммит"),
|
IdAuthor = table.Column<Guid>(type: "uuid", nullable: false, comment: "Пользователь, создавший коммит"),
|
||||||
Creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата создания коммита"),
|
Creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата создания коммита"),
|
||||||
Comment = table.Column<string>(type: "text", nullable: false, comment: "Комментарий к коммиту")
|
Comment = table.Column<string>(type: "text", nullable: false, comment: "Комментарий к коммиту")
|
||||||
},
|
},
|
@ -82,7 +82,7 @@ namespace DD.Persistence.Database.Postgres.Migrations
|
|||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasComment("Дата создания коммита");
|
.HasComment("Дата создания коммита");
|
||||||
|
|
||||||
b.Property<Guid>("IdCommitAuthor")
|
b.Property<Guid>("IdAuthor")
|
||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasComment("Пользователь, создавший коммит");
|
.HasComment("Пользователь, создавший коммит");
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ public static class DependencyInjection
|
|||||||
MapsterSetup();
|
MapsterSetup();
|
||||||
|
|
||||||
services.AddTransient<ISetpointRepository, SetpointRepository>();
|
services.AddTransient<ISetpointRepository, SetpointRepository>();
|
||||||
|
services.AddTransient<IChangeLogCommitRepository, ChangeLogCommitRepository>();
|
||||||
services.AddTransient<IChangeLogRepository, ChangeLogRepository>();
|
services.AddTransient<IChangeLogRepository, ChangeLogRepository>();
|
||||||
services.AddTransient<ITimestampedValuesRepository, TimestampedValuesRepository>();
|
services.AddTransient<ITimestampedValuesRepository, TimestampedValuesRepository>();
|
||||||
services.AddTransient<ITechMessagesRepository, TechMessagesRepository>();
|
services.AddTransient<ITechMessagesRepository, TechMessagesRepository>();
|
||||||
|
@ -19,7 +19,7 @@ public class ChangeLogCommit
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
[Comment("Пользователь, создавший коммит")]
|
[Comment("Пользователь, создавший коммит")]
|
||||||
public Guid IdCommitAuthor { get; set; }
|
public Guid IdAuthor { get; set; }
|
||||||
|
|
||||||
[Comment("Дата создания коммита")]
|
[Comment("Дата создания коммита")]
|
||||||
public DateTimeOffset Creation { get; set; }
|
public DateTimeOffset Creation { get; set; }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using DD.Persistence.Database.Entity;
|
using DD.Persistence.Database.Entity;
|
||||||
|
using DD.Persistence.Models.Requests;
|
||||||
using DD.Persistence.Repositories;
|
using DD.Persistence.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
@ -23,22 +24,20 @@ public class ChangeLogCommitRepository : IChangeLogCommitRepository
|
|||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
private virtual async Task<Guid> Add(Guid idUser, string comment, CancellationToken token) {
|
public async Task<Guid> Add(ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
|
{
|
||||||
|
|
||||||
var commit = new ChangeLogCommit()
|
var commit = new ChangeLogCommit()
|
||||||
{
|
{
|
||||||
Id = Uuid7.Guid(),
|
Id = Uuid7.Guid(),
|
||||||
IdCommitAuthor = idUser,
|
IdAuthor = commitDto.IdAuthor,
|
||||||
Comment = comment,
|
Comment = commitDto.Comment,
|
||||||
Creation = DateTimeOffset.UtcNow
|
Creation = commitDto.Creation,
|
||||||
};
|
};
|
||||||
|
|
||||||
db.Add(commit);
|
db.Add(commit);
|
||||||
|
|
||||||
await db.SaveChangesAsync();
|
await db.SaveChangesAsync();
|
||||||
return commit.Id;
|
return commit.Id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Task<Guid> GetOrCreate(Guid idUser, string comment, CancellationToken token);
|
|
||||||
}
|
}
|
||||||
|
@ -6,29 +6,34 @@ using DD.Persistence.Models.Requests;
|
|||||||
using DD.Persistence.Repositories;
|
using DD.Persistence.Repositories;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
using UuidExtensions;
|
using UuidExtensions;
|
||||||
|
|
||||||
namespace DD.Persistence.Database.Repositories;
|
namespace DD.Persistence.Database.Repositories;
|
||||||
public class ChangeLogRepository : IChangeLogRepository
|
public class ChangeLogRepository : IChangeLogRepository
|
||||||
{
|
{
|
||||||
private readonly DbContext db;
|
private readonly DbContext db;
|
||||||
private readonly IChangeLogCommitRepository changeLogCommitRepo;
|
|
||||||
|
|
||||||
public ChangeLogRepository(DbContext db, IChangeLogCommitRepository changeLogCommitRepo)
|
public ChangeLogRepository(DbContext db)
|
||||||
{
|
{
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.changeLogCommitRepo = changeLogCommitRepo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> AddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token)
|
public async Task<int> AddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var commit = changeLogCommitRepo.Get(commitDto);
|
|
||||||
db.Set<ChangeLogCommit>().Add(commit);
|
|
||||||
|
|
||||||
var entities = new List<ChangeLog>();
|
var entities = new List<ChangeLog>();
|
||||||
foreach (var values in commitDto.ChangeLogItems)
|
foreach (var values in commitDto.ChangeLogItems)
|
||||||
{
|
{
|
||||||
var entity = CreateChangeLogFromDto(idDiscriminator, commit.Id, commit.IdCommitAuthor, values);
|
var entity = new ChangeLog()
|
||||||
|
{
|
||||||
|
Id = Uuid7.Guid(),
|
||||||
|
Creation = commitDto.Creation,
|
||||||
|
IdAuthor = commitDto.IdAuthor,
|
||||||
|
IdDiscriminator = idDiscriminator,
|
||||||
|
Value = values.Value,
|
||||||
|
IdCommit = commitDto.Id,
|
||||||
|
};
|
||||||
|
|
||||||
entities.Add(entity);
|
entities.Add(entity);
|
||||||
}
|
}
|
||||||
db.Set<ChangeLog>().AddRange(entities);
|
db.Set<ChangeLog>().AddRange(entities);
|
||||||
@ -38,7 +43,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> MarkAsDeleted(Guid idEditor, IEnumerable<Guid> ids, string comment, CancellationToken token)
|
public async Task<int> MarkAsDeleted(Guid idCommit, IEnumerable<Guid> ids, DateTimeOffset updateTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(s => ids.Contains(s.Id))
|
.Where(s => ids.Contains(s.Id))
|
||||||
@ -51,12 +56,16 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
var entities = await query.ToArrayAsync(token);
|
var entities = await query.ToArrayAsync(token);
|
||||||
|
|
||||||
var result = await MarkAsObsolete(idEditor, entities, comment, token);
|
foreach (var entity in entities)
|
||||||
|
{
|
||||||
|
entity.Obsolete = updateTime;
|
||||||
|
entity.IdDiscriminator = idCommit;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return await db.SaveChangesAsync(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> MarkAsDeleted(Guid idEditor, Guid idDiscriminator, string comment, CancellationToken token)
|
public async Task<int> MarkAsDeleted(Guid idDiscriminator, Guid idCommit, DateTimeOffset updateTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<ChangeLog>()
|
var query = db.Set<ChangeLog>()
|
||||||
.Where(s => s.IdDiscriminator == idDiscriminator)
|
.Where(s => s.IdDiscriminator == idDiscriminator)
|
||||||
@ -64,31 +73,16 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
var entities = await query.ToArrayAsync(token);
|
var entities = await query.ToArrayAsync(token);
|
||||||
|
|
||||||
var result = await MarkAsObsolete(idEditor, entities, comment, token);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<int> MarkAsObsolete(Guid idEditor, IEnumerable<ChangeLog> entities, string comment, CancellationToken token)
|
|
||||||
{
|
|
||||||
var updateTime = DateTimeOffset.UtcNow;
|
|
||||||
var commit = new ChangeLogCommit() {
|
|
||||||
Comment = comment,
|
|
||||||
Creation = updateTime,
|
|
||||||
Id = Uuid7.Guid(),
|
|
||||||
IdCommitAuthor = idEditor
|
|
||||||
};
|
|
||||||
db.Set<ChangeLogCommit>().Add(commit);
|
|
||||||
|
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
{
|
{
|
||||||
entity.Obsolete = updateTime;
|
entity.Obsolete = updateTime;
|
||||||
entity.IdDiscriminator = commit.Id;
|
entity.IdDiscriminator = idCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await db.SaveChangesAsync(token);
|
return await db.SaveChangesAsync(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<int> ClearAndAddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token)
|
public async Task<int> ClearAndAddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = 0;
|
var result = 0;
|
||||||
@ -98,7 +92,7 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
using var transaction = await db.Database.BeginTransactionAsync(token);
|
using var transaction = await db.Database.BeginTransactionAsync(token);
|
||||||
|
|
||||||
result += await MarkAsDeleted(commitDto.IdAuthor, changeLogIds, comment, token);
|
result += await MarkAsDeleted(commitDto.IdAuthor, changeLogIds, commitDto.Creation, token);
|
||||||
result += await AddRange(idDiscriminator, commitDto, token);
|
result += await AddRange(idDiscriminator, commitDto, token);
|
||||||
|
|
||||||
await transaction.CommitAsync(token);
|
await transaction.CommitAsync(token);
|
||||||
@ -117,9 +111,6 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
|
|
||||||
using var transaction = await db.Database.BeginTransactionAsync(token);
|
using var transaction = await db.Database.BeginTransactionAsync(token);
|
||||||
|
|
||||||
var commit = GetOrCreate(commitDto);
|
|
||||||
db.Set<ChangeLogCommit>().Add(commit);
|
|
||||||
|
|
||||||
foreach (var dto in commitDto.ChangeLogItems)
|
foreach (var dto in commitDto.ChangeLogItems)
|
||||||
{
|
{
|
||||||
var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id);
|
var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id);
|
||||||
@ -128,11 +119,19 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
throw new ArgumentException($"Entity with id = {dto.Id} doesn't exist in Db", nameof(dto));
|
throw new ArgumentException($"Entity with id = {dto.Id} doesn't exist in Db", nameof(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
var newEntity = CreateChangeLogFromDto(updatedEntity.IdDiscriminator, commit.Id, commitDto.IdAuthor, dto);
|
var newEntity = new ChangeLog()
|
||||||
|
{
|
||||||
|
Id = Uuid7.Guid(),
|
||||||
|
Creation = commitDto.Creation,
|
||||||
|
IdAuthor = commitDto.IdAuthor,
|
||||||
|
IdDiscriminator = updatedEntity.IdDiscriminator,
|
||||||
|
Value = dto.Value,
|
||||||
|
IdCommit = commitDto.Id,
|
||||||
|
};
|
||||||
dbSet.Add(newEntity);
|
dbSet.Add(newEntity);
|
||||||
|
|
||||||
updatedEntity.IdNext = newEntity.Id;
|
updatedEntity.IdNext = newEntity.Id;
|
||||||
updatedEntity.Obsolete = DateTimeOffset.UtcNow;
|
updatedEntity.Obsolete = commitDto.Creation;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await db.SaveChangesAsync(token);
|
var result = await db.SaveChangesAsync(token);
|
||||||
@ -208,31 +207,6 @@ public class ChangeLogRepository : IChangeLogRepository
|
|||||||
return datesOnly;
|
return datesOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChangeLog CreateChangeLogFromDto(Guid idDiscriminator, Guid idCommit, Guid idAuthor, ChangeLogValuesDto dto)
|
|
||||||
{
|
|
||||||
var entity = new ChangeLog()
|
|
||||||
{
|
|
||||||
Id = Uuid7.Guid(),
|
|
||||||
Creation = DateTimeOffset.UtcNow,
|
|
||||||
IdAuthor = idAuthor,
|
|
||||||
IdDiscriminator = idDiscriminator,
|
|
||||||
Value = dto.Value,
|
|
||||||
IdCommit = idCommit,
|
|
||||||
};
|
|
||||||
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ChangeLogCommit GetOrCreate(ChangeLogCommitDto commitDto)
|
|
||||||
{
|
|
||||||
return new ChangeLogCommit()
|
|
||||||
{
|
|
||||||
Comment = commitDto.Comment,
|
|
||||||
Creation = DateTimeOffset.UtcNow,
|
|
||||||
IdCommitAuthor = commitDto.IdAuthor
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<ChangeLogValuesDto>> GetGtDate(Guid idDiscriminator, DateTimeOffset dateBegin, CancellationToken token)
|
public async Task<IEnumerable<ChangeLogValuesDto>> GetGtDate(Guid idDiscriminator, DateTimeOffset dateBegin, CancellationToken token)
|
||||||
{
|
{
|
||||||
var date = dateBegin.ToUniversalTime();
|
var date = dateBegin.ToUniversalTime();
|
||||||
|
@ -5,6 +5,16 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ChangeLogCommitDto
|
public class ChangeLogCommitDto
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дата создания
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset Creation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Пользователь, совершающий коммит
|
/// Пользователь, совершающий коммит
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -13,13 +23,21 @@ public class ChangeLogCommitDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Комментарий
|
/// Комментарий
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Набор изменений
|
/// Набор изменений
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<ChangeLogValuesDto> ChangeLogItems { get; set; }
|
public IEnumerable<ChangeLogValuesDto> ChangeLogItems { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
public ChangeLogCommitDto()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -28,6 +46,7 @@ public class ChangeLogCommitDto
|
|||||||
IdAuthor = idAuthor;
|
IdAuthor = idAuthor;
|
||||||
Comment = comment;
|
Comment = comment;
|
||||||
ChangeLogItems = changeLogItems;
|
ChangeLogItems = changeLogItems;
|
||||||
|
Creation = DateTimeOffset.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,20 +5,28 @@ using DD.Persistence.Models.Common;
|
|||||||
using DD.Persistence.Models.Requests;
|
using DD.Persistence.Models.Requests;
|
||||||
using DD.Persistence.Models;
|
using DD.Persistence.Models;
|
||||||
using DD.Persistence.Repositories;
|
using DD.Persistence.Repositories;
|
||||||
using Shouldly;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using UuidExtensions;
|
using UuidExtensions;
|
||||||
|
using DD.Persistence.API.Services;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using DD.Persistence.Database;
|
||||||
|
|
||||||
namespace DD.Persistence.Repository.Test;
|
namespace DD.Persistence.Repository.Test;
|
||||||
public class ChangeLogRepositoryTest : IClassFixture<RepositoryTestFixture>
|
public class ChangeLogRepositoryTest : IClassFixture<RepositoryTestFixture>
|
||||||
{
|
{
|
||||||
private readonly PersistencePostgresContext context;
|
private readonly PersistencePostgresContext context;
|
||||||
private readonly IChangeLogRepository repo;
|
private readonly IChangeLogRepository repo;
|
||||||
|
private readonly RepositoryTestFixture fixture;
|
||||||
|
|
||||||
public ChangeLogRepositoryTest(RepositoryTestFixture fixture)
|
public ChangeLogService service { get; }
|
||||||
|
|
||||||
|
public ChangeLogRepositoryTest(RepositoryTestFixture fixture, ChangeLogService changeLogService)
|
||||||
{
|
{
|
||||||
|
this.fixture = fixture;
|
||||||
context = fixture.GetDbContext();
|
context = fixture.GetDbContext();
|
||||||
repo = new ChangeLogRepository(context);
|
//sut = new SetpointRepository(context);
|
||||||
|
|
||||||
|
//service = new ChangeLogService(cache, );
|
||||||
}
|
}
|
||||||
|
|
||||||
//Task<int> MarkAsDeleted(Guid idEditor, IEnumerable<Guid> ids, string comment, CancellationToken token);
|
//Task<int> MarkAsDeleted(Guid idEditor, IEnumerable<Guid> ids, string comment, CancellationToken token);
|
||||||
@ -26,7 +34,7 @@ public class ChangeLogRepositoryTest : IClassFixture<RepositoryTestFixture>
|
|||||||
//Task<int> MarkAsDeleted(Guid idEditor, Guid idDiscriminator, string comment, CancellationToken token);
|
//Task<int> MarkAsDeleted(Guid idEditor, Guid idDiscriminator, string comment, CancellationToken token);
|
||||||
//Task<int> ClearAndAddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token);
|
//Task<int> ClearAndAddRange(Guid idDiscriminator, ChangeLogCommitDto commitDto, CancellationToken token);
|
||||||
|
|
||||||
private async Task<ChangeLogCommitDto> ChangeLogItem(Guid idDiscriminator)
|
private ChangeLogCommitDto CreateChangeLogItem(Guid idDiscriminator)
|
||||||
{
|
{
|
||||||
var idAuthor = Uuid7.Guid();
|
var idAuthor = Uuid7.Guid();
|
||||||
var changeLogItems = new List<ChangeLogValuesDto>()
|
var changeLogItems = new List<ChangeLogValuesDto>()
|
||||||
@ -49,75 +57,75 @@ public class ChangeLogRepositoryTest : IClassFixture<RepositoryTestFixture>
|
|||||||
public async Task AddRangeReturnSuccess()
|
public async Task AddRangeReturnSuccess()
|
||||||
{
|
{
|
||||||
//act
|
//act
|
||||||
var idDiscriminator = Uuid7.Guid();
|
var id Discriminator = Uuid7.Guid();
|
||||||
var commit = await ChangeLogItem(idDiscriminator);
|
var commit = CreateChangeLogItem(idDiscriminator);
|
||||||
var result = await repo.AddRange(idDiscriminator, commit, CancellationToken.None);
|
var result = await service.AddRange(idDiscriminator, commit, CancellationToken.None);
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
Assert.Equal(2, result);
|
Assert.Equal(2, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Fact]
|
//[Fact]
|
||||||
public async Task UpdateRangeReturnSuccess()
|
//public async Task UpdateRangeReturnSuccess()
|
||||||
{
|
//{
|
||||||
var idDiscriminator = Uuid7.Guid();
|
// var idDiscriminator = Uuid7.Guid();
|
||||||
var commit1 = await ChangeLogItem(idDiscriminator);
|
// var commit1 = await CreateChangeLogItem(idDiscriminator);
|
||||||
var result = await repo.AddRange(idDiscriminator, commit1, CancellationToken.None);
|
// var result = await repo.AddRange(idDiscriminator, commit1, CancellationToken.None);
|
||||||
|
|
||||||
var commit2 = await ChangeLogItem(idDiscriminator);
|
// var commit2 = await CreateChangeLogItem(idDiscriminator);
|
||||||
result = await repo.AddRange(idDiscriminator, commit2, CancellationToken.None);
|
// result = await repo.AddRange(idDiscriminator, commit2, CancellationToken.None);
|
||||||
|
|
||||||
var items = await repo.GetGtDate(idDiscriminator, DateTimeOffset.UtcNow.AddDays(-1), CancellationToken.None);
|
// var items = await repo.GetGtDate(idDiscriminator, DateTimeOffset.UtcNow.AddDays(-1), CancellationToken.None);
|
||||||
|
|
||||||
if (items == null)
|
// if (items == null)
|
||||||
Assert.Fail("Не найдены элементы changeLog");
|
// Assert.Fail("Не найдены элементы changeLog");
|
||||||
|
|
||||||
var updated = items.ToArray();
|
// var updated = items.ToArray();
|
||||||
foreach (var item in updated)
|
// foreach (var item in updated)
|
||||||
{
|
// {
|
||||||
item.Value.Add("4", 4);
|
// item.Value.Add("4", 4);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//act
|
// //act
|
||||||
var commit = new ChangeLogCommitDto(Uuid7.Guid(), "Комментарий 2", updated);
|
// var commit = new ChangeLogCommitDto(Uuid7.Guid(), "Комментарий 2", updated);
|
||||||
result = await repo.UpdateRange(commit, CancellationToken.None);
|
// result = await repo.UpdateRange(commit, CancellationToken.None);
|
||||||
|
|
||||||
//assert
|
// //assert
|
||||||
//изменены 2 старые записи,
|
// //изменены 2 старые записи,
|
||||||
//добавлены 2 новые записи
|
// //добавлены 2 новые записи
|
||||||
//добавлен общий коммит
|
// //добавлен общий коммит
|
||||||
//итого = 2+2+1 = 5
|
// //итого = 2+2+1 = 5
|
||||||
Assert.Equal(5, result);
|
// Assert.Equal(5, result);
|
||||||
}
|
//}
|
||||||
|
|
||||||
[Fact]
|
//[Fact]
|
||||||
public async Task ClearAndAddRangeReturnSuccess()
|
//public async Task ClearAndAddRangeReturnSuccess()
|
||||||
{
|
//{
|
||||||
var idDiscriminator = Uuid7.Guid();
|
// var idDiscriminator = Uuid7.Guid();
|
||||||
var commit1 = await ChangeLogItem(idDiscriminator);
|
// var commit1 = await CreateChangeLogItem(idDiscriminator);
|
||||||
var result = await repo.AddRange(idDiscriminator, commit1, CancellationToken.None);
|
// var result = await repo.AddRange(idDiscriminator, commit1, CancellationToken.None);
|
||||||
|
|
||||||
var commit2 = await ChangeLogItem(idDiscriminator);
|
// var commit2 = await CreateChangeLogItem(idDiscriminator);
|
||||||
result = await repo.AddRange(idDiscriminator, commit2, CancellationToken.None);
|
// result = await repo.AddRange(idDiscriminator, commit2, CancellationToken.None);
|
||||||
|
|
||||||
var commit3 = await ChangeLogItem(idDiscriminator);
|
// var commit3 = await CreateChangeLogItem(idDiscriminator);
|
||||||
result = await repo.AddRange(idDiscriminator, commit3, CancellationToken.None);
|
// result = await repo.AddRange(idDiscriminator, commit3, CancellationToken.None);
|
||||||
|
|
||||||
//act
|
// //act
|
||||||
var commit4 = await ChangeLogItem(idDiscriminator);
|
// var commit4 = await CreateChangeLogItem(idDiscriminator);
|
||||||
var items = await repo.GetGtDate(idDiscriminator, DateTimeOffset.UtcNow.AddDays(-1), CancellationToken.None);
|
// var items = await repo.GetGtDate(idDiscriminator, DateTimeOffset.UtcNow.AddDays(-1), CancellationToken.None);
|
||||||
commit4.ChangeLogItems = items;
|
// commit4.ChangeLogItems = items;
|
||||||
result = await repo.ClearAndAddRange(idDiscriminator, commit4, CancellationToken.None);
|
// result = await repo.ClearAndAddRange(idDiscriminator, commit4, CancellationToken.None);
|
||||||
|
|
||||||
//assert
|
// //assert
|
||||||
//добавлены 3 записи и 3 коммита к ним,
|
// //добавлены 3 записи и 3 коммита к ним,
|
||||||
//добавлена 1 новая запись и 1 коммит к ней
|
// //добавлена 1 новая запись и 1 коммит к ней
|
||||||
Assert.Equal(8, result);
|
// Assert.Equal(8, result);
|
||||||
|
|
||||||
var paginationRequest = new PaginationRequest();
|
// var paginationRequest = new PaginationRequest();
|
||||||
var items2 = await repo.GetByDate(idDiscriminator, DateTimeOffset.UtcNow.AddMinutes(-10), paginationRequest, CancellationToken.None);
|
// var items2 = await repo.GetByDate(idDiscriminator, DateTimeOffset.UtcNow.AddMinutes(-10), paginationRequest, CancellationToken.None);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
<PackageReference Include="Shouldly" Version="4.2.1" />
|
<PackageReference Include="Shouldly" Version="4.2.1" />
|
||||||
<PackageReference Include="Testcontainers" Version="4.1.0" />
|
<PackageReference Include="Testcontainers" Version="4.2.0" />
|
||||||
<PackageReference Include="Testcontainers.PostgreSql" Version="4.1.0" />
|
<PackageReference Include="Testcontainers.PostgreSql" Version="4.2.0" />
|
||||||
<PackageReference Include="xunit" Version="2.9.2" />
|
<PackageReference Include="xunit" Version="2.9.2" />
|
||||||
<PackageReference Include="xunit.extensibility.core" Version="2.9.2" />
|
<PackageReference Include="xunit.extensibility.core" Version="2.9.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\DD.Persistence.API\DD.Persistence.API.csproj" />
|
||||||
<ProjectReference Include="..\DD.Persistence.Database.Postgres\DD.Persistence.Database.Postgres.csproj" />
|
<ProjectReference Include="..\DD.Persistence.Database.Postgres\DD.Persistence.Database.Postgres.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -10,7 +10,14 @@ namespace DD.Persistence.Repository.Test;
|
|||||||
|
|
||||||
public class RepositoryTestFixture : IAsyncLifetime
|
public class RepositoryTestFixture : IAsyncLifetime
|
||||||
{
|
{
|
||||||
public readonly PostgreSqlContainer dbContainer = new PostgreSqlBuilder().Build();
|
public readonly PostgreSqlContainer dbContainer = new PostgreSqlBuilder()
|
||||||
|
.WithImage("timescale/timescaledb:latest-pg16")
|
||||||
|
.WithHostname("localhost")
|
||||||
|
.WithDatabase("persistence")
|
||||||
|
.WithUsername("postgres")
|
||||||
|
.WithPassword("postgres")
|
||||||
|
//.WithPortBinding("5462")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
public PersistencePostgresContext GetDbContext() => new(new DbContextOptionsBuilder<PersistencePostgresContext>()
|
public PersistencePostgresContext GetDbContext() => new(new DbContextOptionsBuilder<PersistencePostgresContext>()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using DD.Persistence.Models.Requests;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -14,9 +15,8 @@ public interface IChangeLogCommitRepository
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idUser"></param>
|
/// <param name="commitDto"></param>
|
||||||
/// <param name="comment"></param>
|
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Guid> Add(Guid idUser, string comment, CancellationToken token);
|
Task<Guid> Add(ChangeLogCommitDto commitDto, CancellationToken token);
|
||||||
}
|
}
|
||||||
|
@ -22,22 +22,22 @@ public interface IChangeLogRepository : ISyncWithDiscriminatorRepository<ChangeL
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Пометить записи как удаленные
|
/// Пометить записи как удаленные
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idEditor"></param>
|
/// <param name="idCommit"></param>
|
||||||
/// <param name="ids">ключи записей</param>
|
/// <param name="ids">ключи записей</param>
|
||||||
/// <param name="comment">комментарий к удалению</param>
|
/// <param name="updateTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> MarkAsDeleted(Guid idEditor, IEnumerable<Guid> ids, string comment, CancellationToken token);
|
Task<int> MarkAsDeleted(Guid idCommit, IEnumerable<Guid> ids, DateTimeOffset updateTime, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Пометить записи как удаленные
|
/// Пометить записи как удаленные
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idEditor"></param>
|
|
||||||
/// <param name="idDiscriminator">дискриминатор таблицы</param>
|
/// <param name="idDiscriminator">дискриминатор таблицы</param>
|
||||||
/// <param name="comment">комментарий к удалению</param>
|
/// <param name="idCommit"></param>
|
||||||
|
/// <param name="updateTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> MarkAsDeleted(Guid idEditor, Guid idDiscriminator, string comment, CancellationToken token);
|
Task<int> MarkAsDeleted(Guid idDiscriminator, Guid idCommit, DateTimeOffset updateTime, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Очистить и добавить новые
|
/// Очистить и добавить новые
|
||||||
|
Loading…
Reference in New Issue
Block a user