chore(server/messages): Type create message response

This commit is contained in:
Taso authored and Taso committed 2021-03-16 16:24:27 -04:00
1 parent 1a9c21f89d
commit 9ffca0d14e
1 file changed
+3 -4
+3 -4
View File
@@ -1,5 +1,3 @@
import md5 from 'md5';
import events from '../utils/events'; import events from '../utils/events';
import { CreateMessageGroupResult, Message, MessageGroup } from '../../typings/messages'; import { CreateMessageGroupResult, Message, MessageGroup } from '../../typings/messages';
import { pool, withTransaction } from './db'; import { pool, withTransaction } from './db';
@@ -44,13 +42,14 @@ interface MessageGroupMapping {
* @param userIdentifier - identifier of the user creating this message * @param userIdentifier - identifier of the user creating this message
* @param groupId - the message group ID to attach this message to * @param groupId - the message group ID to attach this message to
* @param message - content of the message * @param message - content of the message
* @param participants -
*/ */
async function createMessage( async function createMessage(
userIdentifier: string, userIdentifier: string,
groupId: string, groupId: string,
message: string, message: string,
participants: string[], participants: string[],
): Promise<any> { ): Promise<UnformattedMessageGroup[]> {
const query = ` const query = `
INSERT INTO npwd_messages INSERT INTO npwd_messages
(user_identifier, message, group_id) (user_identifier, message, group_id)
@@ -70,7 +69,7 @@ async function createMessage(
.map((s) => pool.query(groupQuery, [s, groupId])), .map((s) => pool.query(groupQuery, [s, groupId])),
); );
return results; return <UnformattedMessageGroup[]>results;
} }
/** /**