Skip to content

Commit 645f968

Browse files
committed
Fix fetch field errors for SlotifyGroups
1 parent db41952 commit 645f968

4 files changed

Lines changed: 42 additions & 33 deletions

File tree

public/swagger/swagger.json

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@
971971
"content": {
972972
"application/json": {
973973
"schema": {
974-
"$ref": "#/components/schemas/UsersAndPagination"
974+
"$ref": "#/components/schemas/InvitesGroupsAndPagination"
975975
}
976976
}
977977
}
@@ -1263,23 +1263,7 @@
12631263
"content": {
12641264
"application/json": {
12651265
"schema": {
1266-
"type": "object",
1267-
"required": [
1268-
"users",
1269-
"nextPageToken"
1270-
],
1271-
"properties": {
1272-
"users": {
1273-
"type": "array",
1274-
"items": {
1275-
"$ref": "#/components/schemas/User"
1276-
}
1277-
},
1278-
"nextPageToken": {
1279-
"type": "integer",
1280-
"format": "uint32"
1281-
}
1282-
}
1266+
"$ref": "#/components/schemas/UsersAndPagination"
12831267
}
12841268
}
12851269
}
@@ -3273,12 +3257,27 @@
32733257
"name"
32743258
]
32753259
},
3276-
"UsersAndPagination": {
3260+
"InvitesGroupsAndPagination": {
32773261
"type": "object",
3262+
"properties": {
3263+
"invites": {
3264+
"type": "array",
3265+
"items": {
3266+
"$ref": "#/components/schemas/InvitesGroup"
3267+
}
3268+
},
3269+
"nextPageToken": {
3270+
"type": "integer",
3271+
"format": "uint32"
3272+
}
3273+
},
32783274
"required": [
3279-
"users",
3275+
"invites",
32803276
"nextPageToken"
3281-
],
3277+
]
3278+
},
3279+
"UsersAndPagination": {
3280+
"type": "object",
32823281
"properties": {
32833282
"users": {
32843283
"type": "array",
@@ -3290,7 +3289,11 @@
32903289
"type": "integer",
32913290
"format": "uint32"
32923291
}
3293-
}
3292+
},
3293+
"required": [
3294+
"users",
3295+
"nextPageToken"
3296+
]
32943297
}
32953298
}
32963299
}

shared

src/app/dashboard/groups/slotify/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default function GroupsPage() {
120120
limit: 10,
121121
},
122122
})
123-
setMembers(slotifyGroupMemberData.users as Member[])
123+
setMembers(slotifyGroupMemberData.users)
124124
} catch (error) {
125125
console.error(error)
126126
errorToast(error)
@@ -133,7 +133,7 @@ export default function GroupsPage() {
133133
return
134134
}
135135
try {
136-
const invites =
136+
const invitesAndPagination =
137137
await slotifyClient.GetAPISlotifyGroupsSlotifyGroupIDInvites({
138138
params: {
139139
slotifyGroupID: selectedSlotifyGroup.id,
@@ -143,7 +143,7 @@ export default function GroupsPage() {
143143
},
144144
})
145145
setGroupInvites(
146-
(invites.invites as InvitesGroup[]).filter(
146+
invitesAndPagination.invites.filter(
147147
invite => invite.status === 'pending',
148148
),
149149
)

src/types/client.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ type InvitesMe = {
181181
fromUserFirstName: string;
182182
fromUserLastName: string;
183183
};
184+
type InvitesGroupsAndPagination = {
185+
invites: Array<InvitesGroup>;
186+
nextPageToken: number;
187+
};
184188
type UsersAndPagination = {
185189
users: Array<User>;
186190
nextPageToken: number;
@@ -307,13 +311,16 @@ const InvitesGroup: z.ZodType<InvitesGroup> = z
307311
createdAt: z.string().datetime({ offset: true }),
308312
})
309313
.passthrough();
310-
const UsersAndPagination: z.ZodType<UsersAndPagination> = z
311-
.object({ users: z.array(User), nextPageToken: z.number().int() })
314+
const InvitesGroupsAndPagination: z.ZodType<InvitesGroupsAndPagination> = z
315+
.object({ invites: z.array(InvitesGroup), nextPageToken: z.number().int() })
312316
.passthrough();
313317
const SlotifyGroup = z
314318
.object({ id: z.number().int(), name: z.string() })
315319
.passthrough();
316320
const SlotifyGroupCreate = z.object({ name: z.string() }).passthrough();
321+
const UsersAndPagination: z.ZodType<UsersAndPagination> = z
322+
.object({ users: z.array(User), nextPageToken: z.number().int() })
323+
.passthrough();
317324
const EmailAddress: z.ZodType<EmailAddress> = z
318325
.object({ address: z.string().email(), name: z.string() })
319326
.passthrough();
@@ -506,9 +513,10 @@ export const schemas = {
506513
InvitesMe,
507514
InviteCreate,
508515
InvitesGroup,
509-
UsersAndPagination,
516+
InvitesGroupsAndPagination,
510517
SlotifyGroup,
511518
SlotifyGroupCreate,
519+
UsersAndPagination,
512520
EmailAddress,
513521
AttendeeBase,
514522
PhysicalAddress,
@@ -1718,7 +1726,7 @@ const endpoints = makeApi([
17181726
schema: z.number().int(),
17191727
},
17201728
],
1721-
response: UsersAndPagination,
1729+
response: InvitesGroupsAndPagination,
17221730
errors: [
17231731
{
17241732
status: 400,
@@ -1800,9 +1808,7 @@ const endpoints = makeApi([
18001808
schema: z.string().optional(),
18011809
},
18021810
],
1803-
response: z
1804-
.object({ users: z.array(User), nextPageToken: z.number().int() })
1805-
.passthrough(),
1811+
response: UsersAndPagination,
18061812
errors: [
18071813
{
18081814
status: 401,

0 commit comments

Comments
 (0)