Repository navigation
[O2B-1631] Allow users to link logs to simulation passes #2251
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 3 commits into
main
from
feature/O2B-1631/logs-linked-to-simulation-passes
Oct 19, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
48 changes: 48 additions & 0 deletions
48
lib/database/migrations/v1/20261019100000-create-log-simulation-passes.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,48 @@ | ||
| /** | ||
| * @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. | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| module.exports = { | ||
| up: async (queryInterface, Sequelize) => queryInterface.createTable('log_simulation_passes', { | ||
| log_id: { | ||
| type: Sequelize.INTEGER, | ||
| primaryKey: true, | ||
| allowNull: false, | ||
| references: { model: 'logs', key: 'id' }, | ||
| onUpdate: 'CASCADE', | ||
| onDelete: 'CASCADE', | ||
| }, | ||
| simulation_pass_id: { | ||
| type: Sequelize.INTEGER, | ||
| primaryKey: true, | ||
| allowNull: false, | ||
| references: { model: 'simulation_passes', key: 'id' }, | ||
| onUpdate: 'CASCADE', | ||
| onDelete: 'CASCADE', | ||
| }, | ||
| created_at: { | ||
| allowNull: false, | ||
| type: Sequelize.DATE, | ||
| defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'), | ||
| }, | ||
| updated_at: { | ||
| allowNull: false, | ||
| type: Sequelize.DATE, | ||
| defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), | ||
| }, | ||
| }), | ||
|
|
||
| down: async (queryInterface) => queryInterface.dropTable('log_simulation_passes'), | ||
| }; |
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
39 changes: 39 additions & 0 deletions
39
lib/database/repositories/LogSimulationPassesRepository.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,39 @@ | ||
| /** | ||
| * @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 { tables: { LogSimulationPasses } } = require('..'); | ||
| const Repository = require('./Repository'); | ||
|
|
||
| /** | ||
| * Sequelize implementation of the LogSimulationPassesRepository. | ||
| */ | ||
| class LogSimulationPassesRepository extends Repository { | ||
| /** | ||
| * Creates a new `LogSimulationPassesRepository` instance. | ||
| */ | ||
| constructor() { | ||
| super(LogSimulationPasses); | ||
| } | ||
|
|
||
| /** | ||
| * Bulk insert logSimulationPasses. | ||
| * | ||
| * @param {{logId: number, simulationPassId: number}[]} entities the links to insert | ||
| * @returns {Promise} Promise object represents the recently inserted LogSimulationPasses. | ||
| */ | ||
| async bulkInsert(entities) { | ||
| return LogSimulationPasses.bulkCreate(entities, { returning: true }); | ||
| } | ||
| } | ||
|
|
||
| module.exports = new LogSimulationPassesRepository(); |
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
lib/database/seeders/20240125141300-log-simulation-passes.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. | ||
| */ | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| module.exports = { | ||
| up: async (queryInterface) => | ||
| queryInterface.sequelize.transaction((transaction) => | ||
| queryInterface.bulkInsert('log_simulation_passes', [ | ||
| { log_id: 1, simulation_pass_id: 1 }, | ||
| { log_id: 1, simulation_pass_id: 2 }, | ||
| { log_id: 2, simulation_pass_id: 3 }, | ||
| { log_id: 119, simulation_pass_id: 1 }, | ||
| ], { transaction })), | ||
|
|
||
| down: async (queryInterface) => | ||
| queryInterface.sequelize.transaction((transaction) => | ||
| queryInterface.bulkDelete('log_simulation_passes', null, { transaction })), | ||
| }; |
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,38 @@ | ||
| /** | ||
| * @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. | ||
| */ | ||
|
|
||
| module.exports = (sequelize) => { | ||
| const Sequelize = require('sequelize'); | ||
|
|
||
| const LogSimulationPasses = sequelize.define('log_simulation_passes', { | ||
| logId: { | ||
| allowNull: false, | ||
| primaryKey: true, | ||
| type: Sequelize.INTEGER, | ||
| }, | ||
| simulationPassId: { | ||
| allowNull: false, | ||
| primaryKey: true, | ||
| type: Sequelize.INTEGER, | ||
| }, | ||
| }); | ||
|
|
||
| LogSimulationPasses.removeAttribute('id'); | ||
|
|
||
| LogSimulationPasses.associate = (models) => { | ||
| LogSimulationPasses.belongsTo(models.SimulationPass, { foreignKey: 'simulation_pass_id', as: 'simulationPass' }); | ||
| LogSimulationPasses.belongsTo(models.Log, { foreignKey: 'log_id', as: 'log' }); | ||
| }; | ||
|
|
||
| return LogSimulationPasses; | ||
| }; |
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
Oops, something went wrong.
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.