KI-AGENT: Live-Sync und Nachrichtenaktionen im Chat ergänzen
This commit is contained in:
@@ -736,6 +736,21 @@ export default async function communicationRoutes(server: FastifyInstance) {
|
||||
}
|
||||
})
|
||||
|
||||
server.get("/communication/matrix/rooms/:roomKey/sync", async (req, reply) => {
|
||||
try {
|
||||
const query = req.query as { since?: string; initial?: string }
|
||||
return await matrix.syncTenantRoomEvents(
|
||||
req.user.user_id,
|
||||
req.user.tenant_id,
|
||||
roomOptionsFromRequest(req),
|
||||
query.since,
|
||||
query.initial === "1"
|
||||
)
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix sync failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.get("/communication/matrix/rooms/:roomKey/members", async (req, reply) => {
|
||||
try {
|
||||
return await matrix.getTenantRoomMembers(
|
||||
@@ -851,6 +866,36 @@ export default async function communicationRoutes(server: FastifyInstance) {
|
||||
}
|
||||
})
|
||||
|
||||
server.put("/communication/matrix/rooms/:roomKey/messages/:eventId", async (req, reply) => {
|
||||
try {
|
||||
const params = req.params as { eventId: string }
|
||||
const body = req.body as { text?: string }
|
||||
return await matrix.editTenantRoomMessage(
|
||||
req.user.user_id,
|
||||
req.user.tenant_id,
|
||||
roomOptionsFromRequest(req),
|
||||
params.eventId,
|
||||
body.text || ""
|
||||
)
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix message edit failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.delete("/communication/matrix/rooms/:roomKey/messages/:eventId", async (req, reply) => {
|
||||
try {
|
||||
const params = req.params as { eventId: string }
|
||||
return await matrix.redactTenantRoomMessage(
|
||||
req.user.user_id,
|
||||
req.user.tenant_id,
|
||||
roomOptionsFromRequest(req),
|
||||
params.eventId
|
||||
)
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix message delete failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.post("/communication/matrix/rooms/:roomKey/attachments", async (req, reply) => {
|
||||
try {
|
||||
const attachment = await uploadedAttachmentFromRequest(req)
|
||||
|
||||
Reference in New Issue
Block a user