1 | import { Server } from '../types/fastify'
|
2 | import Thread from '../types/Thread'
|
3 |
|
4 | function thread ({ name, id, isGroup }: Thread) {
|
5 | return { name, id, isGroup }
|
6 | }
|
7 |
|
8 | export default async (app: Server) => {
|
9 | app.get('/threads', async (request, reply) => {
|
10 | return Array.from(messenger.threads.values()).map(thread)
|
11 | })
|
12 | }
|