Skip to content

Commit

Permalink
Merge pull request #474 from sanger/add-rvi-prefix
Browse files Browse the repository at this point in the history
DPL-1097 Add RVI prefix to Baracoda
  • Loading branch information
dasunpubudumal authored Feb 19, 2024
2 parents 36441a3 + f310e49 commit 1bada8a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
6 changes: 6 additions & 0 deletions baracoda/config/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@
"formatter_class": GenericBarcodeFormatter,
"enableChildrenCreation": False,
},
{
"prefix": "RVI",
"sequence_name": "rvi",
"formatter_class": GenericBarcodeFormatter,
"enableChildrenCreation": False,
},
]

for prefix_item in PREFIXES:
Expand Down
4 changes: 4 additions & 0 deletions baracoda/sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ DROP SEQUENCE IF EXISTS pam;
CREATE SEQUENCE pam
START 111111;

DROP SEQUENCE IF EXISTS rvi;
CREATE SEQUENCE rvi
START 111111;

DROP TABLE IF EXISTS barcodes;
CREATE TABLE barcodes
(
Expand Down
23 changes: 23 additions & 0 deletions migrations/versions/4f525be49d95_add_rvi_sequence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Add rvi sequence
Revision ID: 4f525be49d95
Revises: db39b037a71d
Create Date: 2024-02-16 10:08:39.833576
"""

from alembic import op

# revision identifiers, used by Alembic.
revision = "4f525be49d95"
down_revision = "db39b037a71d"
branch_labels = None
depends_on = None


def upgrade():
op.execute("CREATE SEQUENCE rvi START 111111;")


def downgrade():
op.execute("DROP SEQUENCE IF EXISTS rvi;")
6 changes: 6 additions & 0 deletions tests/data/fixture_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@
"formatter_class": Sequencescape22Formatter,
"enableChildrenCreation": True,
},
{
"prefix": "RVI",
"sequence_name": "rvi",
"formatter_class": GenericBarcodeFormatter,
"enableChildrenCreation": False,
},
]
6 changes: 6 additions & 0 deletions tests/test_barcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def test_get_new_barcode_for_sqp(client):
assert response.status_code == HTTPStatus.CREATED


def test_get_new_barcode_for_rvi(client):
response = client.post("/barcodes/RVI/new", headers={"Content-Type": "application/json"})
assert response.json == {"barcode": "RVI-111111"}
assert response.status_code == HTTPStatus.CREATED


def test_get_new_barcode_with_text(client):
response = client.post("/barcodes/SQPD/new?text=T12", headers={"Content-Type": "application/json"})
assert response.json == {"barcode": "SQPD-T12-1-J"}
Expand Down

0 comments on commit 1bada8a

Please sign in to comment.