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

[O2B-1118] Add migration files and models for quality control flag types #1380

Merged
merged 359 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
359 commits
Select commit Hold shift + click to select a range
9055503
Merge branch 'xsalonx/O2B-1105/implement-data-passes-service' into xs…
xsalonx Jan 12, 2024
a11b897
expose api
xsalonx Jan 12, 2024
d7a9e60
add test
xsalonx Jan 12, 2024
840a16b
add tests
xsalonx Jan 12, 2024
1616273
Merge branch 'main' into xsalonx/O2B-1105/implement-data-passes-service
xsalonx Jan 12, 2024
1b1925b
Merge branch 'xsalonx/O2B-1105/implement-data-passes-service' into xs…
xsalonx Jan 12, 2024
7473a23
amend
xsalonx Jan 12, 2024
2bd1359
docs
xsalonx Jan 12, 2024
9729b94
Merge branch 'xsalonx/O2B-1105/implement-data-passes-service' into xs…
xsalonx Jan 12, 2024
ec90984
amend test
xsalonx Jan 12, 2024
56cd653
Merge branch 'xsalonx/O2B-1105/implement-data-passes-service' into xs…
xsalonx Jan 12, 2024
b1c6a3d
amend
xsalonx Jan 12, 2024
6bc4cf6
add Data Passes page
xsalonx Jan 15, 2024
e55cf99
expose page
xsalonx Jan 15, 2024
3f291b8
styling
xsalonx Jan 15, 2024
b706d72
add reset method
xsalonx Jan 15, 2024
3f7e450
rename
xsalonx Jan 15, 2024
f5f5da9
use sorting
xsalonx Jan 15, 2024
050fb34
add unit
xsalonx Jan 15, 2024
197c57d
docs
xsalonx Jan 15, 2024
5ea901e
add filtering by data pass id
xsalonx Jan 15, 2024
4f34d9a
add test
xsalonx Jan 15, 2024
0c710f1
amend test
xsalonx Jan 15, 2024
02aab0a
amend test
xsalonx Jan 15, 2024
d7eabb3
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 15, 2024
1e13a4c
init
xsalonx Jan 15, 2024
25339f9
use name instead of id
xsalonx Jan 15, 2024
45d421a
amend test
xsalonx Jan 15, 2024
7201671
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 15, 2024
ca95681
rename
xsalonx Jan 15, 2024
a104d5b
use name instead of id
xsalonx Jan 15, 2024
5c46e0e
put instance
xsalonx Jan 15, 2024
209aef3
add to view and model
xsalonx Jan 15, 2024
4637da2
page openable
xsalonx Jan 15, 2024
c57d4f1
amend profiles
xsalonx Jan 15, 2024
39d38ee
show qualities
xsalonx Jan 15, 2024
09dccf4
refactor
xsalonx Jan 15, 2024
b0d356e
cleanup
xsalonx Jan 15, 2024
64212a0
mergee main
xsalonx Jan 15, 2024
328f4e7
rename
xsalonx Jan 15, 2024
5db6b8b
rename
xsalonx Jan 16, 2024
df751d1
Merge branch 'main' into xsalonx/O2B-1111/implement-data-passes-api
xsalonx Jan 16, 2024
b04e2e6
Merge branch 'xsalonx/O2B-1111/implement-data-passes-api' into xsalon…
xsalonx Jan 16, 2024
8e5c0a0
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 16, 2024
25a7130
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 16, 2024
a9134f0
Merge branch 'main' into xsalonx/O2B-1111/implement-data-passes-api
xsalonx Jan 16, 2024
5a9f836
Merge branch 'xsalonx/O2B-1111/implement-data-passes-api' into xsalon…
xsalonx Jan 16, 2024
32b1fd4
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 16, 2024
d5c4cf8
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 16, 2024
8789e32
use filtering by name
xsalonx Jan 16, 2024
0639e0e
add test
xsalonx Jan 16, 2024
db56755
Merge branch 'main' into xsalonx/O2B-1111/implement-data-passes-api
xsalonx Jan 16, 2024
3abb1c3
Merge branch 'xsalonx/O2B-1111/implement-data-passes-api' into xsalon…
xsalonx Jan 16, 2024
2cc6a1e
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 16, 2024
50ae627
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 16, 2024
eaffd05
use generic model
xsalonx Jan 16, 2024
d4006bb
aboid undefined destruciton error
xsalonx Jan 16, 2024
8bcbf47
use proper method
xsalonx Jan 16, 2024
d9fe318
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 16, 2024
882c541
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 16, 2024
f125887
amend cell expected content
xsalonx Jan 16, 2024
756bc73
Merge branch 'main' into xsalonx/O2B-1111/implement-data-passes-api
xsalonx Jan 16, 2024
4790192
Merge branch 'xsalonx/O2B-1111/implement-data-passes-api' into xsalon…
xsalonx Jan 16, 2024
a58f106
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 16, 2024
d83ed63
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 16, 2024
9ea8ae6
use in RunsOverviewModel
xsalonx Jan 16, 2024
3e6fb0b
rename
xsalonx Jan 16, 2024
ca6d098
rename
xsalonx Jan 16, 2024
d8a7ff4
touched getAllRuns
xsalonx Jan 16, 2024
c798800
Merge branch 'main' into xsalonx/O2B-1111/implement-data-passes-api
xsalonx Jan 17, 2024
1b89f03
Merge branch 'xsalonx/O2B-1111/implement-data-passes-api' into xsalon…
xsalonx Jan 17, 2024
c7eb47b
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 17, 2024
45f091f
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 17, 2024
ec6f2be
Merge branch 'main' into xsalonx/O2B-1113/implement-data-passes-per-l…
xsalonx Jan 17, 2024
2445f5f
Merge branch 'main' into xsalonx/O2B-1113/implement-data-passes-per-l…
xsalonx Jan 17, 2024
c399c1b
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 17, 2024
ec13025
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 17, 2024
ade61de
Merge branch 'main' into xsalonx/O2B-1113/implement-data-passes-per-l…
xsalonx Jan 18, 2024
4cc3e00
extend pai
xsalonx Jan 18, 2024
f4c2d1a
add styling and css
xsalonx Jan 18, 2024
8817ddb
merge main
xsalonx Jan 18, 2024
08a4dc3
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 18, 2024
8c7ccbe
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 18, 2024
c124626
Merge branch 'xsalonx/O2B-1116/implement-runs-per-data-pass-view' int…
xsalonx Jan 18, 2024
b585570
rename
xsalonx Jan 18, 2024
cde3fb5
Merge branch 'xsalonx/O2B-1116/implement-runs-per-data-pass-view' int…
xsalonx Jan 18, 2024
8cc191f
amend test
xsalonx Jan 18, 2024
beaff70
Merge branch 'main' into xsalonx/O2B-1113/implement-data-passes-per-l…
xsalonx Jan 18, 2024
02f8ba7
Merge branch 'main' into xsalonx/O2B-1113/implement-data-passes-per-l…
xsalonx Jan 18, 2024
40fd595
cleanup
xsalonx Jan 18, 2024
fb73b10
linter
xsalonx Jan 18, 2024
5dade18
Merge branch 'main' into xsalonx/O2B-1113/implement-data-passes-per-l…
xsalonx Jan 18, 2024
3648d07
make uppercase
xsalonx Jan 18, 2024
075a303
amend test
xsalonx Jan 18, 2024
7794d21
add test
xsalonx Jan 18, 2024
2aaae46
Merge branch 'xsalonx/O2B-1113/implement-data-passes-per-lhc-peropd-v…
xsalonx Jan 18, 2024
990cc32
merge
xsalonx Jan 18, 2024
f4d0aaf
use correct page
xsalonx Jan 18, 2024
824e3ef
amend dtest
xsalonx Jan 18, 2024
c1a1a0a
amend test
xsalonx Jan 18, 2024
5d33aa3
Merge branch 'xsalonx/O2B-1116/implement-runs-per-data-pass-view' int…
xsalonx Jan 18, 2024
4a48d04
amend tst
xsalonx Jan 19, 2024
9388449
Merge branch 'main' into xsalonx/O2B-1115/implement-runs-per-data-pas…
xsalonx Jan 24, 2024
fb46271
Merge branch 'main' into xsalonx/O2B-1115/implement-runs-per-data-pas…
xsalonx Jan 29, 2024
cc23c96
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Jan 29, 2024
8b7ec77
merge main
xsalonx Jan 29, 2024
906823d
cleanup
xsalonx Jan 29, 2024
1a9d11a
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Jan 29, 2024
0955ab8
Merge branch 'main' into xsalonx/O2B-1116/implement-runs-per-data-pas…
xsalonx Jan 29, 2024
615264a
Merge branch 'main' into xsalonx/O2B-1115/implement-runs-per-data-pas…
xsalonx Jan 29, 2024
3ad44c5
merge main
xsalonx Jan 29, 2024
18135b8
amend
xsalonx Jan 30, 2024
aaf8ca0
Merge branch 'main' into xsalonx/O2B-1115/implement-runs-per-data-pas…
xsalonx Jan 31, 2024
8d87b63
use id
xsalonx Jan 31, 2024
8b97f5c
use builder
xsalonx Jan 31, 2024
3de6abb
Merge branch 'xsalonx/O2B-1115/implement-runs-per-data-pass-api' into…
xsalonx Jan 31, 2024
237e919
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Jan 31, 2024
9235d53
refactor, add spinner
xsalonx Jan 31, 2024
8a0f58e
reset exportableItems
xsalonx Jan 31, 2024
7677431
corrent condition
xsalonx Jan 31, 2024
6ed72df
refactor
xsalonx Jan 31, 2024
dad902f
cleanup
xsalonx Jan 31, 2024
6d6b6dd
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Jan 31, 2024
edb8c09
replace build href
xsalonx Jan 31, 2024
a5852e7
cleanup
xsalonx Jan 31, 2024
7c986f8
correct filter values:
xsalonx Jan 31, 2024
f3e3f34
fixes
xsalonx Feb 1, 2024
5c36027
cleanup
xsalonx Feb 1, 2024
98a2c35
make detectors fetching prvate
xsalonx Feb 1, 2024
bb86789
refactor
xsalonx Feb 1, 2024
086953c
rename
xsalonx Feb 1, 2024
6cd2ab6
rename
xsalonx Feb 1, 2024
9870f18
change error store
xsalonx Feb 1, 2024
4fe036b
refactor
xsalonx Feb 1, 2024
adb340d
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Feb 1, 2024
3d057e8
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Feb 1, 2024
4102c90
Merge branch 'main' into xsalonx/O2B-1123/use-generic-overview-model-…
xsalonx Feb 1, 2024
cd9d896
merge main
xsalonx Feb 2, 2024
c7153e1
merge use generic-runs-model
xsalonx Feb 2, 2024
036c021
wip
xsalonx Feb 2, 2024
b7b6bd1
cleanup
xsalonx Feb 2, 2024
21ea953
amend view
xsalonx Feb 2, 2024
cca7655
cleanup
xsalonx Feb 2, 2024
b436edf
unify title styling
xsalonx Feb 2, 2024
ac95031
unify title styling in RunsPerLhcPeriod
xsalonx Feb 2, 2024
dd53226
rename
xsalonx Feb 2, 2024
0a5cf84
docs correct
xsalonx Feb 2, 2024
fff3b97
refactor
xsalonx Feb 2, 2024
b373c5e
docs
xsalonx Feb 2, 2024
06d0220
merge ancestor
xsalonx Feb 2, 2024
496093a
amend test
xsalonx Feb 2, 2024
d274dee
fix
xsalonx Feb 2, 2024
1c2c163
Merge branch 'xsalonx/O2B-1116/implement-runs-per-data-pass-view' int…
xsalonx Feb 2, 2024
e70f87c
modify cell value checking
xsalonx Feb 2, 2024
cf8315a
modify width
xsalonx Feb 2, 2024
8d42aa5
Merge branch 'xsalonx/O2B-1116/implement-runs-per-data-pass-view' int…
xsalonx Feb 2, 2024
a9c3681
add badge
xsalonx Feb 2, 2024
ec4fec7
adds migration file
xsalonx Feb 2, 2024
f46a479
models WIP
xsalonx Feb 2, 2024
d71c98e
add associations
xsalonx Feb 2, 2024
902d731
amend tests
xsalonx Feb 2, 2024
5cdbbc6
Merge branch 'xsalonx/O2B-1127/runs-counts-in-data-passes-view' into …
xsalonx Feb 2, 2024
940a423
Merge branch 'xsalonx/O2B-1127/runs-counts-in-data-passes-view' into …
xsalonx Feb 2, 2024
b23bc08
add provenance
xsalonx Feb 2, 2024
c5cd3c4
rename fk
xsalonx Feb 2, 2024
a70309f
add associations names
xsalonx Feb 2, 2024
e384e10
simplify
xsalonx Feb 2, 2024
467c052
fix association
xsalonx Feb 2, 2024
aa6d905
amend test
xsalonx Feb 2, 2024
a67d846
Merge remote-tracking branch 'origin/xsalonx/O2B-1127/runs-counts-in-…
xsalonx Feb 2, 2024
df02eb0
docs
xsalonx Feb 2, 2024
cf77397
merge main
xsalonx Feb 2, 2024
1071b8f
Merge branch 'xsalonx/O2B-1123/use-generic-overview-model-in-runs-mod…
xsalonx Feb 2, 2024
14ac132
add typedef
xsalonx Feb 2, 2024
096dfee
:typedefs
xsalonx Feb 2, 2024
fce43d8
typdefs
xsalonx Feb 2, 2024
51416dd
fix
xsalonx Feb 2, 2024
99569c4
fix
xsalonx Feb 2, 2024
f7fd338
rename
xsalonx Feb 2, 2024
849060d
change name
xsalonx Feb 5, 2024
8540d3e
rename
xsalonx Feb 5, 2024
4f4d150
rename
xsalonx Feb 5, 2024
26bbae1
rename
xsalonx Feb 5, 2024
fc27cee
amend association
xsalonx Feb 5, 2024
cc10318
fix naming
xsalonx Feb 5, 2024
716d3ca
rename
xsalonx Feb 5, 2024
d03e8d0
amend naming
xsalonx Feb 5, 2024
031cb8e
a
xsalonx Feb 5, 2024
e015e33
amend associations
xsalonx Feb 5, 2024
0efd65d
disallow null
xsalonx Feb 5, 2024
0f21b1b
merger main
xsalonx Feb 9, 2024
d63eedb
merge main
xsalonx Feb 9, 2024
845b78d
add addociation name
xsalonx Feb 13, 2024
1f9fd69
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 20, 2024
cd4adba
miss
xsalonx Feb 20, 2024
6eae272
fixed
xsalonx Feb 20, 2024
9be4461
revoke
xsalonx Feb 20, 2024
e6481b9
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 21, 2024
12b22a3
rm verifications
xsalonx Feb 21, 2024
fb02386
name archived
xsalonx Feb 23, 2024
9cd4bd6
obsolate to archived
xsalonx Feb 23, 2024
ad453da
simplify association
xsalonx Feb 23, 2024
a7b880c
a
xsalonx Feb 23, 2024
994f92f
Revert "a"
xsalonx Feb 23, 2024
da61477
Revert "simplify association"
xsalonx Feb 23, 2024
cda8a13
docs
xsalonx Feb 23, 2024
5c057be
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 23, 2024
87e91ee
rename
xsalonx Feb 26, 2024
9c69a94
simplify
xsalonx Feb 26, 2024
a96cf0d
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 26, 2024
c289bbd
refactor
xsalonx Feb 26, 2024
59e6c78
refactor
xsalonx Feb 26, 2024
e05b9ad
refactor
xsalonx Feb 26, 2024
3f42609
a
xsalonx Feb 26, 2024
967a5a0
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 26, 2024
80e32bc
add assoc
xsalonx Feb 26, 2024
5f9f02c
rename
xsalonx Feb 26, 2024
b6895c4
cleanup
xsalonx Feb 26, 2024
2302cf7
fix associations
xsalonx Feb 26, 2024
dc7a8bc
comment
xsalonx Feb 26, 2024
0357af6
rename table
xsalonx Feb 27, 2024
ac18f63
reason to type
xsalonx Feb 27, 2024
7fec93c
rename
xsalonx Feb 27, 2024
9894f1d
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 27, 2024
bf80ec9
rename
xsalonx Feb 27, 2024
325df0e
rename
xsalonx Feb 27, 2024
9268c73
fix
xsalonx Feb 27, 2024
995cc2b
typo
xsalonx Feb 27, 2024
a719283
typo
xsalonx Feb 27, 2024
f5cf292
rename
xsalonx Feb 27, 2024
5b15077
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Mar 4, 2024
6cb1fac
add modification control
xsalonx Mar 4, 2024
a066108
update modification control
xsalonx Mar 4, 2024
7fbfc0d
update associatioin name
xsalonx Mar 4, 2024
ad8e851
add color
xsalonx Mar 4, 2024
5113467
add assoc name
xsalonx Mar 4, 2024
61a2a2d
add seeder
xsalonx Mar 4, 2024
09b9885
cherry-pick
xsalonx Mar 4, 2024
e9a08a4
cleanup
xsalonx Mar 4, 2024
c3ba66b
cleanup
xsalonx Mar 4, 2024
981c2c6
use QC
xsalonx Mar 4, 2024
66b7195
restore
xsalonx Mar 4, 2024
b58567f
fix
xsalonx Mar 4, 2024
ade87a1
use QC
xsalonx Mar 4, 2024
6d464f2
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Mar 7, 2024
1c33833
add timeout
xsalonx Mar 7, 2024
55f5a1a
merge main
xsalonx Mar 12, 2024
b39cd35
validator
xsalonx Mar 12, 2024
2f828d1
validator
xsalonx Mar 12, 2024
38c3105
varchar length
xsalonx Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface, Sequelize) => queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable('quality_control_flag_types', {
// Properties
id: {
type: Sequelize.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
name: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
method: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
},
bad: {
type: Sequelize.BOOLEAN,
allowNull: false,
},
color: {
type: Sequelize.STRING(7),
allowNull: true,
martinboulais marked this conversation as resolved.
Show resolved Hide resolved
},

archived_at: {
type: Sequelize.DATE,
allowNull: true,
},

last_updated_by_id: {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: 'users',
key: 'id',
},
},

created_by_id: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'users',
key: 'id',
},
},

// Timestamps
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'),
},
}, { transaction });
}),

down: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.dropTable('quality_control_flag_types', { transaction });
}),
};
2 changes: 2 additions & 0 deletions lib/database/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const User = require('./user');
const LhcPeriod = require('./lhcPeriod');
const LhcPeriodStatistics = require('./lhcPeriodsStatistics');
const DataPass = require('./dataPass.js');
const QCFlagType = require('./qcFlagType.js');
const SimulationPass = require('./simulationPass.js');

module.exports = (sequelize) => {
Expand Down Expand Up @@ -67,6 +68,7 @@ module.exports = (sequelize) => {
LhcPeriod: LhcPeriod(sequelize),
LhcPeriodStatistics: LhcPeriodStatistics(sequelize),
DataPass: DataPass(sequelize),
QCFlagType: QCFlagType(sequelize),
SimulationPass: SimulationPass(sequelize),
};

Expand Down
69 changes: 69 additions & 0 deletions lib/database/models/qcFlagType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* @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 Sequelize = require('sequelize');

module.exports = (sequelize) => {
const QCFlagType = sequelize.define(
'QCFlagType',
{
id: {
type: Sequelize.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
name: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
method: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
},
bad: {
type: Sequelize.BOOLEAN,
allowNull: false,
},
color: {
type: Sequelize.STRING(7),
allowNull: true,
validate: {
is: /^#[0-9a-fA-F]{6}$/i,
},
},
archivedAt: {
type: Sequelize.DATE,
allowNull: true,
},
archived: {
type: Sequelize.VIRTUAL,
defaultValue: null,
// eslint-disable-next-line require-jsdoc
get() {
return Boolean(this.getDataValue('archivedAt'));

Check warning on line 56 in lib/database/models/qcFlagType.js

View check run for this annotation

Codecov / codecov/patch

lib/database/models/qcFlagType.js#L55-L56

Added lines #L55 - L56 were not covered by tests
},
},
},
{ tableName: 'quality_control_flag_types' },
);

QCFlagType.associate = (models) => {
QCFlagType.belongsTo(models.User, { as: 'createdBy', foreignKey: 'createdById' });
QCFlagType.belongsTo(models.User, { as: 'lastUpdatedBy', foreignKey: 'lastUpdatedById' });
};

return QCFlagType;
};
32 changes: 32 additions & 0 deletions lib/database/models/typedefs/SequelizeQCFlagType.js
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.
*/

/**
* @typedef SequelizeQCFlagType
*
* @property {number} id
* @property {string} name
* @property {string} method
* @property {boolean} bad
* @property {string} color as hex
*
* @property {boolean} archived
* @property {Date} archivedAt
*
* @property {Date} createdAt
* @property {number} createdById
* @property {SequelizeUser} createdBy
* @property {Date} updatedAt
* @property {number} lastUpdatedById
* @property {SequelizeUser} lastUpdatedBy
*/
63 changes: 63 additions & 0 deletions lib/database/seeders/20240213120811-quality-control-flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* @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) =>
Promise.all([
queryInterface.bulkInsert('quality_control_flag_types', [
{
id: 2,
name: 'UnknownQuality',
method: 'Unknown Quality',
bad: true,
created_by_id: 1,
},
{
id: 3,
name: 'CertifiedByExpert',
method: 'Certified by Expert',
bad: false,
created_by_id: 1,
},
{
id: 11,
name: 'LimitedAcceptance',
method: 'Limited acceptance',
bad: true,
color: '#FFFF00',
created_by_id: 1,
},
{
id: 12,
name: 'BadPID',
method: 'Bad PID',
bad: true,
created_by_id: 1,
},
{
id: 13,
name: 'Bad',
method: 'Bad',
bad: true,
created_by_id: 1,
},

], { transaction }),
])),

down: async (queryInterface) =>
queryInterface.sequelize.transaction((transaction) =>
Promise.all([queryInterface.bulkDelete('quality_control_flag_types', null, { transaction })])),
};