Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
003c313d7c | ||
|
|
7823dffcfa | ||
|
|
33b4efde94 | ||
|
|
0b8a0d3d63 | ||
|
|
b40c79e3b7 | ||
|
|
7fad11b64b | ||
|
|
54a00c58a6 | ||
|
|
086d68bfd1 | ||
|
|
7609bdf2ca | ||
|
|
ecd94c7b03 |
@@ -0,0 +1,30 @@
|
||||
namespace xTagService.Constants
|
||||
{
|
||||
public struct XTagServiceConstants
|
||||
{
|
||||
//
|
||||
// Service Extensions Log Tag ...
|
||||
public const string XTagServiceDILogTag = "XTagService";
|
||||
|
||||
//
|
||||
// Table Mapping Identifiers ...
|
||||
public const string XTagTable = "Tags";
|
||||
|
||||
//
|
||||
// GraphQL Collection Mappings ...
|
||||
public const string XTagSingleName = "tag";
|
||||
public const string XTagCollectionName = "tags";
|
||||
|
||||
//
|
||||
// Hubs ...
|
||||
public const string XTagDtoHub = "tagDto";
|
||||
public const string XTagEntityHub = "tagEntity";
|
||||
|
||||
//
|
||||
// Custome Constants ...
|
||||
|
||||
//
|
||||
// EF Repositories Helper Extensions ...
|
||||
public const string GetXTagEFRepositoryDescriptor = "GetXTagEFRepositoryDescriptor";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,805 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Providers;
|
||||
using xExceptions.Constants;
|
||||
using xIdentityService.Controllers;
|
||||
using xIdentityService.Interfaces;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using xPushService.Base;
|
||||
using xPushService.Interfaces;
|
||||
using xTagService.Interfaces;
|
||||
|
||||
namespace xTagService.Controllers
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public abstract class XBaseProvidedHasTagControllerBase<TEntity, TDto, TKey, THub> : XBaseIdentityApiV1Controller, IXBaseProvidedHasTagController<TEntity, TDto, TKey, THub>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
where TDto : XBaseEntityDto<TKey>
|
||||
where THub : XBaseDtoHub<TEntity, TDto, TKey>
|
||||
{
|
||||
private readonly IXBaseProvided<TEntity, TDto, TKey, THub> provider;
|
||||
private readonly IXTagProvided<TEntity, TDto, TKey, THub> tagProvided;
|
||||
private readonly Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> defaultOrderBuilder;
|
||||
private readonly Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> defaultIncludeBuilder;
|
||||
|
||||
protected XBaseProvidedHasTagControllerBase(
|
||||
ILogger<XBaseProvidedHasTagControllerBase<TEntity, TDto, TKey, THub>> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider,
|
||||
IXBaseProvided<TEntity, TDto, TKey, THub> provider,
|
||||
IXTagProvided<TEntity, TDto, TKey, THub> tagProvided,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> defaultOrderBuilder = null,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> defaultIncludeBuilder = null
|
||||
) : base(
|
||||
logger,
|
||||
appConfiguration,
|
||||
identityProvider,
|
||||
validationProvider
|
||||
)
|
||||
{
|
||||
this.provider = provider;
|
||||
this.tagProvided = tagProvided;
|
||||
this.defaultOrderBuilder = defaultOrderBuilder;
|
||||
this.defaultIncludeBuilder = defaultIncludeBuilder;
|
||||
}
|
||||
|
||||
//
|
||||
#region Provided ...
|
||||
//
|
||||
#region Retrieve ...
|
||||
/// <summary>
|
||||
/// Get Specified Item by ID ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="useDefaultIncludes"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
public virtual async Task<ActionResult<TDto>> Get(
|
||||
[FromRoute] TKey id,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
ValidationProvider.NotNull(id);
|
||||
|
||||
//
|
||||
var result = await provider.Get(
|
||||
id: id,
|
||||
includeBuilder: !useDefaultIncludes
|
||||
? null
|
||||
: defaultIncludeBuilder,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get All Exists Items ...
|
||||
/// </summary>
|
||||
/// <param name="useDefaultOrders"></param>
|
||||
/// <param name="useDefaultIncludes"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("")]
|
||||
public virtual async Task<ActionResult<IEnumerable<TDto>>> GetAll(
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
var result = await provider.GetAll(
|
||||
orderBuilder: !useDefaultOrders
|
||||
? null
|
||||
: defaultOrderBuilder,
|
||||
includeBuilder: !useDefaultIncludes
|
||||
? null
|
||||
: defaultIncludeBuilder,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find an item by providing a Conditional Expression ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="useDefaultIncludes"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Find/One")]
|
||||
public virtual async Task<ActionResult<TDto>> FindOne(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotEmpty(query)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var result = await provider.FindOne(
|
||||
includeBuilder: !useDefaultIncludes
|
||||
? null
|
||||
: defaultIncludeBuilder,
|
||||
cancellationToken: cancellationToken,
|
||||
predicate: x => x.PropValuesContains(query)
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find a collection of Items by proving a Query Search ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="useDefaultOrders"></param>
|
||||
/// <param name="useDefaultIncludes"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Find/Many")]
|
||||
public virtual async Task<ActionResult<IEnumerable<TDto>>> FindMany(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotEmpty(query)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var result = await provider.FindMany(
|
||||
orderBuilder: !useDefaultOrders
|
||||
? null
|
||||
: defaultOrderBuilder,
|
||||
includeBuilder: !useDefaultIncludes
|
||||
? null
|
||||
: defaultIncludeBuilder,
|
||||
cancellationToken: cancellationToken,
|
||||
predicate: x => x.PropValuesContains(query)
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Items based on XQuery Pagination structure ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="useDefaultOrders"></param>
|
||||
/// <param name="useDefaultIncludes"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Query")]
|
||||
public virtual async Task<ActionResult<XQueryResult<TDto>>> Query(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(query)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var result = await provider.Query(
|
||||
query: query,
|
||||
predicate: null,
|
||||
orderBuilder: !useDefaultOrders
|
||||
? null
|
||||
: defaultOrderBuilder,
|
||||
includeBuilder: !useDefaultIncludes
|
||||
? null
|
||||
: defaultIncludeBuilder,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Owned Items based on XQuery Pagination structure ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="useDefaultOrders"></param>
|
||||
/// <param name="useDefaultIncludes"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Query/Owned")]
|
||||
public virtual async Task<ActionResult<XQueryResult<TDto>>> QueryOwned(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(query)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
|
||||
//
|
||||
var result = await provider.QueryOwned(
|
||||
query: query,
|
||||
predicate: null,
|
||||
userInfo: userInfo,
|
||||
orderBuilder: !useDefaultOrders
|
||||
? null
|
||||
: defaultOrderBuilder,
|
||||
includeBuilder: !useDefaultIncludes
|
||||
? null
|
||||
: defaultIncludeBuilder,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Add/Update/Remove ...
|
||||
/// <summary>
|
||||
/// Add an item ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("")]
|
||||
public virtual async Task<ActionResult<TDto>> Add(
|
||||
[FromBody] TDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(item)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await provider.Add(
|
||||
item: item,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update an item values ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{id}")]
|
||||
public virtual async Task<ActionResult<TDto>> Update(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] TDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(item)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await provider.Update(
|
||||
id: id,
|
||||
item: item,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{id}")]
|
||||
public virtual async Task<ActionResult<TDto>> Remove(
|
||||
[FromRoute] TKey id,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await provider.Remove(
|
||||
id: id,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Tag ...
|
||||
/// <summary>
|
||||
/// Attach Tag to Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/attach")]
|
||||
public virtual async Task<ActionResult> AttachTag(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseValueContainer<string> tag,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(tag)
|
||||
.AddNotEmpty(tag.Value)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
await tagProvided
|
||||
.AttachTag(
|
||||
id: id,
|
||||
tag: tag.Value,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detach Tag of Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/detach")]
|
||||
public virtual async Task<ActionResult> DetachTag(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseValueContainer<string> tag,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(tag)
|
||||
.AddNotEmpty(tag.Value)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
await tagProvided
|
||||
.DetachTag(
|
||||
id: id,
|
||||
tag: tag.Value,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attach Tags to Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/attachs")]
|
||||
public virtual async Task<ActionResult> AttachTags(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseRangeRequest<string> tags,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(tags)
|
||||
.AddNotZeroChilds(tags.Items)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
await tagProvided
|
||||
.AttachTags(
|
||||
id: id,
|
||||
tags: tags.Items,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detach Tags of Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/detachs")]
|
||||
public virtual async Task<ActionResult> DetachTags(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseRangeRequest<string> tags = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
if (!tags.IsNull())
|
||||
{
|
||||
//
|
||||
await tagProvided
|
||||
.DetachTags(
|
||||
id: id,
|
||||
tags: tags.Items,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
await tagProvided
|
||||
.DetachTags(
|
||||
id: id,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Specified Item Tags ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/tags")]
|
||||
public virtual async Task<ActionResult<IEnumerable<string>>> GetTags(
|
||||
[FromRoute] TKey id,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
var result = await tagProvided.GetTags(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Providers;
|
||||
using xExceptions.Constants;
|
||||
using xIdentityService.Controllers;
|
||||
using xIdentityService.Interfaces;
|
||||
using xModels.Base;
|
||||
using xPushService.Base;
|
||||
using xTagService.Interfaces;
|
||||
|
||||
namespace xTagService.Controllers
|
||||
{
|
||||
public abstract class XTagProvidedControllerBase<TEntity, TDto, TKey, THub> : XBaseIdentityApiV1Controller, IXTagProvidedController<TEntity, TDto, TKey, THub>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
where TDto : XBaseEntityDto<TKey>
|
||||
where THub : XBaseDtoHub<TEntity, TDto, TKey>
|
||||
{
|
||||
private readonly IXTagProvided<TEntity, TDto, TKey, THub> tagProvided;
|
||||
|
||||
protected XTagProvidedControllerBase(
|
||||
ILogger<XTagProvidedControllerBase<TEntity, TDto, TKey, THub>> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
XValidationProvider validationProvider,
|
||||
IXIdentityProvider identityProvider,
|
||||
IXTagProvided<TEntity, TDto, TKey, THub> tagProvided
|
||||
) : base(
|
||||
logger,
|
||||
appConfiguration,
|
||||
identityProvider,
|
||||
validationProvider
|
||||
)
|
||||
{
|
||||
this.tagProvided = tagProvided;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attach Tag to Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/attach")]
|
||||
public virtual async Task<ActionResult> AttachTag(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseValueContainer<string> tag,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(tag)
|
||||
.AddNotEmpty(tag.Value)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
await tagProvided
|
||||
.AttachTag(
|
||||
id: id,
|
||||
tag: tag.Value,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detach Tag of Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/detach")]
|
||||
public virtual async Task<ActionResult> DetachTag(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseValueContainer<string> tag,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(tag)
|
||||
.AddNotEmpty(tag.Value)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
await tagProvided
|
||||
.DetachTag(
|
||||
id: id,
|
||||
tag: tag.Value,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attach Tags to Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/attachs")]
|
||||
public virtual async Task<ActionResult> AttachTags(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseRangeRequest<string> tags,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.AddNotNull(tags)
|
||||
.AddNotZeroChilds(tags.Items)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
await tagProvided
|
||||
.AttachTags(
|
||||
id: id,
|
||||
tags: tags.Items,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detach Tags of Specified Item ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/tags/detachs")]
|
||||
public virtual async Task<ActionResult> DetachTags(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] XBaseRangeRequest<string> tags = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
if (!tags.IsNull())
|
||||
{
|
||||
//
|
||||
await tagProvided
|
||||
.DetachTags(
|
||||
id: id,
|
||||
tags: tags.Items,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
await tagProvided
|
||||
.DetachTags(
|
||||
id: id,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Specified Item Tags ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/tags")]
|
||||
public virtual async Task<ActionResult<IEnumerable<string>>> GetTags(
|
||||
[FromRoute] TKey id,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(id)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
var result = await tagProvided.GetTags(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Providers;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Controllers;
|
||||
using xTagService.Interfaces;
|
||||
using xTagService.Models.Dtos;
|
||||
using xTagService.Models.Entities;
|
||||
using xTagService.Providers.Dtos;
|
||||
|
||||
namespace xTagService.Controllers
|
||||
{
|
||||
public abstract class XTagProviderControllerBase : XBaseProvidedController<XTag, XTagDto, int, XTagDtoHub>, IXTagProviderController
|
||||
{
|
||||
protected XTagProviderControllerBase(
|
||||
ILogger<XTagProviderControllerBase> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider,
|
||||
IXTagProvider provider,
|
||||
Func<IQueryable<XTag>, IOrderedQueryable<XTag>> defaultOrderBuilder = null,
|
||||
Func<IQueryable<XTag>, IIncludableQueryable<XTag, object>> defaultIncludeBuilder = null
|
||||
) : base(
|
||||
logger,
|
||||
appConfiguration,
|
||||
identityProvider,
|
||||
validationProvider,
|
||||
provider,
|
||||
defaultOrderBuilder,
|
||||
defaultIncludeBuilder
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,12 @@ using xDataService.Models;
|
||||
using xExceptions.Constants;
|
||||
using xPushService.DI;
|
||||
using xPushService.Helpers;
|
||||
using xTagService.Constants;
|
||||
using xTagService.Helpers;
|
||||
using xTagService.Interfaces;
|
||||
using xTagService.Interfaces.Dtos;
|
||||
using xTagService.Interfaces.Entities;
|
||||
using xTagService.Providers;
|
||||
using xTagService.Providers.Dtos;
|
||||
using xTagService.Providers.Entities;
|
||||
|
||||
@@ -78,8 +81,8 @@ namespace xTagService.DI
|
||||
var pushHelper = new XPushServiceHelper();
|
||||
|
||||
//
|
||||
pushHelper.AddHub<XTagDtoHub>("tagDto");
|
||||
pushHelper.AddHub<XTagEntityHub>("tagEntity");
|
||||
pushHelper.AddHub<XTagDtoHub>(XTagServiceConstants.XTagDtoHub);
|
||||
pushHelper.AddHub<XTagEntityHub>(XTagServiceConstants.XTagEntityHub);
|
||||
|
||||
//
|
||||
app.UseXPushService(pushHelper);
|
||||
@@ -104,7 +107,7 @@ namespace xTagService.DI
|
||||
/// <summary>
|
||||
/// a LogTag for Service ...
|
||||
/// </summary>
|
||||
private static string XLogTag = "XTagService";
|
||||
private static string XLogTag = XTagServiceConstants.XTagServiceDILogTag;
|
||||
|
||||
/// <summary>
|
||||
/// print a log in Console ...
|
||||
@@ -177,9 +180,9 @@ namespace xTagService.DI
|
||||
//
|
||||
descriptor = typeof(XTagServiceHelper)
|
||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||
methodName: "GetXTagEFRepositoryDescriptor",
|
||||
args: null,
|
||||
runtimeType: contextType,
|
||||
args: null
|
||||
methodName: XTagServiceConstants.GetXTagEFRepositoryDescriptor
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -213,6 +216,11 @@ namespace xTagService.DI
|
||||
new ServiceDescriptor(typeof(IXTagRepositoryProvider), typeof(XTagRepositoryProvider), lifeTime)
|
||||
);
|
||||
|
||||
//
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXTagProvider), typeof(XTagProvider), lifeTime)
|
||||
);
|
||||
|
||||
//
|
||||
Log("Service Regitration Succeed ...");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using xDataService.Interfaces;
|
||||
using xTagService.Models.Entities;
|
||||
|
||||
namespace xTagService.Interfaces
|
||||
namespace xTagService.Interfaces.Entities
|
||||
{
|
||||
public interface IXTagSeeder : IXBaseDbSeeder<XTag, int>
|
||||
{ }
|
||||
@@ -0,0 +1,12 @@
|
||||
using xModels.Base;
|
||||
using xPushService.Base;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xTagService.Interfaces
|
||||
{
|
||||
public interface IXBaseProvidedHasTagController<TEntity, TDto, TKey, THub> : IXBaseProvidedController<TEntity, TDto, TKey, THub>, IXTagProvidedController<TEntity, TDto, TKey, THub>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
where TDto : XBaseEntityDto<TKey>
|
||||
where THub : XBaseDtoHub<TEntity, TDto, TKey>
|
||||
{ }
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace xTagService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Reference a Tag to Specific XRefence<TKey> ...
|
||||
/// Add Reference a Tag to Specific XRefence<TKey/> ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="reference"></param>
|
||||
@@ -56,7 +56,7 @@ namespace xTagService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Reference a Tag for Specific XRefence<TKey> ...
|
||||
/// Remove Reference a Tag for Specific XRefence<TKey/> ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="reference"></param>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using xPushService.Interfaces;
|
||||
using xTagService.Models.Dtos;
|
||||
using xTagService.Models.Entities;
|
||||
using xTagService.Providers.Dtos;
|
||||
|
||||
namespace xTagService.Interfaces
|
||||
{
|
||||
public interface IXTagProvider : IXBaseProvided<XTag, XTagDto, int, XTagDtoHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using xPushService.Interfaces;
|
||||
using xTagService.Models.Dtos;
|
||||
using xTagService.Models.Entities;
|
||||
using xTagService.Providers.Dtos;
|
||||
|
||||
namespace xTagService.Interfaces
|
||||
{
|
||||
public interface IXTagProviderController : IXBaseProvidedController<XTag, XTagDto, int, XTagDtoHub>
|
||||
{ }
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xTagService.Interfaces;
|
||||
using xTagService.Interfaces.Entities;
|
||||
using xTagService.Models.Entities;
|
||||
|
||||
namespace xTagService.Providers
|
||||
namespace xTagService.Providers.Entities
|
||||
{
|
||||
public abstract class XTagSeederBase : XBaseDbSeeder<XTag, int>, IXTagSeeder
|
||||
{
|
||||
protected XTagSeederBase(
|
||||
string entity,
|
||||
string database,
|
||||
IXBaseRepository<XTag, int> repository,
|
||||
IXTagRepository repository,
|
||||
XDataServiceConfiguration dataServiceConfiguration
|
||||
) : base(
|
||||
entity,
|
||||
@@ -1,5 +1,6 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xTagService.Constants;
|
||||
using xTagService.Interfaces.Entities;
|
||||
using xTagService.Models.Entities;
|
||||
|
||||
@@ -14,12 +15,12 @@ namespace xTagService.Providers.GraphQL
|
||||
|
||||
public override string GetInQueryCollectionName()
|
||||
{
|
||||
return "tags";
|
||||
return XTagServiceConstants.XTagCollectionName;
|
||||
}
|
||||
|
||||
public override string GetInQuerySingleName()
|
||||
{
|
||||
return "tag";
|
||||
return XTagServiceConstants.XTagSingleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xTagService.Configurations.Entities;
|
||||
using xTagService.Models.Entities;
|
||||
|
||||
namespace xTagService.Providers
|
||||
@@ -21,6 +22,12 @@ namespace xTagService.Providers
|
||||
/// <param name="modelBuilder"></param>
|
||||
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
||||
{
|
||||
//
|
||||
// Configure Entity Using Provided ...
|
||||
modelBuilder
|
||||
.ApplyConfigurationsFromAssembly(typeof(XTagEntityConfiguration).Assembly);
|
||||
|
||||
//
|
||||
base.ConfigureEntities(modelBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using xCommons.Extensions;
|
||||
using xIdentityModels.Models;
|
||||
using xPushService.Providers;
|
||||
using xTagService.Interfaces;
|
||||
using xTagService.Interfaces.Dtos;
|
||||
using xTagService.Models.Dtos;
|
||||
using xTagService.Models.Entities;
|
||||
using xTagService.Providers.Dtos;
|
||||
|
||||
namespace xTagService.Providers
|
||||
{
|
||||
public class XTagProvider : XBaseProvided<XTag, XTagDto, int, XTagDtoHub>, IXTagProvider
|
||||
{
|
||||
public XTagProvider(
|
||||
IXTagServiceProvider provider
|
||||
) : base(
|
||||
provider,
|
||||
permittedRoles: new string[] { }
|
||||
)
|
||||
{ }
|
||||
|
||||
public override bool IsOwned(
|
||||
XTagDto item,
|
||||
XUserClaimsInfoDto userInfo
|
||||
)
|
||||
{
|
||||
return !item.IsNullOrDefault();
|
||||
}
|
||||
|
||||
public override bool IsOwned(
|
||||
XTag item,
|
||||
XUserClaimsInfoDto userInfo
|
||||
)
|
||||
{
|
||||
return !item.IsNullOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-10
@@ -2,13 +2,15 @@
|
||||
|
||||
<!-- Runtime Definition -->
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<PackageId>xDashboard.xTagService</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<Authors>Hadi Khazaee Asl</Authors>
|
||||
<Company>SaherElm IT Center</Company>
|
||||
<PackageId>xDashboard.xTagService</PackageId>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
||||
<Description>
|
||||
it is a Part of xDashboard on SaherElm IT Center which provides all Tag Related Futures ...
|
||||
it is a Part of xDashboard on SaherElm IT Center which provides all Tag Related Futures ...
|
||||
</Description>
|
||||
|
||||
<!-- Icon Definition -->
|
||||
@@ -17,21 +19,24 @@
|
||||
|
||||
<!-- Icon Handling -->
|
||||
<ItemGroup>
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" />
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
PackagePath="\icon.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Local Modules -->
|
||||
<ItemGroup>
|
||||
<!-- <PackageReference Include="xDashboard.xDataService" Version="1.0.0" /> -->
|
||||
<!-- <PackageReference Include="xDashboard.xPushService" Version="1.0.0" /> -->
|
||||
<!-- <PackageReference Include="xDashboard.xIdentityService" Version="1.0.0" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Local Dependencies -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../xDataService/xDataService.csproj" />
|
||||
<ProjectReference Include="../xPushService/xPushService.csproj" />
|
||||
<ProjectReference Include="../xIdentityService/xIdentityService.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<!-- For XML Documentation Support -->
|
||||
<PropertyGroup>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user