-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add mark notifications as read mutation resolver (#4169)
- Loading branch information
Showing
8 changed files
with
75 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
backend/native/backpack-api/src/routes/graphql/resolvers/mutation/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./authentication"; | ||
export * from "./friendship"; | ||
export * from "./notifications"; | ||
export * from "./wallets"; |
31 changes: 31 additions & 0 deletions
31
backend/native/backpack-api/src/routes/graphql/resolvers/mutation/notifications.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { GraphQLResolveInfo } from "graphql"; | ||
|
||
import { updateNotificationSeen } from "../../../../db/notifications"; | ||
import type { ApiContext } from "../../context"; | ||
import type { | ||
MutationMarkNotificationsAsReadArgs, | ||
MutationResolvers, | ||
} from "../../types"; | ||
|
||
/** | ||
* Handler for the mutation to mark a set of notifications as viewed. | ||
* @param {{}} _parent | ||
* @param {MutationMarkNotificationsAsReadArgs} args | ||
* @param {ApiContext} ctx | ||
* @param {GraphQLResolveInfo} _info | ||
* @returns | ||
*/ | ||
export const markNotificationsAsReadMutationResolver: MutationResolvers["markNotificationsAsRead"] = | ||
async ( | ||
_parent: {}, | ||
args: MutationMarkNotificationsAsReadArgs, | ||
ctx: ApiContext, | ||
_info: GraphQLResolveInfo | ||
): Promise<number> => { | ||
// TODO: move implementation into contextual Hasura client | ||
const res = await updateNotificationSeen({ | ||
notificationIds: args.ids, | ||
uuid: ctx.authorization.userId ?? "", | ||
}); | ||
return res.update_auth_notifications?.affected_rows ?? 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1511deb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
backpack – ./
www.backpack.app
backpack-200ms.vercel.app
backpack-git-master-200ms.vercel.app
backpack.app
devnet.backpack.app