Skip to content

Commit

Permalink
add device and os insteadof deviceos
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanngocptn committed May 15, 2024
1 parent 788bbc4 commit 770738a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,5 @@ export type HookMessageDataType = {
mechanism?: string;
device?: string;
os?: string;
deviceOs?: string;
detailLink?: string;
};
15 changes: 1 addition & 14 deletions src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ export class AppService {
Authorization: `Bearer ${process.env.SENTRY_INTEGRATION_TOKEN}`,
},
});

const device = data
?.find((item) => item?.key === 'device')
?.topValues?.map((item) => item?.value);

const os = data
?.find?.((item) => item?.key === 'os')
?.topValues?.map?.((item) => item?.value);

const deviceOs = device
?.map?.((item, index) => `${item} (${os?.[index]})`)
?.join?.(', ');

return data?.reduce(
(cur, nex) => ({
...cur,
Expand All @@ -60,7 +47,7 @@ export class AppService {
?.filter((item) => !!item)
?.join(', '),
}),
{ deviceOs },
{},
) as HookMessageDataType;
}
}
6 changes: 4 additions & 2 deletions src/app.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export function generateHookMessageEn(data: HookMessageDataType) {
\\- *Position:* ${_data.errorPosition || 'none'}
\\- *Environment:* ${_data.environment || 'none'}
\\- *Version:* ${_data.release || 'none'}
\\- *Devices:* ${_data.deviceOs || 'none'}
\\- *Devices:* ${_data.device || 'none'}
\\- *Operation System:* ${_data.os || 'none'}
*Detail:* [HERE](${_data.detailLink})
`;
Expand All @@ -26,7 +27,8 @@ export function generateHookMessageVi(data: HookMessageDataType) {
\\- *Lỗi ở:* ${_data.errorPosition || 'none'}
\\- *Môi trường:* ${_data.environment || 'none'}
\\- *Phiên bản:* ${_data.release || 'none'}
\\- *Thiết bị:* ${_data.deviceOs || 'none'}
\\- *Thiết bị:* ${_data.device || 'none'}
\\- *Hệ điều hành:* ${_data.os || 'none'}
*Xem chi tiết:* [TẠI ĐÂY](${_data.detailLink})
`;
Expand Down

0 comments on commit 770738a

Please sign in to comment.