Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor add template mutation to the new sdl pattern #9533

Merged
merged 21 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"ActionMeeting": "../../database/types/MeetingAction#default",
"ActionMeetingMember": "../../database/types/ActionMeetingMember#default as ActionMeetingMemberDB",
"AddApprovedOrganizationDomainsSuccess": "./types/AddApprovedOrganizationDomainsSuccess#AddApprovedOrganizationDomainsSuccessSource",
"AddReflectTemplateSuccess": "./types/AddReflectTemplateSuccess#AddReflectTemplateSuccessSource",
"AddPokerTemplateSuccess": "./types/AddPokerTemplateSuccess#AddPokerTemplateSuccessSource",
"AddTranscriptionBotSuccess": "./types/AddTranscriptionBotSuccess#AddTranscriptionBotSuccessSource",
"AddedNotification": "./types/AddedNotification#AddedNotificationSource",
"AgendaItem": "../../database/types/AgendaItem#default as AgendaItemDB",
Expand Down
9 changes: 7 additions & 2 deletions packages/client/mutations/AddPokerTemplateMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {AddPokerTemplateMutation_team$data} from '../__generated__/AddPokerTempl
import handleAddMeetingTemplate from './handlers/handleAddMeetingTemplate'

graphql`
fragment AddPokerTemplateMutation_team on AddPokerTemplatePayload {
fragment AddPokerTemplateMutation_team on AddPokerTemplateSuccess {
user {
freeCustomPokerTemplatesRemaining
}
Expand All @@ -26,6 +26,11 @@ graphql`
const mutation = graphql`
mutation AddPokerTemplateMutation($teamId: ID!, $parentTemplateId: ID) {
addPokerTemplate(teamId: $teamId, parentTemplateId: $parentTemplateId) {
... on ErrorPayload {
error {
message
}
}
...AddPokerTemplateMutation_team @relay(mask: false)
}
}
Expand Down Expand Up @@ -58,7 +63,7 @@ const AddPokerTemplateMutation: StandardMutation<TAddPokerTemplateMutation> = (
updater: (store) => {
const payload = store.getRootField('addPokerTemplate')
if (!payload) return
addPokerTemplateTeamUpdater(payload, {atmosphere, store})
addPokerTemplateTeamUpdater(payload as any, {atmosphere, store})
nickoferrall marked this conversation as resolved.
Show resolved Hide resolved
},
optimisticUpdater: (store) => {
const {parentTemplateId, teamId} = variables
Expand Down
9 changes: 7 additions & 2 deletions packages/client/mutations/AddReflectTemplateMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {AddReflectTemplateMutation_team$data} from '../__generated__/AddReflectT
import handleAddMeetingTemplate from './handlers/handleAddMeetingTemplate'

graphql`
fragment AddReflectTemplateMutation_team on AddReflectTemplatePayload {
fragment AddReflectTemplateMutation_team on AddReflectTemplateSuccess {
user {
freeCustomRetroTemplatesRemaining
}
Expand All @@ -25,6 +25,11 @@ graphql`
const mutation = graphql`
mutation AddReflectTemplateMutation($teamId: ID!, $parentTemplateId: ID) {
addReflectTemplate(teamId: $teamId, parentTemplateId: $parentTemplateId) {
... on ErrorPayload {
error {
message
}
}
...AddReflectTemplateMutation_team @relay(mask: false)
}
}
Expand Down Expand Up @@ -57,7 +62,7 @@ const AddReflectTemplateMutation: StandardMutation<TAddReflectTemplateMutation>
updater: (store) => {
const payload = store.getRootField('addReflectTemplate')
if (!payload) return
addReflectTemplateTeamUpdater(payload, {atmosphere, store})
addReflectTemplateTeamUpdater(payload as any, {atmosphere, store})
},
optimisticUpdater: (store) => {
const {parentTemplateId, teamId} = variables
Expand Down
11 changes: 8 additions & 3 deletions packages/client/subscriptions/TeamSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
acceptTeamInvitationTeamUpdater
} from '../mutations/AcceptTeamInvitationMutation'
import {addAgendaItemUpdater} from '../mutations/AddAgendaItemMutation'
import {addReflectTemplateTeamUpdater} from '../mutations/AddReflectTemplateMutation'
import {addReflectTemplatePromptTeamUpdater} from '../mutations/AddReflectTemplatePromptMutation'
import {addTeamTeamUpdater} from '../mutations/AddTeamMutation'
import {archiveTeamTeamOnNext, archiveTeamTeamUpdater} from '../mutations/ArchiveTeamMutation'
Expand All @@ -40,6 +39,8 @@ import {updateAgendaItemUpdater} from '../mutations/UpdateAgendaItemMutation'
import subscriptionOnNext from './subscriptionOnNext'
import subscriptionUpdater from './subscriptionUpdater'
import {batchArchiveTasksTaskUpdater} from '../mutations/BatchArchiveTasksMutation'
import {addReflectTemplateTeamUpdater} from '../mutations/AddReflectTemplateMutation'
import {addPokerTemplateTeamUpdater} from '../mutations/AddPokerTemplateMutation'

const subscription = graphql`
subscription TeamSubscription {
Expand All @@ -66,9 +67,12 @@ const subscription = graphql`
AddAtlassianAuthPayload {
...AddAtlassianAuthMutation_team @relay(mask: false)
}
AddReflectTemplatePayload {
AddReflectTemplateSuccess {
...AddReflectTemplateMutation_team @relay(mask: false)
}
AddPokerTemplateSuccess {
...AddPokerTemplateMutation_team @relay(mask: false)
}
AddReflectTemplatePromptPayload {
...AddReflectTemplatePromptMutation_team @relay(mask: false)
}
Expand Down Expand Up @@ -207,7 +211,8 @@ const updateHandlers = {
RemoveAgendaItemPayload: removeAgendaItemUpdater,
UpdateAgendaItemPayload: updateAgendaItemUpdater,
AcceptTeamInvitationPayload: acceptTeamInvitationTeamUpdater,
AddReflectTemplatePayload: addReflectTemplateTeamUpdater,
nickoferrall marked this conversation as resolved.
Show resolved Hide resolved
AddReflectTemplateSuccess: addReflectTemplateTeamUpdater,
AddPokerTemplateSuccess: addPokerTemplateTeamUpdater,
AddReflectTemplatePromptPayload: addReflectTemplatePromptTeamUpdater,
AddTeamMutationPayload: addTeamTeamUpdater,
ArchiveTeamPayload: archiveTeamTeamUpdater,
Expand Down
149 changes: 0 additions & 149 deletions packages/server/graphql/mutations/addPokerTemplate.ts

This file was deleted.

Loading
Loading