Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Fix: CI related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RaiVaibhav committed May 16, 2024
1 parent 862c087 commit e0afdbd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"require-await": "off"
}
},
{
"files": "src/utils/sendToSupabase.ts",
"rules": {
"camelcase": "off"
}
},
{
"files": "src/contexts/productBoard.ts",
"rules": {
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@
"homepage": "https://github.com/nhcarrigan/deepgram-bot#readme",
"dependencies": {
"@octokit/graphql": "7.1.0",
"@supabase/supabase-js": "^2.43.2",
"@supabase/supabase-js": "2.43.2",
"discord.js": "14.14.1",
"dotenv": "16.4.5",
"lodash": "^4.17.21",
"node-fetch": "2",
"node-schedule": "2.1.1",
"winston": "3.13.0"
Expand All @@ -58,7 +57,7 @@
"mocha": "10.4.0",
"prettier": "2.8.8",
"ts-mocha": "10.0.0",
"tsc-watch": "^6.2.0",
"tsc-watch": "6.2.0",
"typescript": "5.4.5"
}
}
7 changes: 2 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/utils/sendToSupabase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable camelcase */
import { createClient } from "@supabase/supabase-js";
import { AnyThreadChannel } from "discord.js";

Expand Down Expand Up @@ -61,7 +60,7 @@ export const sendToSupabase = async (
const { data, error } = await supabase
.from("community_raw")
.update({ ...threadJson })
.eq("source", threadData.id)
.eq("origin", threadData.id)
.select();

if (error) {
Expand All @@ -74,7 +73,7 @@ export const sendToSupabase = async (
const { data, error } = await supabase
.from("community_raw")
.select("*")
.eq("source", thread.id);
.eq("origin", thread.id);

if (data && data.length > 0) {
const { raw, ...rest } = data[0];
Expand All @@ -89,8 +88,8 @@ export const sendToSupabase = async (

const { data: deletedPost, error: deletePostError } = await supabase
.from("community_raw")
.update({ ...rest, ...deletedRawData })
.eq("source", thread.id)
.update({ ...rest, raw: deletedRawData })
.eq("origin", thread.id)
.select();

if (deletePostError) {
Expand Down
3 changes: 3 additions & 0 deletions src/utils/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type TransformMessage = {
attachments: Attachment[];
author: TransformUser;
reactions: TransformMessageReaction[];
url: string;
};

export type TransformUser = {
Expand Down Expand Up @@ -83,6 +84,7 @@ export type ThreadActionReturn = {
*/
export const messageTransform = async (message: Message) => {
const messageJson = message.toJSON() as TransformMessage;
messageJson["url"] = message.url;
// mSs.push(messageJson);
messageJson.attachments = [];
for (const [, attachmentValue] of message.attachments) {
Expand Down Expand Up @@ -115,6 +117,7 @@ export const threadAction = () => {
return {
[ACTION.CREATE]: async (thread: ThreadChannel) => {
const threadData = thread.toJSON() as TransformPost;
threadData["url"] = thread.url;
const customMessages = [];
const messages = await thread.messages.fetch();
for (const [, messageValue] of messages.entries()) {
Expand Down

0 comments on commit e0afdbd

Please sign in to comment.