Open Closed

Add extra Properties for chat module #6786


User avatar
0
datdv1 created

Hi Support Team ABP!

ABP Framework version: v7.4.4

UI Type:Angular

Database System: MongoDB

Tiered (for MVC) or Auth Server Separated (for Angular): no

We are using chat module for our proejct, it works normally. Due to make compatible to our requirement, we need to extra properties for chat module and also add logic for field and it work fine. However, We know that everytime ABP update to the new version, our code will need to be implement again and may align with the new change from abp

This will increase development cost, so colud you please give us a best practice and step by step guide for resolve this problem


6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Unfortunately there is no good way.

    But there are tools that can help you compare changes to file content: https://winmerge.org/

  • User Avatar
    0
    datdv1 created

    Hi liangshiwei! I just want to add 3 more properties (EntityId, EntityCategory, Attachments(is a list of object)) to the Message entity. Please, show me how to do this with extra properties configure?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I think you can add the module source code to the solution to customize it.

    Since the source code is already in your solution, you can make any changes you want

  • User Avatar
    0
    dzungle created

    Hi Liangshiwei,

    We don’t want to customize the source code as we need to upgrade to the newer abp versions. Does the Chat module support extra properties configuration like other module? If yes, show us how to configure to add more properties to the Message entity. If the Chat module does not support configuring extra properties, please advise us the best way to add more properties to the Message entity so that we could update to the newer abp version without reimplementing to code. Thank you in advance

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Does the Chat module support extra properties configuration like other module? If yes, show us how to configure to add more properties to the Message entity. If the Chat module does not support configuring extra properties, please advise us the best way to add more properties to the Message entity so that we could update to the newer abp version without reimplementing to code.

    Unfortunately, Chat module does not support extra properties

    You can create a new entity instead of extending an existing one:

    public class MessageExtras: Entity...
    {
        public Guid MessageId { get; set;} // message foreign key
        public Guid EntityId {get; set;}
        
        public string EntityCategory {get; set;}
        
        public List<string> Attachments { get; set}  
    }
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    In your case, I wouldn't recommend extending the chat backend code, but only customizing the UI.

    You can download the UI source code and add to your solution: https://docs.abp.io/en/abp/latest/UI/Angular/Component-Replacement

    In the UI you can make HTTP requests to your application service, for example:

    public class MessageExtrasAppService: ...
    {
         public async Task GetMessageExtrasAsync(Guid messageId)
         {
         
         }
         
         public async Task UploadAttachmentAsync(...)
         {
            
         }
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11