@@ -20,44 +20,49 @@ export async function getPushNotification({
2020 pushNotificationLinkId,
2121} : GetPushNotificationParam ) : Promise < GetPushNotificationResult > {
2222 const $package = new Package ( { deep } ) ;
23- const titleTypeLinkId = await $package . PushNotificationTitle . id ( ) ;
24- const bodyTypeLinkId = await $package . PushNotificationBody . id ( ) ;
25- const pushNotificationTreeLinkId = await $package . PushNotificationTree . id ( ) ;
23+ // const titleTypeLinkId = await $package.PushNotificationTitle.id();
24+ // const bodyTypeLinkId = await $package.PushNotificationBody.id();
25+ // const pushNotificationTreeLinkId = await $package.PushNotificationTree.id();
2626
27- const { data : linksDownToParentPushNotificationMp } = await deep . select (
28- {
29- up : {
30- parent_id : { _eq : pushNotificationLinkId } ,
31- tree_id : { _eq : pushNotificationTreeLinkId } ,
32- } ,
33- } ,
34- {
35- returning : `${ deep . selectReturning }
36- to {
37- ${ deep . selectReturning }
38- }
39- ` ,
40- }
41- ) ;
27+ // const { data: linksDownToParentPushNotificationMp } = await deep.select(
28+ // {
29+ // up: {
30+ // parent_id: { _eq: pushNotificationLinkId },
31+ // tree_id: { _eq: pushNotificationTreeLinkId },
32+ // },
33+ // },
34+ // {
35+ // returning: `${deep.selectReturning}
36+ // to {
37+ // ${deep.selectReturning}
38+ // }
39+ // `,
40+ // }
41+ // );
4242
43- const linkWithTitle = linksDownToParentPushNotificationMp . find (
44- ( link ) => link . type_id === titleTypeLinkId
45- ) ;
46- if ( ! linkWithTitle ) {
47- throw new Error ( `A link with type ##${ titleTypeLinkId } is not found` ) ;
48- }
43+ // const linkWithTitle = linksDownToParentPushNotificationMp.find(
44+ // (link) => link.type_id === titleTypeLinkId
45+ // );
46+ // if (!linkWithTitle) {
47+ // throw new Error(`A link with type ##${titleTypeLinkId} is not found`);
48+ // }
4949
50- const linkWithBody = linksDownToParentPushNotificationMp . find (
51- ( link ) => link . type_id === bodyTypeLinkId
52- ) ;
53- if ( ! linkWithBody ) {
54- throw new Error ( `A link with type ##${ bodyTypeLinkId } is not found` ) ;
55- }
50+ // const linkWithBody = linksDownToParentPushNotificationMp.find(
51+ // (link) => link.type_id === bodyTypeLinkId
52+ // );
53+ // if (!linkWithBody) {
54+ // throw new Error(`A link with type ##${bodyTypeLinkId} is not found`);
55+ // }
5656
57+ // return {
58+ // title: linkWithTitle?.to.value.value,
59+ // body: linkWithBody.to.value.value,
60+ // };
61+ const { data : [ link ] } = await deep . select ( pushNotificationLinkId ) ;
5762 return {
58- title : linkWithTitle ?. to . value . value ,
59- body : linkWithBody . to . value . value ,
60- } ;
63+ title : link . value . value . title ,
64+ body : link . value . value . body ,
65+ }
6166}
6267
6368export interface GetPushNotificationParam {
0 commit comments