This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from habralab/feat/notifications-client
feat/notifications-client
- Loading branch information
Showing
60 changed files
with
1,249 additions
and
371 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
30 changes: 30 additions & 0 deletions
30
common/client/fragments/header-fragment/src/data/data.interfaces.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,30 @@ | ||
// eslint-disable-next-line no-shadow | ||
export enum NotificationTypes { | ||
ProjectEditOwner = 'ProjectEditOwner', | ||
TeamJoinProjectRequest = 'TeamJoinProjectRequest', | ||
TeamJoinRequestDecide = 'TeamJoinRequestDecide', | ||
TeamLeaveProject = 'TeamLeaveProject', | ||
TeamEditOwner = 'TeamEditOwner', | ||
TeamInvite = 'TeamInvite', | ||
TeamInviteDecide = 'TeamInviteDecide', | ||
TeamParticipantLeaveTeam = 'TeamParticipantLeaveTeam', | ||
TeamUserJoinRequest = 'TeamUserJoinRequest', | ||
TeamUserJoinRequestDecide = 'TeamUserJoinRequestDecide', | ||
} | ||
|
||
export interface QuotedEntity { | ||
id?: string | ||
avatarUrl?: string | ||
quote?: string | ||
} | ||
|
||
export interface Notification { | ||
id?: string | ||
userId?: string | ||
linkedEntityId?: string | ||
title?: string | ||
body?: string | ||
type?: NotificationTypes | ||
createdAt?: string | ||
quotedEntities: QuotedEntity[] | ||
} |
12 changes: 12 additions & 0 deletions
12
...nt/src/data/decide-project-team-join-request/decide-project-team-join-request.mutation.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,12 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const DECIDE_PROJECT_TEAM_JOIN_REQUEST = gql` | ||
mutation ProjectTeamJoinRequestDecide($id: String!, $approve: Boolean!) { | ||
projectTeamJoinRequestDecide(input: { projectTeamJoinRequestId: $id, isApproved: $approve }) { | ||
id | ||
teamId | ||
teamName | ||
projectId | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/header-fragment/src/data/decide-project-team-join-request/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-decide-project-team-join-request.hook' |
26 changes: 26 additions & 0 deletions
26
...nt/src/data/decide-project-team-join-request/use-decide-project-team-join-request.hook.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,26 @@ | ||
import { useMutation } from '@apollo/client' | ||
|
||
import { JoinRequest } from '@shared/data' | ||
|
||
import { DECIDE_PROJECT_TEAM_JOIN_REQUEST } from './decide-project-team-join-request.mutation' | ||
|
||
export interface DecideProjectTeamJoinRequestResponse { | ||
id?: string | ||
teamId?: string | ||
teamName?: string | ||
projectId?: string | ||
} | ||
|
||
export interface DecideProjectTeamJoinRequestInput { | ||
id: JoinRequest['id'] | ||
approve: boolean | ||
} | ||
|
||
export const useDecideProjectTeamJoinRequest = () => { | ||
const [decideProjectTeamJoinRequest, { data, loading }] = useMutation< | ||
DecideProjectTeamJoinRequestResponse, | ||
DecideProjectTeamJoinRequestInput | ||
>(DECIDE_PROJECT_TEAM_JOIN_REQUEST) | ||
|
||
return { decideProjectTeamJoinRequest, data, loading } | ||
} |
13 changes: 13 additions & 0 deletions
13
...ts/header-fragment/src/data/decide-team-join-request/decide-team-join-request.mutation.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,13 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const DECIDE_TEAM_JOIN_REQUEST = gql` | ||
mutation TeamUserJoinRequestDecide($id: String!, $approve: Boolean!) { | ||
teamUserJoinRequestDecide(input: { userJoinRequestId: $id, isApproved: $approve }) { | ||
teamUserJoinRequestPayload { | ||
id | ||
userId | ||
teamId | ||
} | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/header-fragment/src/data/decide-team-join-request/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-decide-team-join-request.hook' |
25 changes: 25 additions & 0 deletions
25
...ts/header-fragment/src/data/decide-team-join-request/use-decide-team-join-request.hook.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,25 @@ | ||
import { useMutation } from '@apollo/client' | ||
|
||
import { JoinRequest } from '@shared/data' | ||
|
||
import { DECIDE_TEAM_JOIN_REQUEST } from './decide-team-join-request.mutation' | ||
|
||
export interface DecideTeamJoinRequestResponse { | ||
teamUserJoinRequestDecide: { | ||
teamUserJoinRequestPayload: JoinRequest | ||
} | ||
} | ||
|
||
export interface DecideTeamJoinRequestInput { | ||
id: JoinRequest['id'] | ||
approve: boolean | ||
} | ||
|
||
export const useDecideTeamJoinRequest = () => { | ||
const [decideTeamJoinRequest, { data, loading }] = useMutation< | ||
DecideTeamJoinRequestResponse, | ||
DecideTeamJoinRequestInput | ||
>(DECIDE_TEAM_JOIN_REQUEST) | ||
|
||
return { decideTeamJoinRequest, data, loading } | ||
} |
13 changes: 13 additions & 0 deletions
13
...r-fragment/src/data/decide-user-team-join-invite/decide-user-team-join-invite.mutation.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,13 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const DECIDE_USER_TEAM_JOIN_INVITE = gql` | ||
mutation TeamJoinInvitationDecide($id: String!, $approve: Boolean!) { | ||
teamJoinInvitationDecide(input: { joinInvitationId: $id, isApproved: $approve }) { | ||
teamJoinInvitePayload { | ||
id | ||
userId | ||
teamId | ||
} | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/header-fragment/src/data/decide-user-team-join-invite/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-decide-user-team-join-invite.hook' |
25 changes: 25 additions & 0 deletions
25
...r-fragment/src/data/decide-user-team-join-invite/use-decide-user-team-join-invite.hook.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,25 @@ | ||
import { useMutation } from '@apollo/client' | ||
|
||
import { JoinRequest } from '@shared/data' | ||
|
||
import { DECIDE_USER_TEAM_JOIN_INVITE } from './decide-user-team-join-invite.mutation' | ||
|
||
export interface DecideUserTeamJoinInviteResponse { | ||
id?: string | ||
userId?: string | ||
teamId?: string | ||
} | ||
|
||
export interface DecideUserTeamJoinInviteInput { | ||
id: JoinRequest['id'] | ||
approve: boolean | ||
} | ||
|
||
export const useDecideUserTeamJoinInvite = () => { | ||
const [decideUserTeamJoinInvite, { data, loading }] = useMutation< | ||
DecideUserTeamJoinInviteResponse, | ||
DecideUserTeamJoinInviteInput | ||
>(DECIDE_USER_TEAM_JOIN_INVITE) | ||
|
||
return { decideUserTeamJoinInvite, data, loading } | ||
} |
9 changes: 9 additions & 0 deletions
9
...nt/fragments/header-fragment/src/data/delete-notification/delete-notification.mutation.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,9 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const DELETE_NOTIFICATION = gql` | ||
mutation NotificationDelete($id: String!) { | ||
notificationDelete(input: { notificationId: $id }) { | ||
id | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/header-fragment/src/data/delete-notification/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-delete-notification.hook' |
20 changes: 20 additions & 0 deletions
20
...nt/fragments/header-fragment/src/data/delete-notification/use-delete-notification.hook.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,20 @@ | ||
import { useMutation } from '@apollo/client' | ||
|
||
import { DELETE_NOTIFICATION } from './delete-notification.mutation' | ||
|
||
export interface DeleteNotificationResponse { | ||
id?: string | ||
} | ||
|
||
export interface DeleteNotificationInput { | ||
id?: string | ||
} | ||
|
||
export const useDeleteNotification = () => { | ||
const [deleteNotification, { data, loading }] = useMutation< | ||
DeleteNotificationResponse, | ||
DeleteNotificationInput | ||
>(DELETE_NOTIFICATION) | ||
|
||
return { deleteNotification, data, loading } | ||
} |
17 changes: 17 additions & 0 deletions
17
...on/client/fragments/header-fragment/src/data/get-notifications/get-notifications.query.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,17 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const GET_NOTIFICATIONS = gql` | ||
query NotificationGet { | ||
notificationsGetListByCurrentUser { | ||
notifications { | ||
id | ||
title | ||
body | ||
type | ||
userId | ||
createdAt | ||
linkedEntityId | ||
} | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/header-fragment/src/data/get-notifications/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-get-notifications.hook' |
19 changes: 19 additions & 0 deletions
19
...client/fragments/header-fragment/src/data/get-notifications/use-get-notifications.hook.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,19 @@ | ||
import { useQuery } from '@apollo/client' | ||
|
||
import { Notification } from '../data.interfaces' | ||
import { GET_NOTIFICATIONS } from './get-notifications.query' | ||
|
||
export interface GetNotificationsResponse { | ||
notificationsGetListByCurrentUser: { | ||
notifications?: Notification[] | ||
} | ||
} | ||
|
||
export const useGetNotifications = () => { | ||
const { data, refetch } = useQuery<GetNotificationsResponse>(GET_NOTIFICATIONS) | ||
|
||
return { | ||
notifications: data?.notificationsGetListByCurrentUser?.notifications || [], | ||
refetch, | ||
} | ||
} |
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,6 @@ | ||
export * from './data.interfaces' | ||
export * from './decide-project-team-join-request' | ||
export * from './decide-team-join-request' | ||
export * from './decide-user-team-join-invite' | ||
export * from './delete-notification' | ||
export * from './get-notifications' |
Oops, something went wrong.