When an event-based group is automatically archived or deleted after the event time passes, its chat history must be removed as well. The messaging API already provides a repository hook for this through GroupMessageRepository.deleteByGroupId(Long groupId). The group lifecycle/archive implementation should call this method before or during group cleanup.
Acceptance Criteria:
When a group is auto-archived/deleted, all messages belonging to that group are deleted.
Message deletion happens in the same transaction as the group cleanup where possible.
Archived/deleted groups no longer expose chat history through GET /groups/{groupId}/messages.
No orphaned group_messages records remain after group cleanup.
Existing group archive/delete behavior still works.
Tests cover message cleanup during group archive/delete.
Technical Notes:
Use GroupMessageRepository.deleteByGroupId(groupId).
This task should be implemented together with or after the group auto-archive lifecycle task.
Avoid relying only on JPA cascade because archive may be a status change, not a physical delete.
When an event-based group is automatically archived or deleted after the event time passes, its chat history must be removed as well. The messaging API already provides a repository hook for this through GroupMessageRepository.deleteByGroupId(Long groupId). The group lifecycle/archive implementation should call this method before or during group cleanup.
Acceptance Criteria:
When a group is auto-archived/deleted, all messages belonging to that group are deleted.
Message deletion happens in the same transaction as the group cleanup where possible.
Archived/deleted groups no longer expose chat history through GET /groups/{groupId}/messages.
No orphaned group_messages records remain after group cleanup.
Existing group archive/delete behavior still works.
Tests cover message cleanup during group archive/delete.
Technical Notes:
Use GroupMessageRepository.deleteByGroupId(groupId).
This task should be implemented together with or after the group auto-archive lifecycle task.
Avoid relying only on JPA cascade because archive may be a status change, not a physical delete.