Create conversations API routes
Changes:
- Create new conversationRouter with routes for conversations
- Add conversation-related methods to Jamid
- Use Message interface over Record<string, string>
- Add return type annotations for functions in Jamid
- Simplify returned value for account creation/registration
GitLab: #95
Change-Id: Ib0af8b60a92d08ddf4843f874c811e4ead870174
diff --git a/server/src/routers/account-router.ts b/server/src/routers/account-router.ts
index 18b1554..59bad05 100644
--- a/server/src/routers/account-router.ts
+++ b/server/src/routers/account-router.ts
@@ -59,12 +59,16 @@
res.sendStatus(HttpStatusCode.NoContent);
});
-accountRouter.post('/send-account-message', (req: Request<ParamsDictionary, any, SendAccountTextMessageApi>, res) => {
- const { from, to, type, data } = req.body;
- if (!from || !to || !type || !data) {
- res.status(HttpStatusCode.BadRequest).send('Missing arguments in request');
- return;
+accountRouter.post(
+ '/send-account-message',
+ (req: Request<ParamsDictionary, string, SendAccountTextMessageApi>, res) => {
+ const { from, to, type, data } = req.body;
+ if (!from || !to || !type || !data) {
+ res.status(HttpStatusCode.BadRequest).send('Missing arguments in request');
+ return;
+ }
+
+ jamid.sendAccountTextMessage(from, to, type, data);
+ res.end();
}
- jamid.sendAccountTextMessage(from, to, type, data);
- res.end();
-});
+);