|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using MongoDB.Driver;
|
|
|
|
|
using MongoDB.Driver.Linq;
|
|
|
|
|
@ -21,7 +22,8 @@ namespace Volo.CmsKit.MongoDB.Reactions
|
|
|
|
|
Guid userId,
|
|
|
|
|
string entityType,
|
|
|
|
|
string entityId,
|
|
|
|
|
string reactionName)
|
|
|
|
|
string reactionName,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
|
|
|
|
|
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
|
|
|
|
|
@ -33,13 +35,14 @@ namespace Volo.CmsKit.MongoDB.Reactions
|
|
|
|
|
x.EntityType == entityType &&
|
|
|
|
|
x.EntityId == entityId &&
|
|
|
|
|
x.ReactionName == reactionName)
|
|
|
|
|
.FirstOrDefaultAsync();
|
|
|
|
|
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<UserReaction>> GetListForUserAsync(
|
|
|
|
|
Guid userId,
|
|
|
|
|
string entityType,
|
|
|
|
|
string entityId)
|
|
|
|
|
string entityId,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
|
|
|
|
|
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
|
|
|
|
|
@ -49,12 +52,13 @@ namespace Volo.CmsKit.MongoDB.Reactions
|
|
|
|
|
x.CreatorId == userId &&
|
|
|
|
|
x.EntityType == entityType &&
|
|
|
|
|
x.EntityId == entityId)
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<ReactionSummaryQueryResultItem>> GetSummariesAsync(
|
|
|
|
|
string entityType,
|
|
|
|
|
string entityId)
|
|
|
|
|
string entityId,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
|
|
|
|
|
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
|
|
|
|
|
@ -69,7 +73,7 @@ namespace Volo.CmsKit.MongoDB.Reactions
|
|
|
|
|
ReactionName = g.Key,
|
|
|
|
|
Count = g.Count()
|
|
|
|
|
})
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|