Skip to content

Commit 2e23487

Browse files
authored
feature: buerokratt#47 csa can see end user typed text before send (buerokratt#145)
* feature: buerokratt#47 add post message preview * feature buerokratt#47 get message preview stream * feature: buerokratt#47 * feature buerokratt#47 * remove step * refactor
1 parent 42d193c commit 2e23487

8 files changed

+117
-1
lines changed
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"chatId": "{{chatId}}",
3+
"content": "{{{escape_special_chars content}}}"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd
7+
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd">
8+
9+
<changeSet id="20230208124800" author="Net Group">
10+
<createTable tableName="message_preview">
11+
<column name="chat_base_id" type="varchar(36)">
12+
<constraints unique="true" nullable="false"/>
13+
</column>
14+
<column name="content" type="varchar(3000)">
15+
</column>
16+
</createTable>
17+
</changeSet>
18+
</databaseChangeLog>

DSL.Resql/delete-message-preview.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DELETE FROM message_preview WHERE chat_base_id = :chatId;

DSL.Resql/get-chat-messages-updated-after-time.sql

+2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ SELECT m.base_id AS id,
1010
m.forwarded_by_user,
1111
m.forwarded_from_csa,
1212
m.forwarded_to_csa,
13+
mp.content AS preview,
1314
rating,
1415
created,
1516
updated
1617
FROM message m
18+
INNER JOIN message_preview mp ON m.chat_base_id = mp.chat_base_id
1719
WHERE id IN (SELECT max(id) FROM message WHERE chat_base_id = :chatId GROUP BY base_id)
1820
AND :timeRangeBegin::timestamp
1921
with time zone < m.updated

DSL.Resql/insert-message-preview.sql

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INSERT INTO message_preview(chat_base_id, content)
2+
VALUES (:chatId, :content)
3+
ON CONFLICT(chat_base_id) DO UPDATE SET content = :content;

DSL.Ruuter-v1.private/chat/cs-end-chat.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@
113113
}
114114
}
115115
},
116+
{
117+
"delete_message_previews": {
118+
"verify": {
119+
"response": {
120+
"ok": "proceed",
121+
"nok": "stop"
122+
}
123+
},
124+
"proceed": {
125+
"method": "post",
126+
"endpoint": "{resql_url}/delete-message-preview",
127+
"post_body_struct": {
128+
"chatId": "{#.reflect_input#.chatId}"
129+
}
130+
},
131+
"response": {
132+
"ok": "proceed",
133+
"nok": "stop"
134+
}
135+
}
136+
},
116137
{
117138
"get_allowed_statuses": {
118139
"verify": {
@@ -132,7 +153,8 @@
132153
}
133154
}
134155
},
135-
{"formatted_allowed_statuses": {
156+
{
157+
"formatted_allowed_statuses": {
136158
"verify": {
137159
"response": {
138160
"ok": "proceed",

DSL.Ruuter-v1.public/chat/end-chat.json

+21
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,27 @@
5050
}
5151
}
5252
},
53+
{
54+
"delete_message_previews": {
55+
"verify": {
56+
"response": {
57+
"ok": "proceed",
58+
"nok": "stop"
59+
}
60+
},
61+
"proceed": {
62+
"method": "post",
63+
"endpoint": "{resql_url}/delete-message-preview",
64+
"post_body_struct": {
65+
"chatId": "{#.reflect_input#.chatId}"
66+
}
67+
},
68+
"response": {
69+
"ok": "proceed",
70+
"nok": "stop"
71+
}
72+
}
73+
},
5374
{
5475
"forwarding_validation": {
5576
"verify": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"action_type": "BLOGIC",
3+
"destination": [
4+
{
5+
"reflect_input": {
6+
"verify": {
7+
"response": {
8+
"ok": "proceed",
9+
"nok": "stop"
10+
}
11+
},
12+
"proceed": {
13+
"method": "post",
14+
"endpoint": "{dmapper_url}/json/v2/reflect_message_preview",
15+
"post_body_struct": {
16+
"chatId": "{#.chatId}",
17+
"content": "{#.content}"
18+
}
19+
}
20+
}
21+
},
22+
{
23+
"post_message_preview": {
24+
"verify": {
25+
"response": {
26+
"ok": "proceed",
27+
"nok": "stop"
28+
}
29+
},
30+
"proceed": {
31+
"method": "post",
32+
"endpoint": "{resql_url}/insert-message-preview",
33+
"post_body_struct": {
34+
"chatId": "{#.reflect_input#.chatId}",
35+
"content": "{#.reflect_input#.content}"
36+
},
37+
"response": {
38+
"ok": "proceed",
39+
"nok": "stop"
40+
}
41+
}
42+
}
43+
}
44+
]
45+
}

0 commit comments

Comments
 (0)