KI-AGENT: Mitgliederverwaltung und Suche im Chat umsetzen
This commit is contained in:
@@ -603,6 +603,15 @@ export default async function communicationRoutes(server: FastifyInstance) {
|
||||
}
|
||||
})
|
||||
|
||||
server.get("/communication/matrix/users", async (req, reply) => {
|
||||
try {
|
||||
const users = await matrix.listTenantCommunicationUsers(req.user.tenant_id)
|
||||
return { users }
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix users failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.post("/communication/matrix/rooms/general/session", async (req, reply) => {
|
||||
try {
|
||||
return await matrix.createElementRoomSession(req.user.user_id, req.user.tenant_id, {
|
||||
@@ -713,6 +722,20 @@ export default async function communicationRoutes(server: FastifyInstance) {
|
||||
}
|
||||
})
|
||||
|
||||
server.get("/communication/matrix/rooms/:roomKey/search", async (req, reply) => {
|
||||
try {
|
||||
const query = req.query as { q?: string }
|
||||
return await matrix.searchTenantRoomMessages(
|
||||
req.user.user_id,
|
||||
req.user.tenant_id,
|
||||
roomOptionsFromRequest(req),
|
||||
query.q || ""
|
||||
)
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix search failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.get("/communication/matrix/rooms/:roomKey/members", async (req, reply) => {
|
||||
try {
|
||||
return await matrix.getTenantRoomMembers(
|
||||
@@ -725,6 +748,34 @@ export default async function communicationRoutes(server: FastifyInstance) {
|
||||
}
|
||||
})
|
||||
|
||||
server.post("/communication/matrix/rooms/:roomKey/members/invite", async (req, reply) => {
|
||||
try {
|
||||
const body = req.body as { userId?: string }
|
||||
return await matrix.inviteTenantRoomMember(
|
||||
req.user.user_id,
|
||||
req.user.tenant_id,
|
||||
roomOptionsFromRequest(req),
|
||||
body.userId || ""
|
||||
)
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix member invite failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.delete("/communication/matrix/rooms/:roomKey/members/:matrixUserId", async (req, reply) => {
|
||||
try {
|
||||
const params = req.params as { matrixUserId: string }
|
||||
return await matrix.removeTenantRoomMember(
|
||||
req.user.user_id,
|
||||
req.user.tenant_id,
|
||||
roomOptionsFromRequest(req),
|
||||
params.matrixUserId
|
||||
)
|
||||
} catch (err: any) {
|
||||
return handleMatrixError(req, reply, err, "Matrix member remove failed")
|
||||
}
|
||||
})
|
||||
|
||||
server.post("/communication/matrix/rooms/:roomKey/session", async (req, reply) => {
|
||||
try {
|
||||
return await matrix.createElementRoomSession(
|
||||
|
||||
Reference in New Issue
Block a user