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

Admin - Extend site edit functionality #958

Merged
merged 45 commits into from
Dec 18, 2023
Merged

Admin - Extend site edit functionality #958

merged 45 commits into from
Dec 18, 2023

Conversation

echaidemenos
Copy link
Collaborator

@echaidemenos echaidemenos commented Dec 14, 2023

Adds a new column contact_information to site table

Adds the ability to edit these extra fields:

  • status
  • display
  • video stream
  • contact information

image

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ This pull request was sent to the PullRequest network.


Check the status or cancel PullRequest code review here.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest Breakdown

Reviewable lines of change

+ 640
- 98

45% TSX
42% TypeScript
9% TypeScript (tests)
4% Jest Snapshot (tests)
1% TSX (tests)

Type of change

Feature - These changes are adding a new feature or improvement to existing code.
1 Message
⚠️ Due to its size, this pull request will likely have a little longer turnaround time and will probably require multiple passes from our reviewers.

Copy link

github-actions bot commented Dec 14, 2023

Build succeeded and deployed at https://aqualink-app-958.surge.sh
(hash 212bf2e deployed at 2023-12-17T20:04:05)

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

This is looking like a great start, but is missing test coverage. I also have a question inline for your consideration. Other than that, all the changes around falling back to undefined or null or empty string, sometimes using ?? and sometimes using || seem a little inconsistent - what was the reason for those changes?

Image of Graham C Graham C


Reviewed with ❤️ by PullRequest

packages/api/src/monitoring/monitoring.service.ts Outdated Show resolved Hide resolved
Base automatically changed from monitoring-application-admin to master December 15, 2023 12:24
@ericboucher ericboucher changed the title Extend site edit functionality Admin - Extend site edit functionality Dec 15, 2023
onGetMetrics();
}
};
if (fetchOnEnter) document.addEventListener('keydown', keyDownHandler);
Copy link

Choose a reason for hiding this comment

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

I'd always recommend using braces with if statements.

🔸 Reduce Future Bugs (Important)

Image of Graham C Graham C

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest reviewed the updates made to #958 up until the latest commit (a8d46fe). No further issues were found.

Reviewed by:

Image of Graham C Graham C

@@ -296,26 +297,30 @@ export class MonitoringService {
: baseQuery;

const withSiteName = siteName
? withSiteId.andWhere('site.name = :siteName', { siteName })
? withSiteId.andWhere('site.name ILIKE :siteName', {
siteName: `%${siteName}%`,
Copy link

Choose a reason for hiding this comment

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

Embedding the siteName, adminEmail, etc in % is incorrect as it omits to take into account that they themselves may contain characters with a semantics other than a literal interpretation, such as a backslash, underscore or percentage symbol. One needs to apply escaping to each string before wrapping them in the percentages.

One should define a function to apply escaping of values so that they can be used in a LIKE expression. For example, this will replace siteName with a safe version of it, that can be wrapped in double quotes without issue.

siteName.replaceAll('\\', '\\\\').replaceAll('_', '\\_').replaceAll('%', '\\%'))

FYI, the replace order matters, at least that all the backslashes are escaped first, then the other two can be escaped in either order.

🔺 Bug (Critical)

Image of Graham C Graham C

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest reviewed the updates made to #958 up until the latest commit (212bf2e). No further issues were found.

Reviewed by:

Image of Graham C Graham C

@ericboucher ericboucher merged commit fe25a19 into master Dec 18, 2023
3 checks passed
@ericboucher ericboucher deleted the site-edit branch December 18, 2023 16:14
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