last works ...
This commit is contained in:
@@ -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
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Tags/Attach")]
|
||||
public async Task<ActionResult> TagAttach(
|
||||
public virtual async Task<ActionResult> TagAttach(
|
||||
[FromQuery] string tag,
|
||||
[FromQuery] Guid id
|
||||
)
|
||||
@@ -98,7 +97,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Tags/Detach")]
|
||||
public async Task<ActionResult> TagDetach(
|
||||
public virtual async Task<ActionResult> TagDetach(
|
||||
[FromQuery] string tag,
|
||||
[FromQuery] Guid id
|
||||
)
|
||||
@@ -140,7 +139,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Tags/AttachMany")]
|
||||
public async Task<ActionResult> TagsAttach(
|
||||
public virtual async Task<ActionResult> TagsAttach(
|
||||
[FromQuery] string tags,
|
||||
[FromQuery] Guid id
|
||||
)
|
||||
@@ -185,7 +184,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Tags/DetachMany")]
|
||||
public async Task<ActionResult> TagsDetach(
|
||||
public virtual async Task<ActionResult> TagsDetach(
|
||||
[FromQuery] string tags,
|
||||
[FromQuery] Guid id
|
||||
)
|
||||
@@ -232,7 +231,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/Stream/ById")]
|
||||
public async Task<ActionResult> Stream(
|
||||
public virtual async Task<ActionResult> Stream(
|
||||
[FromRoute] Guid id
|
||||
)
|
||||
{
|
||||
@@ -260,7 +259,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{name}/Stream/ByName")]
|
||||
public async Task<ActionResult<FileStreamResult>> Stream(
|
||||
public virtual async Task<ActionResult> Stream(
|
||||
[FromRoute] string name
|
||||
)
|
||||
{
|
||||
@@ -288,7 +287,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/Download/ById")]
|
||||
public async Task<ActionResult> Download(
|
||||
public virtual async Task<ActionResult> Download(
|
||||
[FromRoute] Guid id
|
||||
)
|
||||
{
|
||||
@@ -316,7 +315,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{name}/Download/ByName")]
|
||||
public async Task<ActionResult> Download(
|
||||
public virtual async Task<ActionResult> Download(
|
||||
[FromRoute] string name
|
||||
)
|
||||
{
|
||||
@@ -345,7 +344,7 @@ namespace xFileService.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost("Upload")]
|
||||
[RequestSizeLimit(966_367_641)]
|
||||
public async Task<ActionResult<IEnumerable<XFileDto>>> Upload(
|
||||
public virtual async Task<ActionResult<IEnumerable<XFileDto>>> Upload(
|
||||
[FromForm] IFormFileCollection files
|
||||
)
|
||||
{
|
||||
@@ -386,7 +385,7 @@ namespace xFileService.Controllers
|
||||
/// <returns></returns>
|
||||
/// [HttpDelete("Remove")]
|
||||
[HttpDelete("Remove")]
|
||||
public async Task<ActionResult<IEnumerable<Guid>>> Remove(
|
||||
public virtual async Task<ActionResult<IEnumerable<Guid>>> Remove(
|
||||
[FromQuery] string ids
|
||||
) {
|
||||
//
|
||||
@@ -426,10 +425,9 @@ namespace xFileService.Controllers
|
||||
/// Get Specified File Model ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<XFileDto>> Get(
|
||||
public virtual async Task<ActionResult<XFileDto>> Get(
|
||||
[FromRoute] Guid id
|
||||
) {
|
||||
//
|
||||
@@ -454,10 +452,9 @@ namespace xFileService.Controllers
|
||||
/// <summary>
|
||||
/// Get All Exists File Models ...
|
||||
/// </summary>
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("All")]
|
||||
public async Task<ActionResult<IEnumerable<XFileDto>>> GetAll() {
|
||||
public virtual async Task<ActionResult<IEnumerable<XFileDto>>> GetAll() {
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
@@ -483,7 +480,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Query")]
|
||||
public async Task<ActionResult<XQueryResult<XFileDto>>> Query(
|
||||
public virtual async Task<ActionResult<XQueryResult<XFileDto>>> Query(
|
||||
[FromQuery] XQuery query
|
||||
) {
|
||||
//
|
||||
@@ -511,7 +508,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Owned/Query")]
|
||||
public async Task<ActionResult<XQueryResult<XFileDto>>> QueryOwned(
|
||||
public virtual async Task<ActionResult<XQueryResult<XFileDto>>> QueryOwned(
|
||||
[FromQuery] XQuery query
|
||||
) {
|
||||
//
|
||||
@@ -545,7 +542,7 @@ namespace xFileService.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Count")]
|
||||
public async Task<ActionResult<int>> Count() {
|
||||
public virtual async Task<ActionResult<int>> Count() {
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
@@ -571,7 +568,7 @@ namespace xFileService.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/IsExists")]
|
||||
public async Task<ActionResult<bool>> IsExists(
|
||||
public virtual async Task<ActionResult<bool>> IsExists(
|
||||
[FromRoute] Guid id
|
||||
) {
|
||||
//
|
||||
|
||||
@@ -77,11 +77,13 @@ namespace xFileService.Interfaces
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XFileDto>> Upload(
|
||||
TKey forProvidedId,
|
||||
IFormFileCollection files,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -90,11 +92,13 @@ namespace xFileService.Interfaces
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Guid>> Remove(
|
||||
TKey forProvidedId,
|
||||
string ids,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
string ids = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace xFileService.Interfaces
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> TagAttach(
|
||||
string tag,
|
||||
Guid id
|
||||
[FromQuery] string tag,
|
||||
[FromQuery] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -32,8 +32,8 @@ namespace xFileService.Interfaces
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> TagDetach(
|
||||
string tag,
|
||||
Guid id
|
||||
[FromQuery] string tag,
|
||||
[FromQuery] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -43,8 +43,8 @@ namespace xFileService.Interfaces
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> TagsAttach(
|
||||
string tags,
|
||||
Guid id
|
||||
[FromQuery] string tags,
|
||||
[FromQuery] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -54,8 +54,8 @@ namespace xFileService.Interfaces
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> TagsDetach(
|
||||
string tags,
|
||||
Guid id
|
||||
[FromQuery] string tags,
|
||||
[FromQuery] Guid id
|
||||
);
|
||||
#endregion
|
||||
|
||||
@@ -66,28 +66,36 @@ namespace xFileService.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> Stream(Guid id);
|
||||
Task<ActionResult> Stream(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Stream Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<FileStreamResult>> Stream(string fileName);
|
||||
Task<ActionResult> Stream(
|
||||
[FromRoute] string fileName
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Download Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> Download(Guid id);
|
||||
Task<ActionResult> Download(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Download Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> Download(string fileName);
|
||||
Task<ActionResult> Download(
|
||||
[FromRoute] string name
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Upload Files ...
|
||||
@@ -95,7 +103,7 @@ namespace xFileService.Interfaces
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> Upload(
|
||||
IFormFileCollection files
|
||||
[FromForm] IFormFileCollection files
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -104,7 +112,7 @@ namespace xFileService.Interfaces
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<Guid>>> Remove(
|
||||
string ids
|
||||
[FromQuery] string ids
|
||||
);
|
||||
#endregion
|
||||
|
||||
@@ -117,7 +125,7 @@ namespace xFileService.Interfaces
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XFileDto>> Get(
|
||||
Guid id
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -133,7 +141,7 @@ namespace xFileService.Interfaces
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XFileDto>>> Query(
|
||||
XQuery query
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -142,7 +150,7 @@ namespace xFileService.Interfaces
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XFileDto>>> QueryOwned(
|
||||
XQuery query
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -157,7 +165,7 @@ namespace xFileService.Interfaces
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<bool>> IsExists(
|
||||
Guid id
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<XFileDto>> 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
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<Guid>> 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<string> { 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
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user