Skip to content

Commit

Permalink
Fix message listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinan-96 committed Sep 16, 2024
1 parent bc34a65 commit 8d3541f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.AZURE_URL }}/incstats:V2
tags: ${{ secrets.AZURE_URL }}/incstats:${{ github.sha }}
file: Dockerfile
build-args: |
DATABASE_URL=your_database_url
10 changes: 3 additions & 7 deletions app/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ client
export function addOrUpdateInc(user_name, text, category) {
return client.query(
`INSERT INTO incs (user_name, text, category)
VALUES ($1, $2, $3)
ON CONFLICT (text)
DO UPDATE SET
user_name = EXCLUDED.user_name,
category = EXCLUDED.category`,
VALUES ($1, $2, $3)`,
[user_name, text, category],
);
}


export function addCategory(category_name) {
return client.query(
`INSERT INTO categories (category_name)
`INSERT INTO categories (name)
VALUES ($1) ON CONFLICT (name) DO NOTHING RETURNING id`,
[category_name],
);
Expand Down Expand Up @@ -113,7 +109,7 @@ export async function getIncNumberByWeek(numberOfDaysAgo) {
export async function getCategoriesArray() {
try {
const result = await client.query("SELECT name FROM categories");
const categories = result.rows.map(row => row.category_name);
const categories = result.rows.map(row => row.name);
console.log("categories", categories);
return categories;
} catch (err) {
Expand Down
5 changes: 0 additions & 5 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import QuickChart from 'quickchart-js';
const { App, SocketModeReceiver } = pkg;
dotenv.config();

console.log("SLACK_BOT_TOKEN", process.env.SLACK_BOT_TOKEN);
console.log("SLACK_SIGNING_SECRET", process.env.SOCKET_TOKEN);



const app = new App({
token: process.env.SLACK_BOT_TOKEN, // Bot user token
receiver: new SocketModeReceiver({
Expand Down

0 comments on commit 8d3541f

Please sign in to comment.