@@ -20,44 +20,49 @@ export async function getPushNotification({
20
20
pushNotificationLinkId,
21
21
} : GetPushNotificationParam ) : Promise < GetPushNotificationResult > {
22
22
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();
26
26
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
+ // );
42
42
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
+ // }
49
49
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
+ // }
56
56
57
+ // return {
58
+ // title: linkWithTitle?.to.value.value,
59
+ // body: linkWithBody.to.value.value,
60
+ // };
61
+ const { data : [ link ] } = await deep . select ( pushNotificationLinkId ) ;
57
62
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
+ }
61
66
}
62
67
63
68
export interface GetPushNotificationParam {
0 commit comments