Skip to content

Commit

Permalink
Deprecate event registrants from query
Browse files Browse the repository at this point in the history
  • Loading branch information
beingnoble03 committed Sep 18, 2023
1 parent 0deca89 commit ed12705
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 53 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,8 @@ export const ORGANIZATION_EVENTS_CONNECTION = gql`
firstName
lastName
}
registrants {
user {
_id
}
attendees {
_id
}
}
}
Expand Down
55 changes: 17 additions & 38 deletions src/screens/UserPortal/Events/Events.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,14 @@ const MOCKS = [
lastName: 'Mittal',
__typename: 'User',
},
registrants: [
attendees: [
{
user: {
_id: '63d649417ffe6e4d5174ea32',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63d649417ffe6e4d5174ea32',
__typename: 'User',
},
{
user: {
_id: '63d6064458fce20ee25c3bf7',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63d6064458fce20ee25c3bf7',
__typename: 'User',
},
],
__typename: 'Event',
Expand All @@ -92,27 +86,18 @@ const MOCKS = [
lastName: 'Mittal',
__typename: 'User',
},
registrants: [
attendees: [
{
user: {
_id: '63d649417ffe6e4d5174ea32',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63d649417ffe6e4d5174ea32',
__typename: 'User',
},
{
user: {
_id: '63dd52bbe69f63814b0a5dd4',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63dd52bbe69f63814b0a5dd4',
__typename: 'User',
},
{
user: {
_id: '63d6064458fce20ee25c3bf7',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63d6064458fce20ee25c3bf7',
__typename: 'User',
},
],
__typename: 'Event',
Expand Down Expand Up @@ -151,20 +136,14 @@ const MOCKS = [
lastName: 'Mittal',
__typename: 'User',
},
registrants: [
attendees: [
{
user: {
_id: '63d649417ffe6e4d5174ea32',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63d649417ffe6e4d5174ea32',
__typename: 'User',
},
{
user: {
_id: '63d6064458fce20ee25c3bf7',
__typename: 'User',
},
__typename: 'UserAttende',
_id: '63d6064458fce20ee25c3bf7',
__typename: 'User',
},
],
__typename: 'Event',
Expand Down
14 changes: 7 additions & 7 deletions src/screens/UserPortal/Events/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ export default function events(): JSX.Element {
)
: /* istanbul ignore next */
events
).map((event: any, index) => {
const registrants: any = [];
event.registrants.forEach((registrant: any) => {
).map((event: any) => {
const attendees: any = [];
event.attendees.forEach((attendee: any) => {
const r = {
id: registrant.user._id,
id: attendee._id,
};

registrants.push(r);
attendees.push(r);
});

const creator: any = {};
Expand All @@ -291,11 +291,11 @@ export default function events(): JSX.Element {
startTime: event.startTime,
recurring: event.recurring,
allDay: event.allDay,
registrants,
registrants: attendees,
creator,
};

return <EventCard key={index} {...cardProps} />;
return <EventCard key={event._id} {...cardProps} />;
})
) : (
<span>{t('nothingToShow')}</span>
Expand Down

0 comments on commit ed12705

Please sign in to comment.