Compare commits
8
Commits
0d6ace247e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1711604941 | ||
|
|
9d48dd8146 | ||
|
|
38711f28a9 | ||
|
|
a0914b9519 | ||
|
|
d33b9f6fe1 | ||
|
|
e6920fd447 | ||
|
|
85fbc0899d | ||
|
|
fe88855e69 |
@@ -1,8 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Constants;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xStringService.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace xStringService.Configurations.Entities
|
||||
{
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
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.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xStringService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xIdentityService.Controllers;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
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 xIdentityService.Controllers;
|
||||
using xIdentityService.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using xCommons.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xStringService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xIdentityService.Controllers;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
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.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xPushService.Controllers;
|
||||
using xStringService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Providers;
|
||||
using xDataService.Controllers;
|
||||
using xCommons.Configurations;
|
||||
using xDataService.Interfaces;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Controllers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
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 xCommons.Configurations;
|
||||
using xPushService.Interfaces;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xPushService.Controllers;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Providers.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Providers;
|
||||
using xDataService.Controllers;
|
||||
using xCommons.Configurations;
|
||||
using xDataService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xDataService.Controllers;
|
||||
using xStringService.Models.Dtos;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
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 xCommons.Configurations;
|
||||
using xPushService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xPushService.Controllers;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xStringService.Controllers
|
||||
{
|
||||
|
||||
+14
-14
@@ -1,23 +1,23 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xExceptions.Constants;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Db;
|
||||
using xDataService.DI;
|
||||
using xDataService.Models;
|
||||
using xStringService.Helpers;
|
||||
using xCommons.Helpers;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xStringService.Providers.Entities;
|
||||
using xPushService.Helpers;
|
||||
using xPushService.DI;
|
||||
using xStringService.Interfaces;
|
||||
using xCommons.Helpers;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using xPushService.Helpers;
|
||||
using xExceptions.Constants;
|
||||
using xDataService.Constants;
|
||||
using xStringService.Helpers;
|
||||
using xStringService.Providers;
|
||||
using xStringService.Constants;
|
||||
using xStringService.Interfaces;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Providers.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace xStringService.DI
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xCommons.Extensions;
|
||||
using xModels.Dtos;
|
||||
using xCommons.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using GraphQL.Types;
|
||||
using xDataHelper.Providers.GraphQL;
|
||||
using xDataService.Db;
|
||||
using xDataService.Models;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataHelper.Providers.GraphQL;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Providers.Entities;
|
||||
using xStringService.Providers.GraphQL;
|
||||
using xStringService.Providers.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Helpers
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using xModels.Dtos;
|
||||
using xPushService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xStringService.Interfaces.Dtos
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xModels.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
@@ -24,7 +24,7 @@ namespace xStringService.Interfaces
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Items ...
|
||||
/// </summary>
|
||||
/// <param name="resource">Specified Resource Title</param>
|
||||
/// <param name="identifier">Specified Resource Title</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ResourceLocales")]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xModels.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
@@ -22,7 +22,6 @@ namespace xStringService.Interfaces
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Items ...
|
||||
/// </summary>
|
||||
/// <param name="resource">Specified Resource Title</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("LocalesResource")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xModels.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
{
|
||||
public interface IXOwnedItemResourceProvider
|
||||
{
|
||||
//
|
||||
#region Group Actions ...
|
||||
/// <summary>
|
||||
/// Retrieve a List of Exists Languages for Current Item ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<string>> GetLanguages(
|
||||
object owner,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Items of type ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||
object owner,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove all Exists Locales which Related to this Provider ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task RemoveResourceLocales(
|
||||
object owner,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Item Actions ...
|
||||
/// <summary>
|
||||
/// Get all Exists Items for Specified identitifer ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get all Exists Items for Specified identitifer ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XLocaleResourceDto>> GetLocales(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get all Exists Locales Representaion based on Specified Identitifer
|
||||
/// as XResourceDto ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XResourceDto> GetResource(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Or Update Locale for Specified Identitifer ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XResourceDto> AddOrUpdateLocale(
|
||||
object owner,
|
||||
object identifier,
|
||||
XLocaleResourceDto locale,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Resource State ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="resource"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XResourceDto> AddOrUpdateResource(
|
||||
object owner,
|
||||
object identifier,
|
||||
XResourceDto resource,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Language Locale of Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="language"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XResourceDto> RemoveLocale(
|
||||
object owner,
|
||||
object identifier,
|
||||
string language,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove all Exists Locales for Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task RemoveLocales(
|
||||
object owner,
|
||||
object identifier,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Check Specified ocale Exists for Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="language"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> HasLocale(
|
||||
object owner,
|
||||
object identifier,
|
||||
string language,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get all Exists Languages for Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<string>> GetLanguages(
|
||||
object owner,
|
||||
object identifier = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Resource Title Action ...
|
||||
/// <summary>
|
||||
/// Retrieve Resource Title ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <returns></returns>
|
||||
string GetResourceTitle(
|
||||
object owner = null,
|
||||
object identifier = null
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xModels.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xIdentityModels.Models;
|
||||
using xModels.Dtos;
|
||||
using xPushService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xModels.Dtos;
|
||||
using xPushService.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xStringService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using xModels.Base;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace xStringService.Models.Entities
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Dtos;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xStringService.Providers.Dtos
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Dtos
|
||||
{
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xExceptions.Constants;
|
||||
using xIdentityService.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xPushService.Base;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xPushService.Constants;
|
||||
using System.Linq.Expressions;
|
||||
using xCommons.Configurations;
|
||||
using xStringService.Extensions;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Dtos;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xStringService.Providers.Dtos
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xPushService.Base;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.Entities
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xStringService.Constants;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xStringService.Providers.GraphQL
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using GraphQL.Types;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xStringService.Interfaces.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Interfaces.Entities;
|
||||
|
||||
namespace xDataHelper.Providers.GraphQL
|
||||
{
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using xModels.Dtos;
|
||||
using System.Threading.Tasks;
|
||||
using xStringService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
|
||||
namespace xStringService.Providers
|
||||
{
|
||||
|
||||
@@ -0,0 +1,688 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using xStringService.Extensions;
|
||||
using xStringService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
|
||||
namespace xStringService.Providers
|
||||
{
|
||||
public abstract class XBaseOwnedItemResourceProvider : IXOwnedItemResourceProvider
|
||||
{
|
||||
//
|
||||
#region Props ...
|
||||
/// <summary>
|
||||
/// Item Name for Resource Providing ...
|
||||
/// </summary>
|
||||
private readonly string item;
|
||||
|
||||
/// <summary>
|
||||
/// Application Configuration ...
|
||||
/// </summary>
|
||||
private readonly XAppConfiguration appConfig;
|
||||
|
||||
/// <summary>
|
||||
/// String Provider Service ...
|
||||
/// </summary>
|
||||
private readonly IXStringServiceProvider stringProvider;
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Constructor ...
|
||||
protected XBaseOwnedItemResourceProvider(
|
||||
string item,
|
||||
XAppConfiguration appConfig,
|
||||
IXStringServiceProvider stringProvider
|
||||
)
|
||||
{
|
||||
//
|
||||
this.item = item;
|
||||
this.appConfig = appConfig;
|
||||
this.stringProvider = stringProvider;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Group Actions ...
|
||||
/// <summary>
|
||||
/// Retrieve a List of Exists Languages for Current Item ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<IEnumerable<string>> GetLanguages(
|
||||
object owner,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var items = await ExtractStrings(
|
||||
owner: owner,
|
||||
identifier: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
var result =
|
||||
items
|
||||
.Select(x => x.Language)
|
||||
.Distinct();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Items of type ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||
object owner,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = await ExtractStrings(
|
||||
owner: owner,
|
||||
identifier: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all Exists Locales which Related to this Provider ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task RemoveResourceLocales(
|
||||
object owner,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var items = await ExtractStrings(
|
||||
owner: owner,
|
||||
identifier: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
foreach (var item in items)
|
||||
{
|
||||
//
|
||||
// Check Cancellation Token ...
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Try to Remove it ...
|
||||
try
|
||||
{
|
||||
//
|
||||
await stringProvider.RemoveAsync(
|
||||
id: item.Id,
|
||||
softDelete: false,
|
||||
saveChanges: true,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Item Actions ...
|
||||
/// <summary>
|
||||
/// Get all Exists Items for Specified identitifer ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var resourceTitle = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
|
||||
//
|
||||
var result = await stringProvider.FindManyAsync(
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: true,
|
||||
cancellationToken: cancellationToken,
|
||||
predicate: x => x.ResourceTitle
|
||||
.ToNormalString()
|
||||
.Contains(resourceTitle.ToNormalString())
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Exists Items for Specified identitifer ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<IEnumerable<XLocaleResourceDto>> GetLocales(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = (await GetResourceLocales(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
))
|
||||
.Select(x => x.ToXLocaleResourceDto());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Exists Locales Representaion based on Specified Identitifer
|
||||
/// as XResourceDto ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<XResourceDto> GetResource(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var resource = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
var locales = await GetLocales(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
var result = new XResourceDto
|
||||
{
|
||||
Locales = locales,
|
||||
Resource = resource
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add Or Update Locale for Specified Identitifer ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<XResourceDto> AddOrUpdateLocale(
|
||||
object owner,
|
||||
object identifier,
|
||||
XLocaleResourceDto locale,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var resource = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
|
||||
//
|
||||
var resourceDto = await stringProvider.AddOrUpdateByLocaleResource(
|
||||
item: locale,
|
||||
resource: resource,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Retrieve XResourceDto ...
|
||||
var result = await GetResource(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update a Resource State ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="resource"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<XResourceDto> AddOrUpdateResource(
|
||||
object owner,
|
||||
object identifier,
|
||||
XResourceDto resource,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var resourceTitle = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
|
||||
//
|
||||
var isValid =
|
||||
!resource.IsNullOrDefault() &&
|
||||
resource.Resource == resourceTitle;
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Exists Resource ...
|
||||
var result = await GetResource(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
isValid =
|
||||
!result.IsNullOrDefault() &&
|
||||
result.Locales.HasChild();
|
||||
if (isValid)
|
||||
{
|
||||
await RemoveLocales(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
foreach (var locale in resource.Locales)
|
||||
{
|
||||
//
|
||||
var item = new XStringDto
|
||||
{
|
||||
Language = locale.Language,
|
||||
ResourceTitle = resourceTitle,
|
||||
TranslatedValue = locale.Value,
|
||||
};
|
||||
|
||||
//
|
||||
await stringProvider.AddAsync(
|
||||
item: item,
|
||||
saveChanges: true,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
result = await GetResource(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Language Locale of Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="language"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<XResourceDto> RemoveLocale(
|
||||
object owner,
|
||||
object identifier,
|
||||
string language,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
XResourceDto result = null;
|
||||
language = NormalizedLanguage(language);
|
||||
|
||||
//
|
||||
// Check Locale Exists ...
|
||||
var isValid = await HasLocale(
|
||||
owner: owner,
|
||||
language: language,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
var resourceTitle = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
|
||||
//
|
||||
var item = await stringProvider.FindOneAsync(
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: true,
|
||||
cancellationToken: cancellationToken,
|
||||
predicate: x =>
|
||||
x.Language.Equals(
|
||||
language,
|
||||
StringComparison.InvariantCultureIgnoreCase) &&
|
||||
x.ResourceTitle.Equals(
|
||||
resourceTitle,
|
||||
StringComparison.InvariantCultureIgnoreCase)
|
||||
);
|
||||
isValid = !item.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Remove XStringDto ...
|
||||
await stringProvider.RemoveAsync(
|
||||
id: item.Id,
|
||||
softDelete: false,
|
||||
saveChanges: true,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
result = await GetResource(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
catch { }
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all Exists Locales for Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task RemoveLocales(
|
||||
object owner,
|
||||
object identifier,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var resourceTitle = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
|
||||
//
|
||||
var items = await stringProvider.FindManyAsync(
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: true,
|
||||
cancellationToken: cancellationToken,
|
||||
predicate: x =>
|
||||
x.ResourceTitle.Equals(
|
||||
resourceTitle,
|
||||
StringComparison.InvariantCultureIgnoreCase)
|
||||
);
|
||||
var isValid = !item.IsNull();
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
await stringProvider.RemoveResource(
|
||||
resource: resourceTitle,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check Specified ocale Exists for Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="language"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<bool> HasLocale(
|
||||
object owner,
|
||||
object identifier,
|
||||
string language,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
language = NormalizedLanguage(language);
|
||||
var locales = await GetLocales(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
var result =
|
||||
language.HasChild() &&
|
||||
locales.Any(l => l.Language.Equals(
|
||||
language,
|
||||
StringComparison.InvariantCultureIgnoreCase)
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Exists Languages for Specified Identifier ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task<IEnumerable<string>> GetLanguages(
|
||||
object owner,
|
||||
object identifier = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var items = await ExtractStrings(
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
var result =
|
||||
items
|
||||
.Select(x => x.Language)
|
||||
.Distinct();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Resource Title Action ...
|
||||
/// <summary>
|
||||
/// Retrieve Resource Title ...
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <returns></returns>
|
||||
public virtual string GetResourceTitle(
|
||||
object owner = null,
|
||||
object identifier = null
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = item;
|
||||
|
||||
//
|
||||
// Normalization ...
|
||||
var ownerStr =
|
||||
!owner.IsNull()
|
||||
? $"{owner}"
|
||||
: string.Empty;
|
||||
var identifierStr =
|
||||
!identifier.IsNull()
|
||||
? $"{identifier}"
|
||||
: string.Empty;
|
||||
|
||||
//
|
||||
// Handle Owner Attach ...
|
||||
if (!ownerStr.IsNullOrEmpty())
|
||||
{
|
||||
result = $"{result}_{ownerStr}";
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Identifier Attach ...
|
||||
if (!identifierStr.IsNullOrEmpty())
|
||||
{
|
||||
result = $"{result}_{identifierStr}";
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
private string NormalizedLanguage(
|
||||
string language = null
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = language;
|
||||
if (result.IsNullOrEmpty())
|
||||
{
|
||||
result = GetDefaultLanguage();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetDefaultLanguage()
|
||||
{
|
||||
//
|
||||
var result = appConfig.DefaultLanguage;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<XStringDto>> ExtractStrings(
|
||||
string resourceTitle,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
IEnumerable<XStringDto> result = [];
|
||||
|
||||
//
|
||||
if (resourceTitle.IsNullOrEmpty())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = await stringProvider.FindManyAsync(
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: true,
|
||||
cancellationToken: cancellationToken,
|
||||
orderBuilder: x => x.OrderBy(y => y.Id),
|
||||
predicate: x => x.ResourceTitle
|
||||
.ToNormalString()
|
||||
.Contains(resourceTitle.ToNormalString())
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<XStringDto>> ExtractStrings(
|
||||
object owner,
|
||||
object identifier,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var resourceTitle = GetResourceTitle(
|
||||
owner: owner,
|
||||
identifier: identifier
|
||||
);
|
||||
|
||||
//
|
||||
var result = await ExtractStrings(
|
||||
resourceTitle: resourceTitle,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using xModels.Dtos;
|
||||
using System.Threading.Tasks;
|
||||
using xStringService.Extensions;
|
||||
using xStringService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
|
||||
namespace xStringService.Providers
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xStringService.Configurations.Entities;
|
||||
using xDataService.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Configurations.Entities;
|
||||
|
||||
namespace xStringService.Providers
|
||||
{
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xIdentityModels.Models;
|
||||
using xModels.Dtos;
|
||||
using xPushService.Providers;
|
||||
using xStringService.Extensions;
|
||||
using xStringService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using xStringService.Models.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
using xStringService.Providers.Dtos;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xStringService.Providers
|
||||
{
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
<packageSources>
|
||||
<!-- <add key="megan" value="https://hub.megan.ir/nuget/index.json" /> -->
|
||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
<add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" disableTLSCertificateValidation="true" />
|
||||
<!-- <add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" disableTLSCertificateValidation="true" /> -->
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<!-- Icon Handling -->
|
||||
<ItemGroup>
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
<None Include="../../Documents/Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
PackagePath="\icon.png" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
<!-- For XML Documentation Support -->
|
||||
<PropertyGroup>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user