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

Refactor Resource Form: Create new broadcast upon successful resource form submission #1031

Merged
merged 4 commits into from
Jun 9, 2024

Conversation

shivamgaur99
Copy link
Contributor

@shivamgaur99 shivamgaur99 commented Jun 7, 2024

Closes: #1021

##Description

Refactor the resource form so that a new broadcast gets created on successful submission

Screenshots

image
image
image

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (Documentation content changed)
  • Other (please describe):

Checklist

Put an x in the boxes that apply

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • My changes does not break the current system and it passes all the current test cases.

Other information

Any other information that is important to this pull request

@auto-assign auto-assign bot requested a review from Kajol-Kumari June 7, 2024 20:26
@shivamgaur99
Copy link
Contributor Author

@Kajol-Kumari Please review and let me know if any changes are required.

Copy link
Member

@Kajol-Kumari Kajol-Kumari left a comment

Choose a reason for hiding this comment

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

Screenshot 2024-06-08 at 12 10 24 PM I am getting this error while trying to create a resource, can you fix it?

trustLevel: Joi.number().integer().required(),
expiryDate: Joi.date().required(),
additionalInfo: Joi.string().trim().min(5),
// const ResourcesValidationSchema = Joi.object().keys({
Copy link
Member

Choose a reason for hiding this comment

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

please remove the commented code as it won't be needed anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, also, we don't need resource model as we are using brodcast model and previous backend code addresource, get resource , deleteResource: should i remove it or skip that?

Copy link
Member

Choose a reason for hiding this comment

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

Please remove it as it will just redundant code after this change

Copy link
Contributor Author

@shivamgaur99 shivamgaur99 Jun 8, 2024

Choose a reason for hiding this comment

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

image

also removing it from the admin dashboard as we are managing all resources in broadcast section

Copy link
Member

Choose a reason for hiding this comment

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

yeah, that should be fine

@shivamgaur99
Copy link
Contributor Author

shivamgaur99 commented Jun 8, 2024

Screenshot 2024-06-08 at 12 10 24 PM I am getting this error while trying to create a r
image

The error was occurring for me too when I made changes in the backend code, but it got fixed when I restarted my application.

@shivamgaur99
Copy link
Contributor Author

@Kajol-Kumari i configured .env and tested in my local
image

Copy link
Member

@Kajol-Kumari Kajol-Kumari left a comment

Choose a reason for hiding this comment

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

LGTM

@Kajol-Kumari Kajol-Kumari added level2 Bug fixing, adding small features. gssoc GSSoC'24 Label labels Jun 8, 2024
@Kajol-Kumari
Copy link
Member

@shivamgaur99 one thing i forgot, where is the isApproved flag? as soon as we save the resource, the broadcast should get created with the flag set to false by default. Once the admins approve it, it should set to true

@Kajol-Kumari
Copy link
Member

@shivamgaur99 please make sure to introduce the isApproved flag in broadcast schema having default value set to false

@Kajol-Kumari
Copy link
Member

@shivamgaur99 please let me know when the pr becomes ready for review(isApproved flag is yet missing)

@Kajol-Kumari Kajol-Kumari added level3 New features, major bug fixing. and removed level2 Bug fixing, adding small features. labels Jun 8, 2024
@shivamgaur99
Copy link
Contributor Author

i will make pr by morning after testing everything is working as expected

@shivamgaur99
Copy link
Contributor Author

Please review, all changes have been made :)

} = require('./utility/emailTemplates');
const Admin = require('./app/models/Admin');

// Cron job to delete all resource data for 2months
cronJob('0 0 2 * *', async (req, res, next) => {
Copy link
Member

Choose a reason for hiding this comment

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

we might need the cron job later to delete the broadcast/contactUs data which are older than 6 months/1 year as they will just keep on accumulating no?, for now it should be fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since there was no cron job for the broadcast, I didn't add it. Can I add it to the current PR?

Copy link
Member

Choose a reason for hiding this comment

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

If i think in long term, the broadcast and contactUs data will grow na but admin have delete functionality so should
Be fine o believe, skip it for now, i will add it later if required

@Kajol-Kumari Kajol-Kumari merged commit 70d21f4 into HITK-TECH-Community:main Jun 9, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc GSSoC'24 Label level3 New features, major bug fixing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor the resource form so that a new broadcast gets created on successful submission
2 participants