Skip to content

refactor: add http proxy endpoints#2277

Merged
rsdmike merged 5 commits into
device-management-toolkit:mainfrom
berosaso:get-post-http-proxy
Aug 26, 2025
Merged

refactor: add http proxy endpoints#2277
rsdmike merged 5 commits into
device-management-toolkit:mainfrom
berosaso:get-post-http-proxy

Conversation

@berosaso

@berosaso berosaso commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

Covering create and select all operations

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

Creating endpoints to support get all and create operations, for http proxies linked to a profile

Anything the reviewer should know when reviewing this PR?

If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )

@jaolanlo
jaolanlo requested a review from graikhel-intel August 7, 2025 07:09
@jaolanlo jaolanlo changed the title feat(http proxy): Add new endpoints feat(proxy): add new endpoints Aug 7, 2025
@berosaso
berosaso force-pushed the get-post-http-proxy branch 2 times, most recently from 8848ddf to 4128486 Compare August 11, 2025 06:11
@berosaso berosaso changed the title feat(proxy): add new endpoints feat(api): create endpoints for http proxies Aug 11, 2025
@berosaso
berosaso force-pushed the get-post-http-proxy branch from 1bc1bec to 810618a Compare August 11, 2025 19:04
@graikhel-intel
graikhel-intel requested a review from Copilot August 12, 2025 18:29

This comment was marked as outdated.

@berosaso berosaso changed the title feat(api): create endpoints for http proxies feat(api): add endpoints for http proxies Aug 13, 2025
@jaolanlo
jaolanlo requested a review from Copilot August 13, 2025 05:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds HTTP proxy configuration support by implementing API endpoints for creating and retrieving proxy profiles linked to AMT profiles. The implementation includes validation, database operations, and integration with the existing profile system.

  • Add comprehensive proxy profile management with create and read operations
  • Integrate proxy configurations into AMT profiles with priority-based ordering
  • Implement database schema and operations for proxy profile storage

Reviewed Changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/utils/constants.ts Code style formatting changes from single to double quotes
src/routes/admin/proxies/ New proxy API endpoints with validation and CRUD operations
src/models/ Extended data models to support proxy configurations
src/interfaces/database/ New database interfaces for proxy profile operations
src/data/postgres/tables/ Database implementation for proxy profile storage and relationships
data/init.sql Database schema for proxy configurations and profile associations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/routes/admin/proxies/create.ts Outdated
Comment thread src/data/postgres/tables/proxiesProfiles.test.ts Outdated
Comment thread src/data/postgres/tables/proxiesProfiles.test.ts Outdated
Comment thread src/data/postgres/tables/proxiesProfiles.test.ts Outdated
Comment thread src/routes/admin/proxies/proxiesValidator.ts Outdated
@madhavilosetty-intel
madhavilosetty-intel force-pushed the get-post-http-proxy branch 3 times, most recently from bf5f561 to 6500fb2 Compare August 13, 2025 19:03
@madhavilosetty-intel madhavilosetty-intel changed the title feat(api): add endpoints for http proxies feat: add http proxy endpoints Aug 13, 2025
@berosaso
berosaso force-pushed the get-post-http-proxy branch 5 times, most recently from 484cece to 73828d2 Compare August 15, 2025 07:48
Comment thread data/init.sql Outdated
Comment thread data/init.sql Outdated
Comment thread src/data/postgres/index.ts Outdated
@berosaso
berosaso force-pushed the get-post-http-proxy branch from a425614 to 7605988 Compare August 15, 2025 17:45
@berosaso
berosaso force-pushed the get-post-http-proxy branch from 6842bbd to f19d0a2 Compare August 24, 2025 04:10
@berosaso berosaso changed the title feat: add http proxy endpoints refactor: add http proxy endpoints Aug 24, 2025
@jaolanlo
jaolanlo requested a review from rsdmike August 25, 2025 17:32
Comment thread src/data/postgres/tables/profiles.ts Outdated
}

if (amtConfig.proxyConfigs) {
if (amtConfig.proxyConfigs?.length > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the question mark already checks if proxyConfigs is null or undefined, so remove if condition on 273 as it is redundant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @rsdmike , tried to remove line 273 but it complains about the following:

image

Same case for all other comments about the same topic. BTW, I took as reference code on line 263.

Comment thread src/data/postgres/tables/profiles.ts Outdated
amtConfig.tenantId
)
}
if (amtConfig.proxyConfigs && amtConfig.proxyConfigs?.length > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment here, ? already checks null/undefined

[accessInfo, tenantId]
)

if (results?.rowCount) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

[accessInfo, tenantId]
)

if (results?.rowCount) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

proxyConfig.tenantId
]
)
if (results?.rowCount) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

)

latestItem = await this.getByName(proxyConfig.accessInfo, proxyConfig.tenantId)
if (results?.rowCount) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

[configName, tenantId]
)

if (deleteProfileWifiResults?.rowCount) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

)
)

if (proxyProfilesQueryResults?.rowCount) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

[tenantId]
)
let count = 0
if (result != null && result.rows?.length > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: if (result?.rows?.length > 0) {

[accessInfo, tenantId]
)
if (profiles?.rowCount) {
if (profiles.rowCount > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

@berosaso
berosaso force-pushed the get-post-http-proxy branch from 1937247 to eaa5a23 Compare August 26, 2025 00:26
@jaolanlo
jaolanlo force-pushed the get-post-http-proxy branch from eaa5a23 to b91c7fe Compare August 26, 2025 00:48
@rsdmike
rsdmike merged commit d08fc2e into device-management-toolkit:main Aug 26, 2025
9 checks passed
@RosieAMT

RosieAMT commented Oct 8, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 2.28.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants