diff --git a/server/AyaNova/Controllers/AttachmentController.cs b/server/AyaNova/Controllers/AttachmentController.cs
index 176b6211..9d8cd75a 100644
--- a/server/AyaNova/Controllers/AttachmentController.cs
+++ b/server/AyaNova/Controllers/AttachmentController.cs
@@ -12,7 +12,7 @@ using AyaNova.Models;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Util;
using AyaNova.Biz;
-
+using System.Linq;
namespace AyaNova.Api.Controllers
{
@@ -52,7 +52,34 @@ namespace AyaNova.Api.Controllers
//TODO: list with : name, notes, id, mimetype, lastmodified date
-//TODO: Update notes / filename PUT route
+ //TODO: Update notes / filename PUT route
+
+
+
+ ///
+ /// Get attachments for object type and id specified
+ ///
+ /// Required Role: Read full object properties rights to object type specified
+ ///
+ ///
+ /// file attachment list for object
+ [HttpGet("List")]
+ public async Task GetList([FromQuery] AyaType ayaType, [FromQuery] long ayaId)
+ {
+ if (serverState.IsClosed)
+ return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
+
+ if (!Authorized.HasReadFullRole(HttpContext.Items, ayaType))
+ {
+ return StatusCode(403, new ApiNotAuthorizedResponse());
+ }
+
+ if (!ModelState.IsValid)
+ return BadRequest(new ApiErrorResponse(ModelState));
+ var ret = await ct.FileAttachment.AsNoTracking().Where(m => m.AttachToObjectId == ayaId && m.AttachToObjectType == ayaType).OrderBy(m => m.DisplayFileName).Select(m => new { m.Id, m.ConcurrencyToken, m.ContentType, m.DisplayFileName, m.LastModified, m.Notes }).ToArrayAsync();
+ return Ok(ApiOkResponse.Response(ret, true));
+ }
+
///
/// Upload attachment file