Skip to content

Commit d9bf647

Browse files
authored
fix(condo): DOMA-11249 update cache config and add first arg to queries (#5916)
* fix(condo): DOMA-11249 update cache config and add first arg to queries * fix(condo): DOMA-11249 add update types and remove first from AllMiniApps.graphql * fix(condo): DOMA-11249 update after review * fix(condo): DOMA-11249 update callcenter pointer
1 parent 5405422 commit d9bf647

File tree

16 files changed

+127
-100
lines changed

16 files changed

+127
-100
lines changed

apps/callcenter

apps/condo/domains/common/components/TicketCard/TicketCardList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { green } from '@ant-design/colors'
2-
import { useGetContactTicketsQuery } from '@app/condo/gql'
2+
import { useGetTicketsByContactQuery } from '@app/condo/gql'
33
import { SortTicketsBy, Ticket as TicketSchema } from '@app/condo/schema'
44
import styled from '@emotion/styled'
55
import { Col, Row, RowProps, Space, Typography } from 'antd'
@@ -147,7 +147,7 @@ const TicketCardList: React.FC<ITicketCardListProps> = ({ contactId }) => {
147147
const {
148148
loading,
149149
data: ticketsData,
150-
} = useGetContactTicketsQuery({
150+
} = useGetTicketsByContactQuery({
151151
variables: { contactId },
152152
skip: !persistor || !contactId,
153153
})

apps/condo/domains/common/utils/next/apollo.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const cacheConfig: InitCacheConfig = (cacheOptions) => {
3838
},
3939
allPropertyScopes: {
4040
keyArgs: ['where'],
41-
read: listHelper.getReadFunction(),
41+
read: listHelper.getReadFunction('paginate'),
4242
merge: listHelper.mergeLists,
4343
},
4444
allIncidents: {
@@ -63,67 +63,67 @@ const cacheConfig: InitCacheConfig = (cacheOptions) => {
6363
},
6464
allBillingIntegrationOrganizationContexts: {
6565
keyArgs: ['where'],
66-
read: listHelper.getReadFunction(),
66+
read: listHelper.getReadFunction('paginate'),
6767
merge: listHelper.mergeLists,
6868
},
6969
allTickets: {
7070
keyArgs: ['where'],
71-
read: listHelper.getReadFunction(),
71+
read: listHelper.getReadFunction('paginate'),
7272
merge: listHelper.mergeLists,
7373
},
7474
allTicketChanges: {
7575
keyArgs: ['where'],
76-
read: listHelper.getReadFunction(),
76+
read: listHelper.getReadFunction('paginate'),
7777
merge: listHelper.mergeLists,
7878
},
7979
allTicketComments: {
8080
keyArgs: ['where'],
81-
read: listHelper.getReadFunction(),
81+
read: listHelper.getReadFunction('paginate'),
8282
merge: listHelper.mergeLists,
8383
},
8484
allTicketCommentFile: {
8585
keyArgs: ['where'],
86-
read: listHelper.getReadFunction(),
86+
read: listHelper.getReadFunction('paginate'),
8787
merge: listHelper.mergeLists,
8888
},
8989
allTicketStatuses: {
9090
keyArgs: ['where'],
91-
read: listHelper.getReadFunction(),
91+
read: listHelper.getReadFunction('paginate'),
9292
merge: listHelper.mergeLists,
9393
},
9494
allTicketFiles: {
9595
keyArgs: ['where'],
96-
read: listHelper.getReadFunction(),
96+
read: listHelper.getReadFunction('paginate'),
9797
merge: listHelper.mergeLists,
9898
},
9999
allInvoices: {
100100
keyArgs: ['where'],
101-
read: listHelper.getReadFunction(),
101+
read: listHelper.getReadFunction('paginate'),
102102
merge: listHelper.mergeLists,
103103
},
104104
allProperties: {
105105
keyArgs: ['where'],
106-
read: listHelper.getReadFunction(),
106+
read: listHelper.getReadFunction('paginate'),
107107
merge: listHelper.mergeLists,
108108
},
109109
allTourStep: {
110110
keyArgs: ['where'],
111-
read: listHelper.getReadFunction(),
111+
read: listHelper.getReadFunction('paginate'),
112112
merge: listHelper.mergeLists,
113113
},
114114
allMiniApps: {
115115
keyArgs: ['where'],
116-
read: listHelper.getReadFunction(),
116+
read: listHelper.getReadFunction('paginate'),
117117
merge: listHelper.mergeLists,
118118
},
119119
allB2BApps: {
120120
keyArgs: ['where'],
121-
read: listHelper.getReadFunction(),
121+
read: listHelper.getReadFunction('paginate'),
122122
merge: listHelper.mergeLists,
123123
},
124124
allOrganizationEmployeeSpecializations: {
125125
keyArgs: ['where'],
126-
read: listHelper.getReadFunction(),
126+
read: listHelper.getReadFunction('paginate'),
127127
merge: listHelper.mergeLists,
128128
},
129129
},

apps/condo/domains/miniapp/queries/B2BApp.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ query getGlobalB2BApps {
44
isGlobal: true,
55
isHidden: false,
66
},
7+
first: 100,
78
) {
89
id
910
appUrl

apps/condo/domains/notification/queries/Message.graphql

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ query getUserMessages ($userId: ID, $organizationId: ID, $types: [MessageType!],
44
user: { id: $userId }
55
organization: { id: $organizationId }
66
type_in: $types
7-
}
8-
first: 10
9-
skip: $skip
10-
sortBy: [createdAt_DESC]
7+
},
8+
first: 10,
9+
skip: $skip,
10+
sortBy: [createdAt_DESC],
1111
) {
1212
id
1313
type

apps/condo/domains/organization/queries/OrganizationEmployee.graphql

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
query getActiveOrganizationEmployee($userId: ID!, $employeeId: ID) {
2-
employees: allOrganizationEmployees(where: {
3-
id: $employeeId,
4-
organization: { type_in: [MANAGING_COMPANY, SERVICE_PROVIDER] },
5-
user: { id: $userId, type: staff },
6-
isAccepted: true,
7-
isBlocked: false,
8-
isRejected: false,
9-
}, first: 1, skip: 0, sortBy: [createdAt_DESC]) {
2+
employees: allOrganizationEmployees(
3+
where: {
4+
id: $employeeId,
5+
organization: { type_in: [MANAGING_COMPANY, SERVICE_PROVIDER] },
6+
user: { id: $userId, type: staff },
7+
isAccepted: true,
8+
isBlocked: false,
9+
isRejected: false,
10+
},
11+
first: 1,
12+
skip: 0,
13+
sortBy: [createdAt_DESC]
14+
) {
1015
id
1116
name
1217
email
@@ -159,7 +164,7 @@ query getOrganizationEmployeeWithTicketOrganization ($userId: ID!, $organization
159164
user: { id: $userId },
160165
organization: { id: $organizationId },
161166
}
162-
first: 1
167+
first: 1,
163168
) {
164169
id
165170
}

apps/condo/domains/property/queries/Property.graphql

+5-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ fragment AddressMetaForTableAddress on AddressMetaField {
4545

4646
query getPropertyWithMapById ($id: ID!) {
4747
property: allProperties(
48-
where: { id: $id }
48+
where: {
49+
id: $id
50+
},
51+
first: 1,
4952
) {
5053
id
5154
organization {
@@ -69,7 +72,7 @@ query getPropertyById ($id: ID!) {
6972
where: {
7073
id: $id
7174
},
72-
first: 1
75+
first: 1,
7376
) {
7477
id
7578
address

apps/condo/domains/ticket/queries/Incident.graphql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
query getIncidents ($where: IncidentWhereInput, $sortBy: [SortIncidentsBy!], $first: Int!,) {
1+
query getIncidents ($where: IncidentWhereInput, $sortBy: [SortIncidentsBy!], $first: Int!) {
22
incidents: allIncidents (
33
where: $where,
44
sortBy: $sortBy,

apps/condo/domains/ticket/queries/Ticket.graphql

+22-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
query getTickets ($where: TicketWhereInput!, $sortBy: [SortTicketsBy!], $first: Int, $skip: Int) {
2-
tickets: allTickets(where: $where, sortBy: $sortBy, first: $first, skip: $skip) {
1+
query getTickets ($where: TicketWhereInput!, $sortBy: [SortTicketsBy!], $first: Int!, $skip: Int) {
2+
tickets: allTickets(
3+
where: $where,
4+
sortBy: $sortBy,
5+
first: $first,
6+
skip: $skip
7+
) {
38
id
49
number
510
createdAt
@@ -79,8 +84,11 @@ query getTickets ($where: TicketWhereInput!, $sortBy: [SortTicketsBy!], $first:
7984
}
8085
}
8186

82-
query getTicketExistence ($where: TicketWhereInput!) {
83-
tickets: allTickets (where: $where, first: 1) {
87+
query checkTicketExistence ($where: TicketWhereInput!) {
88+
tickets: allTickets (
89+
where: $where,
90+
first: 1,
91+
) {
8492
id
8593
}
8694
}
@@ -140,7 +148,7 @@ query getTicketById ($id: ID!) {
140148
where: {
141149
id: $id
142150
},
143-
first: 1
151+
first: 1,
144152
) {
145153
id
146154
number
@@ -238,8 +246,10 @@ query getTicketById ($id: ID!) {
238246

239247
query getTicketByCreatedBy ($userId: ID!) {
240248
tickets: allTickets (
241-
where: { createdBy: { id: $userId } },
242-
first: 1
249+
where: {
250+
createdBy: { id: $userId }
251+
},
252+
first: 1,
243253
) {
244254
id
245255
}
@@ -250,18 +260,19 @@ query getTicketLastCommentsTime ($id: ID!) {
250260
where: {
251261
id: $id
252262
},
253-
first: 1
263+
first: 1,
254264
) {
255265
id
256266
lastResidentCommentAt
257267
lastCommentWithResidentTypeAt
258268
}
259269
}
260270

261-
query getContactTickets ($contactId: ID!) {
271+
query getTicketsByContact ($contactId: ID!) {
262272
tickets: allTickets(
263273
where: { contact: { id: $contactId } }
264-
sortBy: [createdAt_DESC]
274+
sortBy: [createdAt_DESC],
275+
first: 100,
265276
) {
266277
id
267278
details
@@ -278,7 +289,7 @@ query getContactTickets ($contactId: ID!) {
278289
}
279290
}
280291

281-
query getOrganizationEmployeeTicketsForReassignment ($userId: ID!, $organizationId: ID!, $first: Int) {
292+
query getOrganizationEmployeeTicketsForReassignment ($userId: ID!, $organizationId: ID!, $first: Int!) {
282293
tickets: allTickets(
283294
where: {
284295
organization: { id: $organizationId },

apps/condo/domains/ticket/queries/TicketChange.graphql

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
query getTicketChanges ($ticketId: ID!) {
22
ticketChanges: allTicketChanges (
3-
where: { ticket: { id: $ticketId } },
3+
where: {
4+
ticket: { id: $ticketId }
5+
},
46
sortBy: [actualCreationDate_DESC]
7+
first: 100,
58
) {
69
id
710
actualCreationDate

apps/condo/domains/ticket/queries/TicketComment.graphql

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
query getTicketComments ($ticketId: ID!) {
22
ticketComments: allTicketComments (
3-
where: { ticket: { id: $ticketId } }
4-
first: 100
5-
sortBy: [createdAt_DESC]
3+
where: {
4+
ticket: { id: $ticketId }
5+
},
6+
sortBy: [createdAt_DESC],
7+
first: 100,
68
) {
79
id
810
type
@@ -18,7 +20,7 @@ query getTicketComments ($ticketId: ID!) {
1820
}
1921
}
2022

21-
query getPollTicketComments ($where: TicketCommentWhereInput!, $first: Int) {
23+
query getPollTicketComments ($where: TicketCommentWhereInput!, $first: Int!) {
2224
ticketComments: allTicketComments (
2325
where: $where
2426
first: $first

apps/condo/domains/ticket/queries/TicketCommentFile.graphql

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ query getTicketCommentsFiles ($ticketCommentsIds: [ID!]!) {
22
files: allTicketCommentFiles (
33
where: {
44
ticketComment: { id_in: $ticketCommentsIds }
5-
}
6-
first: 100
7-
sortBy: [createdAt_DESC]
5+
},
6+
first: 100,
7+
sortBy: [createdAt_DESC],
88
) {
99
id
1010
file {

0 commit comments

Comments
 (0)