Skip to content

[OGUI-1688] Update API endpoint to retrieve list of objects based on filter v2#2931

Merged
graduta merged 15 commits into
devfrom
feature/QCG/OGUI-1688/add-ccdb-endpoint-that-filters-based-on-run-number-v2
Jun 18, 2025
Merged

[OGUI-1688] Update API endpoint to retrieve list of objects based on filter v2#2931
graduta merged 15 commits into
devfrom
feature/QCG/OGUI-1688/add-ccdb-endpoint-that-filters-based-on-run-number-v2

Conversation

@NarrowsProjects
Copy link
Copy Markdown
Collaborator

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

This PR alters the ObjectController::getObjects function and and corresponding ObjectService functions to accept filters as an optional parameter.

The objectService function will decide between the ccdb's tree and latest API based on the presence of the filters

It also adds middleware for the following endpoints:
/object
/object/:id
/objects

Comment thread QualityControl/lib/controllers/ObjectController.js
Comment thread QualityControl/lib/services/QcObject.service.js Outdated
Comment thread QualityControl/lib/services/QcObject.service.js Outdated
Comment thread QualityControl/lib/services/QcObject.service.js Outdated
Comment on lines +134 to +138
async getObjectsLatestVersionList(
prefix = this._PREFIX,
filters,
fields,
) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider options object:

Suggested change
async getObjectsLatestVersionList(
prefix = this._PREFIX,
filters,
fields,
) {
async getObjectsLatestVersionList({ prefix = this._PREFIX, filters = {}, fields = [PATH, CREATED, LAST_MODIFIED] } = {}) {

Copy link
Copy Markdown
Collaborator Author

@NarrowsProjects NarrowsProjects Jun 16, 2025

Choose a reason for hiding this comment

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

For only three arguments?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, filters and fields can be mixed in order by mistake

Comment thread QualityControl/lib/api.js Outdated
Comment thread QualityControl/lib/controllers/ObjectController.js

return async (req, res, next) => {
try {
req.params.id = await qcgIdDto.validateAsync(req.params?.id);
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.

Why is this Dto referring to qcg (which is the name of the application) instead of to the actual entity? In this case, is it an object, is it a layout?

As far as I can tell from the qcgIdDto implementation, this is a general string check that has min 1 character. Thus, it should be placed in a separate file and named accordingly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a qcObjectId (I think) (refer to QCObject.service.js::109). So, It does belong in that file, it should just be named differently.

Comment thread QualityControl/lib/controllers/ObjectController.js
Comment thread QualityControl/lib/services/QcObject.service.js Outdated
Comment thread QualityControl/lib/controllers/ObjectController.js Outdated
Comment thread QualityControl/lib/controllers/ObjectController.js Outdated
@NarrowsProjects NarrowsProjects force-pushed the feature/QCG/OGUI-1688/add-ccdb-endpoint-that-filters-based-on-run-number-v2 branch from c62ca5a to 436e041 Compare June 18, 2025 12:04
@graduta graduta merged commit 3e458c1 into dev Jun 18, 2025
10 checks passed
@graduta graduta deleted the feature/QCG/OGUI-1688/add-ccdb-endpoint-that-filters-based-on-run-number-v2 branch June 18, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants