Skip to content

Commit

Permalink
Merge branch 'master' into sprint-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Rumsby committed Dec 14, 2018
2 parents 38d1a25 + 3439417 commit 4c05537
Show file tree
Hide file tree
Showing 14 changed files with 2,124 additions and 50 deletions.
10 changes: 5 additions & 5 deletions api/app/models/bookings/exam.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class Exam(Base):
exam_id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False)
booking_id = db.Column(db.Integer, db.ForeignKey("booking.booking_id", ondelete="set null"), nullable=True)
exam_type_id = db.Column(db.Integer, db.ForeignKey("examtype.exam_type_id"), nullable=False)
invigilator_id = db.Column(db.Integer, db.ForeignKey("invigilator.invigilator_id"), nullable=False)
invigilator_id = db.Column(db.Integer, db.ForeignKey("invigilator.invigilator_id"), nullable=True)
office_id = db.Column(db.Integer, db.ForeignKey("office.office_id"), nullable=False)
room_id = db.Column(db.Integer, db.ForeignKey("room.room_id"), nullable=False)
event_id = db.Column(db.String(25), nullable=False)
exam_name = db.Column(db.String(50), nullable=False)
examinee_name = db.Column(db.String(50), nullable=False)
examinee_name = db.Column(db.String(50), nullable=True)
expiry_date = db.Column(db.DateTime, nullable=False)
notes = db.Column(db.String(400), nullable=True)
exam_received = db.Column(db.Integer, nullable=False)
session_number = db.Column(db.Integer, nullable=False)
number_of_students = db.Column(db.Integer, nullable=False)
exam_received_date = db.Column(db.DateTime, nullable=True)
session_number = db.Column(db.Integer, nullable=True)
number_of_students = db.Column(db.Integer, nullable=True)
exam_method = db.Column(db.String(15), nullable=False)
deleted_date = db.Column(db.String(50), nullable=True)

Expand Down
3 changes: 2 additions & 1 deletion api/app/schemas/bookings/exam_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class Meta:
exam_id = fields.Int(dump_only=True)
exam_method = fields.Str()
exam_name = fields.Str()
exam_received = fields.Int()
exam_received_date = fields.DateTime()
exam_type_id = fields.Int()
examinee_name = fields.Str()
expiry_date = fields.DateTime()
invigilator_id = fields.Int()
notes = fields.Str()
number_of_students = fields.Int()
office_id = fields.Int()
room_id = fields.Int()
session_number = fields.Int()

booking = fields.Nested(BookingSchema())
Expand Down
8 changes: 4 additions & 4 deletions api/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,13 @@ def run(self):
booking_id = booking_one.booking_id,
invigilator_id = invigilator_one.invigilator_id,
office_id = office_test.office_id,
room_id = room_one.room_id,
event_id = "1234abcd",
exam_name = "Carpentry Red Seal",
examinee_name = "Chandler Bing",
expiry_date = "2018-11-29 11:19:53.5",
notes = "This student is extremely s-m-r-t",
exam_received = 1,
exam_received_date= "2018-12-25 (9:00:00.000",
session_number = 1,
number_of_students = 1,
exam_method = "Written"
Expand All @@ -558,13 +558,13 @@ def run(self):
booking_id = booking_two.booking_id,
invigilator_id = invigilator_two.invigilator_id,
office_id = office_test.office_id,
room_id = room_two.room_id,
event_id = "e-000001",
exam_name = "Plumbing Red Seal",
examinee_name = "Joey Fatone",
expiry_date = "2018-11-29 11:19:53.5",
notes = "Speak slowly with this student, hearing impaired",
exam_received = 0,
exam_received = 1,
exam_received_date="2018-12-24 (9:00:00.000",
session_number = 2,
number_of_students = 12,
exam_method = "Written"
Expand All @@ -575,13 +575,13 @@ def run(self):
booking_id=booking_three.booking_id,
invigilator_id=invigilator_three.invigilator_id,
office_id=office_test.office_id,
room_id=room_two.room_id,
event_id="e-000002",
exam_name="Culinary Red Seal",
examinee_name="Anthony Bourdain",
expiry_date="2018-11-29 11:19:53.5",
notes="Student is extremely verbally obscene",
exam_received=1,
exam_received_date="2018-12-23 (9:00:00.000",
session_number=3,
number_of_students=10,
exam_method="Kitchen"
Expand Down
54 changes: 54 additions & 0 deletions api/migrations/versions/2fc4029b8645_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""empty message
Revision ID: 2fc4029b8645
Revises: 302354e5ba09
Create Date: 2018-12-14 09:40:16.195268
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '2fc4029b8645'
down_revision = '302354e5ba09'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('exam', 'examinee_name',
existing_type=mysql.VARCHAR(length=50),
nullable=True)
op.alter_column('exam', 'invigilator_id',
existing_type=mysql.INTEGER(display_width=11),
nullable=True)
op.alter_column('exam', 'number_of_students',
existing_type=mysql.INTEGER(display_width=11),
nullable=True)
op.alter_column('exam', 'session_number',
existing_type=mysql.INTEGER(display_width=11),
nullable=True)
op.drop_constraint('exam_ibfk_5', 'exam', type_='foreignkey')
op.drop_column('exam', 'room_id')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('exam', sa.Column('room_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
op.create_foreign_key('exam_ibfk_5', 'exam', 'room', ['room_id'], ['room_id'])
op.alter_column('exam', 'session_number',
existing_type=mysql.INTEGER(display_width=11),
nullable=False)
op.alter_column('exam', 'number_of_students',
existing_type=mysql.INTEGER(display_width=11),
nullable=False)
op.alter_column('exam', 'invigilator_id',
existing_type=mysql.INTEGER(display_width=11),
nullable=False)
op.alter_column('exam', 'examinee_name',
existing_type=mysql.VARCHAR(length=50),
nullable=False)
# ### end Alembic commands ###
32 changes: 32 additions & 0 deletions api/migrations/versions/302354e5ba09_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""empty message
Revision ID: 302354e5ba09
Revises: cb19e34e3060
Create Date: 2018-12-11 10:18:51.743684
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '302354e5ba09'
down_revision = 'cb19e34e3060'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('exam', sa.Column('exam_received_date', sa.DateTime(), nullable=True))
op.drop_constraint('exam_ibfk_1', 'exam', type_='foreignkey')
op.create_foreign_key(None, 'exam', 'booking', ['booking_id'], ['booking_id'], ondelete='set null')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'exam', type_='foreignkey')
op.create_foreign_key('exam_ibfk_1', 'exam', 'booking', ['booking_id'], ['booking_id'])
op.drop_column('exam', 'exam_received_date')
# ### end Alembic commands ###
8 changes: 8 additions & 0 deletions api/postman/bookings-env-postman.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "c35aa2f8-b9f5-40c2-8ff0-0dd00ecbbca6",
"name": "bookings-end-point-testing-dev",
"values": [],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2018-12-11T19:36:35.882Z",
"_postman_exported_using": "Postman/6.6.0"
}
Loading

0 comments on commit 4c05537

Please sign in to comment.