Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added tag parameter for filter in list #1395

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

akp111
Copy link
Collaborator

@akp111 akp111 commented Sep 24, 2024

Fixes Issue

Changes proposed

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

@akp111 akp111 changed the title fix: added atg parameter for filter in list fix: added tag parameter for filter in list Sep 24, 2024
Copy link

In getChannels.ts file:

  1. There is a typo in the catch block of the axiosGet promise chain:
    Change:
throw new Error(`[Push SDK] - API  - Error - API ${requestUrl} -: ${err}`);

to:

throw new Error(`[Push SDK] - API - Error - API ${requestUrl} -: ${err}`);
  1. In PushNotificationTypes.ts file:
  • There is a typo in the type definition of ChannelFeedsOptions:
    Change:
filter?: NotifictaionType;

to:

filter?: NotificationType;
  • The ChannelOptions type is missing a property type after raw:
    Change:
export type ChannelOptions = {
  raw: boolean;

to:

export type ChannelOptions = {
  raw: boolean;
};
  1. In channel.ts file:
  • The notifications method has an unreachable throw statement after the return statement. It should be removed or placed within appropriate logic.

  • The list method has a missing comma after the tag property in the destructuring of the options object. It should be added.

In getChannels.test.ts file:

  • In the second test case, the res variable is being used without being defined. It needs to be defined using the getChannels function call.

After making these corrections, the code looks good.

If you need further assistance, feel free to ask.

Copy link

In the provided code, I found some mistakes and improvements that need to be made:

File: packages/restapi/src/lib/channels/getChannels.ts

  1. In the getChannels function:
    • There is a missing closing brace } at the end of the function.
    • The error message in the catch block should include the original error as well. You can improve it to:
      .catch((err) => {
        console.error(`[Push SDK] - API ${requestUrl}: `, err);
        throw new Error(`[Push SDK] - API Error - ${requestUrl}: ${err.message}`);
      });

File: packages/restapi/src/lib/channels/search.ts

  1. In the search function:
    • There is a missing closing brace } at the end of the function.
    • In the second if condition, there is a missing closing parenthesis } right before the return formattedResponse;.

File: packages/restapi/src/lib/pushNotification/PushNotificationTypes.ts

  1. There are several type definitions missing closing curly braces }:
    • UserSetting
    • AliasInfoOptions
    • FeedsOptions
    • NotificationOptions

File: packages/restapi/src/lib/pushNotification/channel.ts

  1. In the search function:

    • There is a missing try block and catch block.
  2. In the subscribers function:

    • There is an unfinished condition block with a missing closing brace }.
    • There is no check for the existence of PUSH_CHANNEL before calling its methods.
  3. In the info function:

    • There is an unfinished throw new Error() statement.
  4. The ${error}string interpolation within thethrow new Error()` statements is missing the error variable.

  5. The comment lines after the return await PUSH_CHANNEL._getSubscribers({...}) and return await PUSH_CHANNEL.getChannelNotifications({...}) calls should be moved inside the conditional blocks.

File: packages/restapi/tests/lib/channel/getChannels.test.ts

  1. The fetch channels based on the filter and tags test is missing the res variable assignment before using console.log(res.channels[0]);.

File: packages/restapi/tests/lib/channel/search.test.ts

  1. In the second test:
    • The provided test doesn't align with expected test cases as it's missing the test parameters and structure.

General:

  1. There are missing import statements for some required dependencies in these files.

These are the corrections and improvements that should be made. Kindly update the code accordingly. If you need further assistance or clarification, feel free to ask.

All looks good.

@akp111 akp111 merged commit 21c08ba into main Sep 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants