-
Notifications
You must be signed in to change notification settings - Fork 23
[O2B-1602] Add endpoint retrieval of pdp beam types and runs endpoint filtering option #2203
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
Merged
graduta
merged 26 commits into
main
from
feature/O2B-1602-add-pdp-beam-type-filter-back-end
Aug 4, 2026
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1e8d30e
Fix spelling mistake
graduta ded1c12
Update beam type dto to split and return array of values
graduta 15fdc9c
Remove unused utility and update tests
graduta b9334a3
Fix API tests
graduta 67dd8a3
Push also changes related to Runs as are using the BeamTypesDto
graduta 33cf287
FIx GetAllRuns tests
graduta 1758654
Add endpoint for retrieving all unique pdpBeamTypes
graduta a1273f2
Add runs endpoint option to filter by pdpBeamType
graduta 2d90f63
Fix spelling mistake
graduta 037e703
Update beam type dto to split and return array of values
graduta 7fec84a
Remove unused utility and update tests
graduta f1c60b4
Fix API tests
graduta a8e5a47
Push also changes related to Runs as are using the BeamTypesDto
graduta bde60d6
FIx GetAllRuns tests
graduta bab5e09
Provide more details to beam type format
graduta f051789
Fix test for error message
graduta 8b135f0
Add endpoint for retrieving all unique pdpBeamTypes
graduta 82a202d
Add runs endpoint option to filter by pdpBeamType
graduta 97faefa
Merge branch 'feature/O2B-1602-add-pdp-beam-type-filter-back-end' of …
graduta 9c15437
Merge branch 'main' of github.com:AliceO2Group/Bookkeeping into featu…
graduta d229f01
Reuse beamtype dto for pdpbeamtype as well
graduta 1600a2d
Split the DTOs to provide easier maintainability
graduta 2664829
Fix min limit of beam type
graduta df64691
Add test suite to tests that are to be ran
graduta 71cea32
Improve docs and constant usage on beamTypesDto
graduta 93e0f96
Add test for digit check in pdpBeamType
graduta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| const { repositories: { RunRepository }, sequelize } = require('../../../database'); | ||
| const { Op } = require('sequelize'); | ||
|
|
||
| /** | ||
| * Return the a list of unique PDP beam types which is built from the runs data | ||
| * | ||
| * @returns {Promise<SequelizePdpBeamType[]>} Promise resolving with the list of unique PDP beam types | ||
| */ | ||
| exports.getAllPdpBeamTypes = async () => { | ||
| const pdpBeamTypes = await RunRepository.findAll({ | ||
| where: { | ||
| pdp_beam_type: { | ||
| [Op.ne]: null, | ||
| }, | ||
| }, | ||
| attributes: [[sequelize.fn('DISTINCT', sequelize.col('pdp_beam_type')), 'name']], | ||
| }); | ||
| return pdpBeamTypes; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
test/lib/server/services/pdpBeamTypes/getAllPdpBeamTypes.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| const { expect } = require('chai'); | ||
| const { getAllPdpBeamTypes } = require('../../../../../lib/server/services/beam/getAllPdpBeamTypes.js'); | ||
|
|
||
| module.exports = () => { | ||
| it('should successfully return the full list of not null PDP beam types from runs table', async () => { | ||
| const pdpBeamTypes = await getAllPdpBeamTypes(); | ||
| expect(pdpBeamTypes.map(({ dataValues: { name } }) => ({ name }))).to.deep.eq([ | ||
| { name: 'pp' }, | ||
| { name: 'PbPb' }, | ||
| { name: 'technical' }, | ||
| { name: 'cosmic' }, | ||
| { name: 'OO' }, | ||
| ]); | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| const getAllPdpBeamTypes = require('./getAllPdpBeamTypes.test.js'); | ||
|
|
||
| module.exports = () => { | ||
|
isaachilly marked this conversation as resolved.
|
||
| describe('getAllPdpBeamTypes', getAllPdpBeamTypes); | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.