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

feature/deseng751: Added external link model, service, and swagger definitions. Updated search service. #83

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

jareth-whitney
Copy link
Contributor

  • Added external link model, service, and swagger definitions.
  • Updated search service.

Copy link
Contributor

@Baelx Baelx left a comment

Choose a reason for hiding this comment

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

Thanks for this! Please see my comments. I'm basically just asking for commented-out code to be removed. Also if you copied code from other controllers to bootstrap you, please just be sure to remove any references to the other models (Comments, CommentPeriods, etc.) if necessary.

Since you may be starting a different ticket, I'll leave this one approved so you can merge it first

projectPhase: { type: String, default: '' },
checkbox: { type: Boolean, default: false },

// alt: { type: String, default: '' },
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure to remove these commented-out lines!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies, this was commented out in the planning stage while determining which properties were required.

defaultLog.info("Saved new external link object:", link._id);
const Comment = mongoose.model('Comment');
const c = await Comment.update({ _id: _comment }, { $addToSet: { documents: link._id } });
defaultLog.info('External link updated:', c);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying to understand this comment here. Was the external link updated at all? It seems more like the Comment was updated. Maybe some variable names/comments need to be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right so this controller is based on the document controller, but modified as needed. In this case, the unProtectedPost is not even being used at the moment. There is a feature in LUP that allows end users to upload files. If we decided to let them upload links, this is where it would be handled. However, because it's not being used, I'm going to remove it from the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, agreed - it doesn't seem like external links would need that!

true) // count
.then((data) => {
Utils.recordAction('Head', 'ExternalLink', args.swagger.params.auth_payload.preferred_username, args.swagger.params.exLinkId?.value || null);
// /api/commentperiod/ route, return 200 OK with 0 items if necessary
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you actually hitting the /api/commentperiod route here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment removed

defaultLog.info('EXTERNAL LINK PROTECTED POST');
try {
const project = args.swagger.params.project?.value;
// const _comment = args.swagger.params._comment.value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this commented-out code needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed... see above comment about figuring out needed properties.

extLink.description = args.swagger.params.description.value;
extLink.projectPhase = args.swagger.params.projectPhase.value;
extLink.checkbox = 'true' === args.body.checkbox ? true : false;
// extLink._comment = _comment;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this commented-out code needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

obj.dateAdded = args.swagger.params.dateAdded.value;
obj.dateUpdated = args.swagger.params.dateUpdated.value;
obj.description = args.swagger.params.description.value;
obj.section = "null" === args.swagger.params.section.value ? null : args.swagger.params.section.value;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would do the same thing. There may be an even shorter way to do it

Suggested change
obj.section = "null" === args.swagger.params.section.value ? null : args.swagger.params.section.value;
obj.section = args.swagger.params.section.value ? args.swagger.params.section.value : null;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately I don't think it would work in this situation, since we're looking for a string with the text "null".

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right! I remember that sections can be "null" sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I believe it's because everything has to be stringified for the API request and then converted back

Copy link
Contributor

@Baelx Baelx left a comment

Choose a reason for hiding this comment

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

I'm back in the office now and will set this to Request Changes

Copy link
Contributor

@Baelx Baelx left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

@jareth-whitney jareth-whitney merged commit 9487bee into dev Jan 14, 2025
2 of 3 checks passed
@jareth-whitney jareth-whitney deleted the feature/deseng751 branch January 14, 2025 19:06
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