Skip to content

Commit

Permalink
chore: update scripts to set an initial database for some basic testing
Browse files Browse the repository at this point in the history
Update docker-compose.yaml with some new environment variables and
remove .env from .dockerignore
Update email in package.json
Added in .gitignore .vscode folder
  • Loading branch information
mrodm committed Apr 21, 2021
1 parent 84e71f1 commit 3c9f9ee
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.vscode
doc
local-development
.env

*.md
*.png
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ dist
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# VSCode configuration folder
.vscode/*

# yarn v2
.yarn/cache
.yarn/unplugged
Expand Down
2 changes: 2 additions & 0 deletions local-development/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ services:
volumes:
- ..:/usr/src/app/
environment:
- STORAGE=mysql
- MYSQL_HOST=mpm-db
- LOG_LEVEL=debug
depends_on:
- mpm-db
ports:
Expand Down
2 changes: 1 addition & 1 deletion local-development/scripts/populate-topics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
for i in {1..100}
do
curl -H 'Content-Type: application/json' \
-d "{\"name\": \"topic $i\"}" -s \
-d "{\"name\": \"topic-$i\"}" -s \
localhost:3978/api/v1/admin/topics
done
32 changes: 32 additions & 0 deletions local-development/scripts/populate_users_and_subscriptions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

echo "Adding user1..."
docker-compose exec -T mpm-db mysql -D msteamsbot -e "INSERT INTO \`Users\` (\`id\`, \`user\`, \`conversationKey\`, \`conversationRef\`, \`createdAt\`, \`updatedAt\`) VALUES (10, 'user1', '95f50d5c-e86c-4ede-8d26-00303afbd310|livechat', '{\"bot\": {\"id\": \"93e5eca1-60f3-4401-964b-09891d9172a6\", \"name\": \"Bot\", \"role\": \"bot\"}, \"user\": {\"id\": \"c75b3d70-caeb-4b2c-96ec-dc57f8f15349\", \"name\": \"User\", \"role\": \"user\"}, \"locale\": \"\", \"channelId\": \"emulator\", \"activityId\": \"60e92a94-0bc1-4bd8-bf50-00ab7ebafcaf\", \"serviceUrl\": \"https://378f3c3ecbb7.ngrok.io\", \"conversation\": {\"id\": \"95f50d5c-e86c-4ede-8d26-00303afbd310|livechat\"}}', '2021-03-25 14:25:59', '2021-04-12 13:17:49') ;"
echo "Done."

echo ""

echo "Adding user2..."
docker-compose exec -T mpm-db mysql -D msteamsbot -e "INSERT INTO \`Users\` (\`id\`, \`user\`, \`conversationKey\`, \`conversationRef\`, \`createdAt\`, \`updatedAt\`) VALUES (11, 'user2', '758681cd-8c9d-4159-b831-64455a549a39|livechat', '{\"bot\": {\"id\": \"b9dcb1f0-a2b9-11eb-acc9-63bb7bbface3\", \"name\": \"Bot\", \"role\": \"bot\"}, \"user\": {\"id\": \"e7692c26-aad4-4c68-a670-64731c37fe2b\", \"name\": \"User\", \"role\": \"user\"}, \"locale\": \"\", \"channelId\": \"emulator\", \"activityId\": \"b9f85040-a2b9-11eb-bd10-75264fb10b53\", \"serviceUrl\": \"https://ca723b1fddaf.ngrok.io\", \"conversation\": {\"id\": \"758681cd-8c9d-4159-b831-64455a549a39|livechat\"}}', '2021-04-21 15:53:35', '2021-04-21 15:53:35') ;"
echo "Done."

echo ""

echo "Adding some subscriptions for user1 and user2..."
curl -s -X PUT -H "content-type: application/json" \
-d '{"user": "user1"}' \
localhost:3978/api/v1/admin/topics/topic1

curl -s -X PUT -H "content-type: application/json" \
-d '{"user": "user2"}' \
localhost:3978/api/v1/admin/topics/topic1

curl -s -X PUT -H "content-type: application/json" \
-d '{"user": "user1"}' \
localhost:3978/api/v1/admin/topics/topic2

curl -s -X PUT -H "content-type: application/json" \
-d '{"user": "user2"}' \
localhost:3978/api/v1/admin/topics/topic3

echo "Done."
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"url": "https://github.com/Telefonica/msteams-private-messages/issues"
},
"author": {
"email": "Lifecycle@telefonica.com",
"email": "novum-lifecycle@telefonica.com",
"name": "Software Lifecycle Team"
},
"maintainers": [
Expand Down

0 comments on commit 3c9f9ee

Please sign in to comment.