ChatMessage
The ChatMessage entity, mapped to the messages table.
| Table | messages |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 4 |
| Relationships | 3 |
| Source | backend/src/main/java/com/motorph/payroll/model/ChatMessage.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
messageId | Integer | message_id | — | primary key, generated |
messageContent | String | message_content | — | — |
sentAt | LocalDateTime | sent_at | — | — |
status | String | status | — | — |
Plus tenant_id, inherited from TenantOwned. Hibernate stamps it on insert and adds where tenant_id = ? to every query, so it is never written or read by application code.
Relationships
| Field | Kind | Target | Join column | Required |
|---|---|---|---|---|
sender | @ManyToOne | Employee | sender_employee_id | Yes |
recipient | @ManyToOne | Employee | recipient_employee_id | Yes |
conversation | @ManyToOne | Conversation | conversation_id | Yes |
Neighbourhood
Repository
ChatMessageRepository
Declared over ChatMessage with id type Integer. Source: backend/src/main/java/com/motorph/payroll/repository/ChatMessageRepository.java
| Method | Returns | Notes |
|---|---|---|
findByConversation(@Param("convId") Integer convId, Pageable pageable) | Page<ChatMessage> | explicit @Query |
findLatestByConversation(@Param("convId") Integer convId, Limit limit) | List<ChatMessage> | explicit @Query |
findBeforeCursorByConversation(@Param("convId") Integer convId, @Param("before") Integer before, Limit limit) | List<ChatMessage> | explicit @Query |
markConversationMessagesRead(@Param("convId") Integer convId, @Param("empId") Integer empId) | int | explicit @Query, modifying |
Reached by
These controllers hold — directly or through a service they depend on — a repository over ChatMessage.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| ConversationController | /api/conversations | 5 | Platform Misc |
Generated page
This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.