diff --git a/backend/native/backend-ws/package.json b/backend/native/backend-ws/package.json index e49912521..f133a35dd 100644 --- a/backend/native/backend-ws/package.json +++ b/backend/native/backend-ws/package.json @@ -21,9 +21,12 @@ "build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js", "start": "npm run build && node dist/index.js", "zeus-ws": "npx graphql-zeus http://localhost:8113/v1/graphql ./src --header=x-hasura-admin-secret:myadminsecretkey --header=x-hasura-role:chat --subscriptions graphql-ws", - "zeus": "npx graphql-zeus http://localhost:8113/v1/graphql ./src --header=x-hasura-admin-secret:myadminsecretkey --header=x-hasura-role:chat --subscriptions" + "zeus": "npx graphql-zeus http://localhost:8113/v1/graphql ./src --header=x-hasura-admin-secret:myadminsecretkey --header=x-hasura-role:chat --subscriptions", + "lint": "eslint ./src --ext .js,.jsx,.ts,.tsx --cache", + "lint:fix": "yarn run lint --fix" }, "devDependencies": { + "eslint-config-custom": "*", "esbuild": "^0.17.11" } } diff --git a/backend/native/backend-ws/src/db/users.ts b/backend/native/backend-ws/src/db/users.ts index ecf2805a3..ca7386ef8 100644 --- a/backend/native/backend-ws/src/db/users.ts +++ b/backend/native/backend-ws/src/db/users.ts @@ -1,4 +1,5 @@ import { Chain } from "@coral-xyz/zeus"; + import { AUTH_HASURA_URL, AUTH_JWT } from "../config"; const chain = Chain(AUTH_HASURA_URL, { @@ -10,16 +11,21 @@ const chain = Chain(AUTH_HASURA_URL, { export const getUsers = async ( userIds: string[] ): Promise<{ id: string; username: string }[]> => { - const response = await chain("query")({ - auth_users: [ - { - where: { id: { _in: userIds } }, - }, - { - id: true, - username: true, - }, - ], - }); + const response = await chain("query")( + { + auth_users: [ + { + where: { id: { _in: userIds } }, + }, + { + id: true, + username: true, + }, + ], + }, + { + operationName: "getUsers", + } + ); return response.auth_users || []; }; diff --git a/backend/native/backend-ws/tsconfig.json b/backend/native/backend-ws/tsconfig.json index e8215cf65..91c121a0e 100644 --- a/backend/native/backend-ws/tsconfig.json +++ b/backend/native/backend-ws/tsconfig.json @@ -10,6 +10,5 @@ "noImplicitAny": true, "esModuleInterop": true, "resolveJsonModule": true - }, - "files": ["src/index.ts"] + } } diff --git a/backend/native/backpack-api/src/db/users.ts b/backend/native/backpack-api/src/db/users.ts index a1d951d04..19ea1f6bf 100644 --- a/backend/native/backpack-api/src/db/users.ts +++ b/backend/native/backpack-api/src/db/users.ts @@ -21,17 +21,22 @@ export const getUsersMetadata = async ( id: unknown; }[] > => { - const response = await chain("query")({ - auth_users: [ - { - where: { id: { _in: userIds } }, - }, - { - id: true, - username: true, - }, - ], - }); + const response = await chain("query")( + { + auth_users: [ + { + where: { id: { _in: userIds } }, + }, + { + id: true, + username: true, + }, + ], + }, + { + operationName: "getUsersMetadata", + } + ); return response.auth_users.map((x) => ({ username: x.username, id: x.id, diff --git a/backend/native/notifications-worker/src/db/collection_messages.ts b/backend/native/notifications-worker/src/db/collection_messages.ts index 53bcaa9f0..4046f4c71 100644 --- a/backend/native/notifications-worker/src/db/collection_messages.ts +++ b/backend/native/notifications-worker/src/db/collection_messages.ts @@ -9,16 +9,19 @@ const chain = Chain(AUTH_HASURA_URL, { }); export const getLatestReadMessage = async (uuid: string, room: string) => { - const response = await chain("query")({ - auth_collection_messages_by_pk: [ - { - collection_id: room, - uuid: uuid, - }, - { - last_read_message_id: true, - }, - ], - }); + const response = await chain("query")( + { + auth_collection_messages_by_pk: [ + { + collection_id: room, + uuid: uuid, + }, + { + last_read_message_id: true, + }, + ], + }, + { operationName: "getLatestReadMessage" } + ); return response.auth_collection_messages_by_pk.last_read_message_id; };