u
This commit is contained in:
@@ -9,9 +9,8 @@ export const MODELCONVERSATION_COLUMNS = `
|
||||
started_by
|
||||
`;
|
||||
|
||||
export const LIST_BY_COMPANYUSER = `
|
||||
SELECT
|
||||
${MODELCONVERSATION_COLUMNS},
|
||||
/** Raw stored payload of the conversation's first `user` message; `c` is the conversation alias. */
|
||||
const FIRST_USER_MESSAGE_COLUMN = `
|
||||
(
|
||||
SELECT m.message
|
||||
FROM modelmessage m
|
||||
@@ -21,6 +20,12 @@ ${MODELCONVERSATION_COLUMNS},
|
||||
WHERE f.conversation_id = c.id AND f.role = 'user'
|
||||
)
|
||||
) AS first_user_message
|
||||
`;
|
||||
|
||||
export const LIST_BY_COMPANYUSER = `
|
||||
SELECT
|
||||
${MODELCONVERSATION_COLUMNS},
|
||||
${FIRST_USER_MESSAGE_COLUMN}
|
||||
FROM modelconversation c
|
||||
WHERE c.companyuser_id = @companyuserId
|
||||
ORDER BY c.updated_at DESC, c.id DESC
|
||||
@@ -28,9 +33,10 @@ ORDER BY c.updated_at DESC, c.id DESC
|
||||
|
||||
export const GET_BY_COMPANYUSER_AND_ID = `
|
||||
SELECT
|
||||
${MODELCONVERSATION_COLUMNS}
|
||||
FROM modelconversation
|
||||
WHERE id = @id AND companyuser_id = @companyuserId
|
||||
${MODELCONVERSATION_COLUMNS},
|
||||
${FIRST_USER_MESSAGE_COLUMN}
|
||||
FROM modelconversation c
|
||||
WHERE c.id = @id AND c.companyuser_id = @companyuserId
|
||||
`;
|
||||
|
||||
export const CREATE = `
|
||||
|
||||
Reference in New Issue
Block a user