diff --git a/Controllers/XFileServiceControllerBase.cs b/Controllers/XFileServiceControllerBase.cs
index 4686b2f..a0a21d6 100644
--- a/Controllers/XFileServiceControllerBase.cs
+++ b/Controllers/XFileServiceControllerBase.cs
@@ -9,7 +9,6 @@ using xCommons.Configurations;
using xCommons.Extensions;
using xCommons.Providers;
using xFileService.Interfaces;
-using xFileService.Models.Dtos;
using xIdentityService.Controllers;
using xIdentityService.Interfaces;
using xModels.Dtos;
@@ -56,7 +55,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Tags/Attach")]
- public async Task TagAttach(
+ public virtual async Task TagAttach(
[FromQuery] string tag,
[FromQuery] Guid id
)
@@ -98,7 +97,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Tags/Detach")]
- public async Task TagDetach(
+ public virtual async Task TagDetach(
[FromQuery] string tag,
[FromQuery] Guid id
)
@@ -140,7 +139,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Tags/AttachMany")]
- public async Task TagsAttach(
+ public virtual async Task TagsAttach(
[FromQuery] string tags,
[FromQuery] Guid id
)
@@ -185,7 +184,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Tags/DetachMany")]
- public async Task TagsDetach(
+ public virtual async Task TagsDetach(
[FromQuery] string tags,
[FromQuery] Guid id
)
@@ -232,7 +231,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("{id}/Stream/ById")]
- public async Task Stream(
+ public virtual async Task Stream(
[FromRoute] Guid id
)
{
@@ -260,7 +259,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("{name}/Stream/ByName")]
- public async Task> Stream(
+ public virtual async Task Stream(
[FromRoute] string name
)
{
@@ -288,7 +287,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("{id}/Download/ById")]
- public async Task Download(
+ public virtual async Task Download(
[FromRoute] Guid id
)
{
@@ -316,7 +315,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("{name}/Download/ByName")]
- public async Task Download(
+ public virtual async Task Download(
[FromRoute] string name
)
{
@@ -345,7 +344,7 @@ namespace xFileService.Controllers
///
[HttpPost("Upload")]
[RequestSizeLimit(966_367_641)]
- public async Task>> Upload(
+ public virtual async Task>> Upload(
[FromForm] IFormFileCollection files
)
{
@@ -386,7 +385,7 @@ namespace xFileService.Controllers
///
/// [HttpDelete("Remove")]
[HttpDelete("Remove")]
- public async Task>> Remove(
+ public virtual async Task>> Remove(
[FromQuery] string ids
) {
//
@@ -426,10 +425,9 @@ namespace xFileService.Controllers
/// Get Specified File Model ...
///
///
- ///
///
[HttpGet("{id}")]
- public async Task> Get(
+ public virtual async Task> Get(
[FromRoute] Guid id
) {
//
@@ -454,10 +452,9 @@ namespace xFileService.Controllers
///
/// Get All Exists File Models ...
///
- ///
///
[HttpGet("All")]
- public async Task>> GetAll() {
+ public virtual async Task>> GetAll() {
//
// Do ...
try
@@ -483,7 +480,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Query")]
- public async Task>> Query(
+ public virtual async Task>> Query(
[FromQuery] XQuery query
) {
//
@@ -511,7 +508,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Owned/Query")]
- public async Task>> QueryOwned(
+ public virtual async Task>> QueryOwned(
[FromQuery] XQuery query
) {
//
@@ -545,7 +542,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("Count")]
- public async Task> Count() {
+ public virtual async Task> Count() {
//
// Do ...
try
@@ -571,7 +568,7 @@ namespace xFileService.Controllers
///
///
[HttpGet("{id}/IsExists")]
- public async Task> IsExists(
+ public virtual async Task> IsExists(
[FromRoute] Guid id
) {
//
diff --git a/Interfaces/IXBaseFileProvider.cs b/Interfaces/IXBaseFileProvider.cs
index 139a782..a9dc680 100644
--- a/Interfaces/IXBaseFileProvider.cs
+++ b/Interfaces/IXBaseFileProvider.cs
@@ -77,11 +77,13 @@ namespace xFileService.Interfaces
///
///
///
+ ///
///
Task> Upload(
TKey forProvidedId,
IFormFileCollection files,
- XUserClaimsInfoDto userInfo = null
+ XUserClaimsInfoDto userInfo = null,
+ string connectionId = null
);
///
@@ -90,11 +92,13 @@ namespace xFileService.Interfaces
///
///
///
+ ///
///
Task> Remove(
TKey forProvidedId,
- string ids,
- XUserClaimsInfoDto userInfo = null
+ string ids = null,
+ XUserClaimsInfoDto userInfo = null,
+ string connectionId = null
);
///
diff --git a/Interfaces/IXFileServiceControllerActions.cs b/Interfaces/IXFileServiceControllerActions.cs
index a56e3b1..eca2282 100644
--- a/Interfaces/IXFileServiceControllerActions.cs
+++ b/Interfaces/IXFileServiceControllerActions.cs
@@ -21,8 +21,8 @@ namespace xFileService.Interfaces
///
///
Task TagAttach(
- string tag,
- Guid id
+ [FromQuery] string tag,
+ [FromQuery] Guid id
);
///
@@ -32,8 +32,8 @@ namespace xFileService.Interfaces
///
///
Task TagDetach(
- string tag,
- Guid id
+ [FromQuery] string tag,
+ [FromQuery] Guid id
);
///
@@ -43,8 +43,8 @@ namespace xFileService.Interfaces
///
///
Task TagsAttach(
- string tags,
- Guid id
+ [FromQuery] string tags,
+ [FromQuery] Guid id
);
///
@@ -54,8 +54,8 @@ namespace xFileService.Interfaces
///
///
Task TagsDetach(
- string tags,
- Guid id
+ [FromQuery] string tags,
+ [FromQuery] Guid id
);
#endregion
@@ -66,28 +66,36 @@ namespace xFileService.Interfaces
///
///
///
- Task Stream(Guid id);
+ Task Stream(
+ [FromRoute] Guid id
+ );
///
/// Stream Specified File ...
///
///
///
- Task> Stream(string fileName);
+ Task Stream(
+ [FromRoute] string fileName
+ );
///
/// Download Specified File ...
///
///
///
- Task Download(Guid id);
+ Task Download(
+ [FromRoute] Guid id
+ );
///
/// Download Specified File ...
///
- ///
+ ///
///
- Task Download(string fileName);
+ Task Download(
+ [FromRoute] string name
+ );
///
/// Upload Files ...
@@ -95,7 +103,7 @@ namespace xFileService.Interfaces
///
///
Task>> Upload(
- IFormFileCollection files
+ [FromForm] IFormFileCollection files
);
///
@@ -104,7 +112,7 @@ namespace xFileService.Interfaces
///
///
Task>> Remove(
- string ids
+ [FromQuery] string ids
);
#endregion
@@ -117,7 +125,7 @@ namespace xFileService.Interfaces
///
///
Task> Get(
- Guid id
+ [FromRoute] Guid id
);
///
@@ -133,7 +141,7 @@ namespace xFileService.Interfaces
///
///
Task>> Query(
- XQuery query
+ [FromQuery] XQuery query
);
///
@@ -142,7 +150,7 @@ namespace xFileService.Interfaces
///
///
Task>> QueryOwned(
- XQuery query
+ [FromQuery] XQuery query
);
///
@@ -157,7 +165,7 @@ namespace xFileService.Interfaces
///
///
Task> IsExists(
- Guid id
+ [FromRoute] Guid id
);
#endregion
}
diff --git a/Providers/XBaseFileProvider.cs b/Providers/XBaseFileProvider.cs
index 777826b..2b0e3ee 100644
--- a/Providers/XBaseFileProvider.cs
+++ b/Providers/XBaseFileProvider.cs
@@ -5,6 +5,7 @@ using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using MongoDB.Driver.Core.Connections;
using xCommons.Extensions;
using xExceptions.Constants;
using xFileService.Interfaces;
@@ -167,11 +168,13 @@ namespace xFileService.Providers
///
///
///
+ ///
///
public async Task> Upload(
TKey forProvidedId,
IFormFileCollection files,
- XUserClaimsInfoDto userInfo = null
+ XUserClaimsInfoDto userInfo = null,
+ string connectionId = null
)
{
//
@@ -186,7 +189,8 @@ namespace xFileService.Providers
// Here we are Following Custom Senario ...
var dtos = await Provider.Upload(
files: files,
- userInfo: userInfo
+ userInfo: userInfo,
+ connectionId: connectionId
);
//
@@ -237,11 +241,13 @@ namespace xFileService.Providers
///
///
///
+ ///
///
public async Task> Remove(
TKey forProvidedId,
string ids = null,
- XUserClaimsInfoDto userInfo = null
+ XUserClaimsInfoDto userInfo = null,
+ string connectionId = null
)
{
//
@@ -283,7 +289,7 @@ namespace xFileService.Providers
{
//
var dtoIds = new List { dto.Id.ToString() }.ToListString();
- var removeIds = await Provider.Remove(dtoIds, userInfo);
+ var removeIds = await Provider.Remove(dtoIds, userInfo, connectionId);
isValid = !removeIds.IsNull() && removeIds.HasChild() && removeIds.Contains(dto.Id);
if (isValid)
{
@@ -752,11 +758,13 @@ namespace xFileService.Providers
///
///
///
+ ///
///
private async Task AddReference(
TKey forProvidedId,
Guid id,
- XUserClaimsInfoDto userInfo = null
+ XUserClaimsInfoDto userInfo = null,
+ string connectionId = null
)
{
//
@@ -764,6 +772,7 @@ namespace xFileService.Providers
id: id,
userInfo: userInfo,
providedFor: ProvidedFor,
+ connectionId: connectionId,
forProvidedId: forProvidedId
);
}
@@ -778,7 +787,8 @@ namespace xFileService.Providers
private async Task RemoveReference(
TKey forProvidedId,
Guid id,
- XUserClaimsInfoDto userInfo = null
+ XUserClaimsInfoDto userInfo = null,
+ string connectionId = null
)
{
//
@@ -786,6 +796,7 @@ namespace xFileService.Providers
id: id,
userInfo: userInfo,
providedFor: ProvidedFor,
+ connectionId: connectionId,
forProvidedId: forProvidedId
);
}