Starts in:
2 DAYS
4 HRS
6 MIN
56 SEC
Starts in:
2 D
4 H
6 M
56 S
Open Closed

Customizing the Entity Changes #5256


User avatar
0
ed_developer2 created

Hello,

  1. I am trying to add pagination to below API. But there is no pagination parameters defined in this api. Can I modify this api to add pagination. "/api/audit-logging/audit-logs/entity-changes-with-username"

  2. There is another API of audit-logging which contains the sorting and pagination.But I also require the username of the person who modified the entity which is not available in this API. "/api/audit-logging/audit-logs/entity-changes" We wanted to show history changes of entity by any user.

  3. We want to group that result from the API according to month and Show this listing in Angular.


3 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    Yes you can override or extend this app service, please read more about this here https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services#customizing-the-application-modules-overriding-services

  • User Avatar
    0
    ed_developer2 created

    Hi, Can you help me to override the service to add username to it. otherwise help me to add pagination to the first api.(1st point).

    Thank you.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    At present, you can't add parameters to existing endpoints. You can create your own application service to do it.

    Or you can get the parameters from the HTTP context.

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IAuditLogsAppService))]
    public class MyAuditLogsAppService : AuditLogsAppService
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        
        public MyAuditLogsAppService(IAuditLogRepository auditLogRepository, IJsonSerializer jsonSerializer,
            IPermissionChecker permissionChecker, IPermissionDefinitionManager permissionDefinitionManager, IHttpContextAccessor httpContextAccessor) : base(
            auditLogRepository, jsonSerializer, permissionChecker, permissionDefinitionManager)
        {
            _httpContextAccessor = httpContextAccessor;
        }
    
        public override Task<List<EntityChangeWithUsernameDto>> GetEntityChangesWithUsernameAsync(EntityChangeFilter input)
        {
            var maxResultCount = _httpContextAccessor.HttpContext.Request.Query["MaxResultCount"];
            var skipCount = _httpContextAccessor.HttpContext.Request.Query["skipCount"];
            
            
            ... query here
        }
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06