diff --git a/src/components/Advertisements/Advertisements.test.tsx b/src/components/Advertisements/Advertisements.test.tsx
index 9f0778c0f6..88a5a43686 100644
--- a/src/components/Advertisements/Advertisements.test.tsx
+++ b/src/components/Advertisements/Advertisements.test.tsx
@@ -186,7 +186,7 @@ describe('Testing Advertisement Component', () => {
},
result: {
data: {
- getAdvertisements: [],
+ advertisementsConnection: [],
},
loading: false,
},
@@ -245,13 +245,15 @@ describe('Testing Advertisement Component', () => {
},
result: {
data: {
- getAdvertisements: [
+ advertisementsConnection: [
{
_id: '1',
name: 'Advertisement1',
type: 'POPUP',
- orgId: 'undefined',
- link: 'http://example1.com',
+ organization: {
+ _id: 'undefined',
+ },
+ mediaUrl: 'http://example1.com',
endDate: '2023-01-01',
startDate: '2022-01-01',
},
@@ -310,13 +312,15 @@ describe('Testing Advertisement Component', () => {
},
result: {
data: {
- getAdvertisements: [
+ advertisementsConnection: [
{
_id: '1',
name: 'Advertisement1',
type: 'POPUP',
- orgId: 'undefined',
- link: 'http://example1.com',
+ organization: {
+ _id: 'undefined',
+ },
+ mediaUrl: 'http://example1.com',
endDate: '2023-01-01',
startDate: '2022-01-01',
},
@@ -324,8 +328,10 @@ describe('Testing Advertisement Component', () => {
_id: '2',
name: 'Advertisement2',
type: 'BANNER',
- orgId: 'undefined',
- link: 'http://example2.com',
+ organization: {
+ _id: 'undefined',
+ },
+ mediaUrl: 'http://example2.com',
endDate: tomorrow,
startDate: today,
},
diff --git a/src/components/Advertisements/Advertisements.tsx b/src/components/Advertisements/Advertisements.tsx
index 21a0bf0b8b..837015870a 100644
--- a/src/components/Advertisements/Advertisements.tsx
+++ b/src/components/Advertisements/Advertisements.tsx
@@ -111,14 +111,14 @@ export default function advertisements(): JSX.Element {
onSelect={updateSelectedTab}
>
- {data2?.getAdvertisements
- .filter((ad: any) => ad.orgId == currentOrgId)
+ {data2?.advertisementsConnection
+ .filter((ad: any) => ad.organization._id == currentOrgId)
.filter((ad: any) => new Date(ad.endDate) > new Date())
.length == 0 ? (
{t('pMessage')}
// eslint-disable-line
) : (
- data2?.getAdvertisements
- .filter((ad: any) => ad.orgId == currentOrgId)
+ data2?.advertisementsConnection
+ .filter((ad: any) => ad.organization._id == currentOrgId)
.filter((ad: any) => new Date(ad.endDate) > new Date())
.map(
(
@@ -126,8 +126,8 @@ export default function advertisements(): JSX.Element {
_id: string;
name: string | undefined;
type: string | undefined;
- orgId: string;
- link: string;
+ organization: { _id: string };
+ mediaUrl: string;
endDate: Date;
startDate: Date;
},
@@ -138,10 +138,10 @@ export default function advertisements(): JSX.Element {
key={i}
name={ad.name}
type={ad.type}
- orgId={ad.orgId}
+ orgId={ad.organization._id}
startDate={new Date(ad.startDate)}
endDate={new Date(ad.endDate)}
- link={ad.link}
+ link={ad.mediaUrl}
// getInstalledPlugins={getInstalledPlugins}
/>
)
@@ -149,14 +149,14 @@ export default function advertisements(): JSX.Element {
)}
- {data2?.getAdvertisements
- .filter((ad: any) => ad.orgId == currentOrgId)
+ {data2?.advertisementsConnection
+ .filter((ad: any) => ad.organization._id == currentOrgId)
.filter((ad: any) => new Date(ad.endDate) < new Date())
.length == 0 ? (
{t('pMessage')}
// eslint-disable-line
) : (
- data2?.getAdvertisements
- .filter((ad: any) => ad.orgId == currentOrgId)
+ data2?.advertisementsConnection
+ .filter((ad: any) => ad.organization._id == currentOrgId)
.filter((ad: any) => new Date(ad.endDate) < new Date())
.map(
(
@@ -164,8 +164,8 @@ export default function advertisements(): JSX.Element {
_id: string;
name: string | undefined;
type: string | undefined;
- orgId: string;
- link: string;
+ organization: { _id: string };
+ mediaUrl: string;
endDate: Date;
startDate: Date;
},
@@ -176,7 +176,7 @@ export default function advertisements(): JSX.Element {
key={i}
name={ad.name}
type={ad.type}
- orgId={ad.orgId}
+ orgId={ad.organization._id}
startDate={new Date(ad.startDate)}
endDate={new Date(ad.endDate)}
// getInstalledPlugins={getInstalledPlugins}
diff --git a/src/components/UserUpdate/UserUpdate.test.tsx b/src/components/UserUpdate/UserUpdate.test.tsx
index aca6fb1b6c..15377dfcac 100644
--- a/src/components/UserUpdate/UserUpdate.test.tsx
+++ b/src/components/UserUpdate/UserUpdate.test.tsx
@@ -25,6 +25,7 @@ const MOCKS = [
__typename: 'UserData',
appUserProfile: {
__typename: 'AppUserProfile',
+ _id: '1',
adminFor: [
{ __typename: 'Organization', _id: '65e0df0906dd1228350cfd4a' },
{ __typename: 'Organization', _id: '65e0e2abb92c9f3e29503d4e' },
@@ -45,6 +46,7 @@ const MOCKS = [
},
user: {
__typename: 'User',
+ _id: '1',
firstName: 'Aditya',
lastName: 'Agarwal',
createdAt: '2024-02-26T10:36:33.098Z',
diff --git a/src/screens/UserPortal/Organizations/Organizations.test.tsx b/src/screens/UserPortal/Organizations/Organizations.test.tsx
index 373acfaa8f..5d92d8fed7 100644
--- a/src/screens/UserPortal/Organizations/Organizations.test.tsx
+++ b/src/screens/UserPortal/Organizations/Organizations.test.tsx
@@ -88,15 +88,17 @@ const MOCKS = [
data: {
users: [
{
- joinedOrganizations: [
- {
- __typename: 'Organization',
- _id: '6401ff65ce8e8406b8f07af2',
- name: 'joinedOrganization',
- image: '',
- description: 'New Desc',
- },
- ],
+ user: {
+ joinedOrganizations: [
+ {
+ __typename: 'Organization',
+ _id: '6401ff65ce8e8406b8f07af2',
+ name: 'joinedOrganization',
+ image: '',
+ description: 'New Desc',
+ },
+ ],
+ },
},
],
},
diff --git a/src/screens/UserPortal/Organizations/Organizations.tsx b/src/screens/UserPortal/Organizations/Organizations.tsx
index 530989757a..80e7fb8cd0 100644
--- a/src/screens/UserPortal/Organizations/Organizations.tsx
+++ b/src/screens/UserPortal/Organizations/Organizations.tsx
@@ -112,7 +112,7 @@ export default function organizations(): JSX.Element {
}
} else if (mode == 1) {
if (data2) {
- setOrganizations(data2.users[0].joinedOrganizations);
+ setOrganizations(data2.users[0].user.joinedOrganizations);
}
} else if (mode == 2) {
if (data3) {