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

feat: closes #12 #13

Merged
merged 3 commits into from
Aug 17, 2021
Merged

Conversation

sagar-techjoomla
Copy link
Collaborator

No description provided.

}
}
const smsBody = `Congratulations! You have successfully registered for donating <Number of devices donated> smartphones as part of the ""Digital Saathi"" campaign.
\nPlease note your tracking IDs: ${trackingKeys}. You can use these IDs to track the status of delivery for your donated smartphones. Contact 1800-180-8190 for any assistance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The tracking ID sent in the SMS should be the company_id.
  • Replace "" by quantity_of_devices

@@ -0,0 +1,53 @@
import {Entity, model, property} from '@loopback/repository';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This model is not needed

@@ -0,0 +1,53 @@
import {Entity, model, property} from '@loopback/repository';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This model is not needed


export class DonateDeviceController {
constructor(
@repository(DonateDeviceRepository)
public donateDeviceRepository: DonateDeviceRepository,
@repository(CorporateRepository)
public corporateRepository: CorporateRepository,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to create this repository

}
}
const smsBody = `Congratulations! You have successfully registered for donating <Number of devices donated> smartphones as part of the ""Digital Saathi"" campaign.
\nPlease note your tracking IDs: ${trackingKeys}. You can use these IDs to track the status of delivery for your donated smartphones. Contact 1800-180-8190 for any assistance.
Copy link
Contributor

@bharatkashyap bharatkashyap Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The "Number of devices donated" should be replaced by quantitiy_of_devices
  • The tracking ID should be company_id

return [obj?.template, obj?.templateId, obj?.variables];
};

const onSuccess = async ({ data }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need an onSuccess hook in this component

@@ -21,6 +21,21 @@ const EXTENDED_DONATION_RECORD = gql`
}
}
`;
const EXTENDED_CORPORATE_DEVICES_RECORD = gql`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refactor this to include every custom graphQL fragment in a separate file in a fragments directory inside customHasura?

else setDisplayCertificate(false);
let {allStatus} = trackingResponse ?? false;
if(allStatus) {
const obj = config.statusChoices.filter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

let { phone_number } = obj;
phone_number = `******${phone_number.slice(6)}`;
obj.phone_number = phone_number;
let modifiyData = array.map(element => element.delivery_status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't perform these additional functions (adding name and other attributes to the response) in the maskPhoneNumber function - can we create a separate function to do this and let maskPhoneNumber remain as it was

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: modifiyData -> modifyData

@@ -46,6 +46,7 @@ async function printPdf(name, trackingKey, udise) {
donor: {
trackingKey: trackingKey,
name: name,
phone_number:phone_number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a masked phone number - no point adding it to the certificate in this way. Let's skip this, and solve this in this issue

{isSmall ? (
<SimpleList
primaryText={(record) => record.name}
secondaryText={(record) => record.district}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

district will not exist on this record

obj.name = name;
} else if(device_donation_corporate.poc_phone_number) {
phone_number = `******${device_donation_corporate.poc_phone_number.slice(6)}`;
obj.name = device_donation_corporate.poc_name;
Copy link
Contributor

@bharatkashyap bharatkashyap Aug 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name should be company_name instead of poc_name

const smsBody = `Congratulations! You have successfully registered for donating ${gqlResponse.insert_device_donation_corporates_one.quantity_of_devices} smartphones as part of the "Digital Saathi" campaign. \nPlease note your tracking IDs: ${instanceID}. You can use these IDs to track the status of delivery for your donated smartphones. Contact 1800-180-8190 for any assistance.\n\n- Samagra Shiksha, Himachal Pradesh`;

const contactNumber = corporateType.poc_phone_number;
const smsDispatchResponse = sendSMS(smsBody, instanceID, contactNumber, "1007668058014878711");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the templateIds saved as environment variables? LGTM otherwise.

@bharatkashyap bharatkashyap merged commit 1cb66b1 into Samagra-Development:master Aug 17, 2021
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