English
Topic 11. Messages and attachments: uploads, sending, replies, editing, deleting and history pages
Goal: implement the heart of the messenger — uploading files before sending, sending a message with replies and attachments in one transaction that also moves the chat to the top of the list, editing and soft-deleting messages, paging through the history with opaque cursors — and finish the business layer with its last tests.
Where we are
The last topic of the business layer (Fig. 11.1). After it, Chatex.Core is complete and the API of module 4 only has to expose it.
Fig. 11.1. The message and attachment services
- Starting point: topic 10 — chats, permissions and events work; 26 business tests pass.
- At the end of the topic all services of Chatex.Core are registered, and 60 tests pass: 19 data tests and 41 business tests.
Steps
- Attachments — upload limits and errors · uploading · downloading for members only · cleaning up unsent uploads
- The message service — validators · sending in one transaction · editing · soft deletion · history pages · registration
- Testing messages — the last helpers · attachment and message tests · the remaining chat tests
- Checkpoint — what must work, self-check questions and exercises
Materials
- Course slides, part 1 (slide "How a request flows") and part 3, Backend in C# (slides "A service method: sending a message", "Unit of Work and retries")
Messages/,Attachments/MessageServiceTests.cs,AttachmentServiceTests.csDocs/DataModel.md– files and soft deletes