Feature: Case Source to filter the cases using a select.
Fix: Import cases was flipping court status and office status
This commit is contained in:
parent
0ac788dffd
commit
57874daf52
DB
luthor
alembic/versions
luthor
otis/src/app
@ -25,7 +25,7 @@ sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/k-offices.csv
|
||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy offices(old_id, old_department_id, name, address, email) from /mnt/k-offices.csv"'
|
||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy role_permissions(old_user_id, old_permission_id) from /mnt/l-user-roles.csv"'
|
||||
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/m-cases.csv
|
||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy cases(old_id, office_file_number, court_case_number, year, title, docket_number, receipt_date, limitation_date, filing_date, appear_on_behalf_of, question_of_law, aor_name, opposing_council_aor, lower_court_case_number, date_of_impugned_judgement, brief_description, remarks, slp_counter, contact_detail, case_connected_with, old_court_id, old_department_id, old_office_id, old_case_type_id, old_act_id, old_nature_id, old_office_status_id, old_court_status_id, opposing_council_detail, bunch_cases) from /mnt/m-cases.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy cases(old_id, office_file_number, court_case_number, year, title, docket_number, receipt_date, limitation_date, filing_date, appear_on_behalf_of, question_of_law, aor_name, opposing_council_aor, lower_court_case_number, date_of_impugned_judgement, brief_description, remarks, slp_counter, contact_detail, case_connected_with, old_court_id, old_department_id, old_office_id, old_case_type_id, old_act_id, old_nature_id, old_court_status_id, old_office_status_id, opposing_council_detail, bunch_cases) from /mnt/m-cases.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
||||
#docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy contacts(old_id, old_office_id, old_department_id, brief, next_hearing_date, court_status_id, court_number, item_number) from /mnt/n-contact-persons.csv"'
|
||||
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/o-hearings.csv
|
||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy hearings(old_id, old_case_id, judges, brief, next_hearing_date, old_court_status_id, court_number, item_number) from /mnt/o-hearings.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
||||
|
@ -5,12 +5,16 @@ Revises:
|
||||
Create Date: 2020-12-29 18:58:42.976796
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '74058d75b7a0'
|
||||
from sqlalchemy.sql import expression
|
||||
|
||||
|
||||
revision = "74058d75b7a0"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@ -18,232 +22,276 @@ depends_on = None
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('acts',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_acts')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_acts_name'))
|
||||
op.create_table(
|
||||
"acts",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_acts")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_acts_name")),
|
||||
)
|
||||
op.create_table('advocates',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('mobile', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('landline', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('address', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('email', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_advocates')),
|
||||
op.create_table(
|
||||
"advocates",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("mobile", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("landline", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("address", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("email", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_advocates")),
|
||||
)
|
||||
op.create_table('case_types',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_case_types')),
|
||||
op.create_table(
|
||||
"case_sources",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("prefix", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_case_sources")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_case_sources_name")),
|
||||
sa.UniqueConstraint("prefix", name=op.f("uq_case_sources_prefix")),
|
||||
)
|
||||
op.create_table('court_statuses',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_court_statuses')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_court_statuses_name'))
|
||||
op.create_table(
|
||||
"case_types",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_case_types")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_case_types_name")),
|
||||
)
|
||||
op.create_table('courts',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_courts')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_courts_name'))
|
||||
op.create_table(
|
||||
"court_statuses",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_court_statuses")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_court_statuses_name")),
|
||||
)
|
||||
op.create_table('departments',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_departments')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_departments_name'))
|
||||
op.create_table(
|
||||
"courts",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_courts")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_courts_name")),
|
||||
)
|
||||
op.create_table('natures',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_natures')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_natures_name'))
|
||||
op.create_table(
|
||||
"departments",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_departments")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_departments_name")),
|
||||
)
|
||||
op.create_table('office_statuses',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_office_statuses')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_office_statuses_name'))
|
||||
op.create_table(
|
||||
"natures",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_natures")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_natures_name")),
|
||||
)
|
||||
op.create_table('permissions',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_permissions')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_permissions_name'))
|
||||
op.create_table(
|
||||
"office_statuses",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_office_statuses")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_office_statuses_name")),
|
||||
)
|
||||
op.create_table('roles',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_roles')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_roles_name'))
|
||||
op.create_table(
|
||||
"permissions",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_permissions")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_permissions_name")),
|
||||
)
|
||||
op.create_table('users',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('password', sa.Unicode(length=60), nullable=False),
|
||||
sa.Column('locked_out', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_users')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_users_name'))
|
||||
op.create_table(
|
||||
"roles",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_roles")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_roles_name")),
|
||||
)
|
||||
op.create_table('offices',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('department_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_department_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('address', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('email', sa.Unicode(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['department_id'], ['departments.id'], name=op.f('fk_offices_department_id_departments')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_offices'))
|
||||
op.create_table(
|
||||
"users",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("password", sa.Unicode(length=60), nullable=False),
|
||||
sa.Column("locked_out", sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_users")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_users_name")),
|
||||
)
|
||||
op.create_table('role_permissions',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('permission_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_permission_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['permission_id'], ['permissions.id'], name=op.f('fk_role_permissions_permission_id_permissions')),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], name=op.f('fk_role_permissions_role_id_roles')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_role_permissions')),
|
||||
sa.UniqueConstraint('permission_id', 'role_id', name=op.f('uq_role_permissions_permission_id'))
|
||||
op.create_table(
|
||||
"offices",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("department_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_department_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("address", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("email", sa.Unicode(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["department_id"], ["departments.id"], name=op.f("fk_offices_department_id_departments")
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_offices")),
|
||||
)
|
||||
op.create_table('user_roles',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('role_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], name=op.f('fk_user_roles_role_id_roles')),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_user_roles_user_id_users')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_user_roles')),
|
||||
sa.UniqueConstraint('user_id', 'role_id', name=op.f('uq_user_roles_user_id'))
|
||||
op.create_table(
|
||||
"role_permissions",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("role_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_user_id", sa.Integer(), nullable=False),
|
||||
sa.Column("permission_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_permission_id", sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["permission_id"], ["permissions.id"], name=op.f("fk_role_permissions_permission_id_permissions")
|
||||
),
|
||||
sa.ForeignKeyConstraint(["role_id"], ["roles.id"], name=op.f("fk_role_permissions_role_id_roles")),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_role_permissions")),
|
||||
sa.UniqueConstraint("permission_id", "role_id", name=op.f("uq_role_permissions_permission_id")),
|
||||
)
|
||||
op.create_table('cases',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('office_file_number', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('court_case_number', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('year', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('title', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('docket_number', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('receipt_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('limitation_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('filing_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('appear_on_behalf_of', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('question_of_law', sa.Unicode(length=4000), nullable=True),
|
||||
sa.Column('aor_name', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('opposing_council_aor', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('opposing_council_detail', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('lower_court_case_number', sa.Unicode(length=2000), nullable=True),
|
||||
sa.Column('date_of_impugned_judgement', sa.DateTime(), nullable=True),
|
||||
sa.Column('brief_description', sa.Unicode(length=10000), nullable=True),
|
||||
sa.Column('remarks', sa.Unicode(length=10000), nullable=True),
|
||||
sa.Column('slp_counter', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('contact_detail', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('case_connected_with', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('bunch_cases', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('court_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_court_id', sa.Integer(), nullable=True),
|
||||
sa.Column('department_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_department_id', sa.Integer(), nullable=True),
|
||||
sa.Column('office_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_office_id', sa.Integer(), nullable=True),
|
||||
sa.Column('case_type_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_case_type_id', sa.Integer(), nullable=True),
|
||||
sa.Column('act_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_act_id', sa.Integer(), nullable=True),
|
||||
sa.Column('nature_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_nature_id', sa.Integer(), nullable=True),
|
||||
sa.Column('office_status_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_office_status_id', sa.Integer(), nullable=True),
|
||||
sa.Column('court_status_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_court_status_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['act_id'], ['acts.id'], name=op.f('fk_cases_act_id_acts')),
|
||||
sa.ForeignKeyConstraint(['case_type_id'], ['case_types.id'], name=op.f('fk_cases_case_type_id_case_types')),
|
||||
sa.ForeignKeyConstraint(['court_id'], ['courts.id'], name=op.f('fk_cases_court_id_courts')),
|
||||
sa.ForeignKeyConstraint(['court_status_id'], ['court_statuses.id'], name=op.f('fk_cases_court_status_id_court_statuses')),
|
||||
sa.ForeignKeyConstraint(['department_id'], ['departments.id'], name=op.f('fk_cases_department_id_departments')),
|
||||
sa.ForeignKeyConstraint(['nature_id'], ['natures.id'], name=op.f('fk_cases_nature_id_natures')),
|
||||
sa.ForeignKeyConstraint(['office_id'], ['offices.id'], name=op.f('fk_cases_office_id_offices')),
|
||||
sa.ForeignKeyConstraint(['office_status_id'], ['office_statuses.id'], name=op.f('fk_cases_office_status_id_office_statuses')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_cases')),
|
||||
# sa.UniqueConstraint('office_file_number', name=op.f('uq_cases_office_file_number')),
|
||||
op.create_table(
|
||||
"user_roles",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("role_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(["role_id"], ["roles.id"], name=op.f("fk_user_roles_role_id_roles")),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_user_roles_user_id_users")),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_user_roles")),
|
||||
sa.UniqueConstraint("user_id", "role_id", name=op.f("uq_user_roles_user_id")),
|
||||
)
|
||||
op.create_index(op.f('ix_cases_date_of_impugned_judgement'), 'cases', ['date_of_impugned_judgement'], unique=False)
|
||||
op.create_index(op.f('ix_cases_filing_date'), 'cases', ['filing_date'], unique=False)
|
||||
op.create_index(op.f('ix_cases_limitation_date'), 'cases', ['limitation_date'], unique=False)
|
||||
op.create_index(op.f('ix_cases_receipt_date'), 'cases', ['receipt_date'], unique=False)
|
||||
op.create_table('contacts',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('office_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('department_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('mobile', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('landline', sa.Unicode(length=255), nullable=False),
|
||||
sa.Column('address', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('email', sa.Unicode(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['department_id'], ['departments.id'], name=op.f('fk_contacts_department_id_departments')),
|
||||
sa.ForeignKeyConstraint(['office_id'], ['offices.id'], name=op.f('fk_contacts_office_id_offices')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_contacts')),
|
||||
sa.UniqueConstraint('landline', name=op.f('uq_contacts_landline')),
|
||||
sa.UniqueConstraint('mobile', name=op.f('uq_contacts_mobile'))
|
||||
op.create_table(
|
||||
"cases",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("office_file_number", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("court_case_number", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("year", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("title", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("docket_number", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("receipt_date", sa.DateTime(), nullable=True),
|
||||
sa.Column("limitation_date", sa.DateTime(), nullable=True),
|
||||
sa.Column("filing_date", sa.DateTime(), nullable=True),
|
||||
sa.Column("appear_on_behalf_of", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("question_of_law", sa.Unicode(length=4000), nullable=True),
|
||||
sa.Column("aor_name", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("opposing_council_aor", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("opposing_council_detail", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("lower_court_case_number", sa.Unicode(length=2000), nullable=True),
|
||||
sa.Column("date_of_impugned_judgement", sa.DateTime(), nullable=True),
|
||||
sa.Column("brief_description", sa.Unicode(length=10000), nullable=True),
|
||||
sa.Column("remarks", sa.Unicode(length=10000), nullable=True),
|
||||
sa.Column("slp_counter", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("contact_detail", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("case_connected_with", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("bunch_cases", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("is_deleted", sa.Boolean(), nullable=False, server_default=expression.false()),
|
||||
sa.Column("court_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_court_id", sa.Integer(), nullable=True),
|
||||
sa.Column("department_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_department_id", sa.Integer(), nullable=True),
|
||||
sa.Column("office_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_office_id", sa.Integer(), nullable=True),
|
||||
sa.Column("case_type_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_case_type_id", sa.Integer(), nullable=True),
|
||||
sa.Column("act_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_act_id", sa.Integer(), nullable=True),
|
||||
sa.Column("nature_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_nature_id", sa.Integer(), nullable=True),
|
||||
sa.Column("office_status_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_office_status_id", sa.Integer(), nullable=True),
|
||||
sa.Column("court_status_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_court_status_id", sa.Integer(), nullable=True),
|
||||
sa.Column("case_source_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(["act_id"], ["acts.id"], name=op.f("fk_cases_act_id_acts")),
|
||||
sa.ForeignKeyConstraint(["case_type_id"], ["case_types.id"], name=op.f("fk_cases_case_type_id_case_types")),
|
||||
sa.ForeignKeyConstraint(["court_id"], ["courts.id"], name=op.f("fk_cases_court_id_courts")),
|
||||
sa.ForeignKeyConstraint(
|
||||
["court_status_id"], ["court_statuses.id"], name=op.f("fk_cases_court_status_id_court_statuses")
|
||||
),
|
||||
sa.ForeignKeyConstraint(["department_id"], ["departments.id"], name=op.f("fk_cases_department_id_departments")),
|
||||
sa.ForeignKeyConstraint(["nature_id"], ["natures.id"], name=op.f("fk_cases_nature_id_natures")),
|
||||
sa.ForeignKeyConstraint(["office_id"], ["offices.id"], name=op.f("fk_cases_office_id_offices")),
|
||||
sa.ForeignKeyConstraint(
|
||||
["office_status_id"], ["office_statuses.id"], name=op.f("fk_cases_office_status_id_office_statuses")
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["case_source_id"], ["case_sources.id"], name=op.f("fk_cases_case_source_id_case_sources")
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_cases")),
|
||||
sa.UniqueConstraint("office_file_number", name=op.f("uq_cases_office_file_number")),
|
||||
)
|
||||
op.create_table('hearings',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
|
||||
sa.Column('old_id', sa.Integer(), nullable=False),
|
||||
sa.Column('case_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_case_id', sa.Integer(), nullable=False),
|
||||
sa.Column('judges', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('brief', sa.Unicode(length=2000), nullable=True),
|
||||
sa.Column('next_hearing_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('court_status_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('old_court_status_id', sa.Integer(), nullable=True),
|
||||
sa.Column('court_number', sa.Unicode(length=255), nullable=True),
|
||||
sa.Column('item_number', sa.Unicode(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['case_id'], ['cases.id'], name=op.f('fk_hearings_case_id_cases')),
|
||||
sa.ForeignKeyConstraint(['court_status_id'], ['court_statuses.id'], name=op.f('fk_hearings_court_status_id_court_statuses')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_hearings')),
|
||||
op.create_index(op.f("ix_cases_date_of_impugned_judgement"), "cases", ["date_of_impugned_judgement"], unique=False)
|
||||
op.create_index(op.f("ix_cases_filing_date"), "cases", ["filing_date"], unique=False)
|
||||
op.create_index(op.f("ix_cases_limitation_date"), "cases", ["limitation_date"], unique=False)
|
||||
op.create_index(op.f("ix_cases_receipt_date"), "cases", ["receipt_date"], unique=False)
|
||||
op.create_table(
|
||||
"contacts",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("office_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("department_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("mobile", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("landline", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("address", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("email", sa.Unicode(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["department_id"], ["departments.id"], name=op.f("fk_contacts_department_id_departments")
|
||||
),
|
||||
sa.ForeignKeyConstraint(["office_id"], ["offices.id"], name=op.f("fk_contacts_office_id_offices")),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_contacts")),
|
||||
sa.UniqueConstraint("landline", name=op.f("uq_contacts_landline")),
|
||||
sa.UniqueConstraint("mobile", name=op.f("uq_contacts_mobile")),
|
||||
)
|
||||
op.create_index(op.f('ix_hearings_case_id'), 'hearings', ['case_id'], unique=False)
|
||||
op.create_index(op.f('ix_hearings_next_hearing_date'), 'hearings', ['next_hearing_date'], unique=False)
|
||||
op.create_table(
|
||||
"hearings",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||
sa.Column("case_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_case_id", sa.Integer(), nullable=False),
|
||||
sa.Column("judges", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("brief", sa.Unicode(length=2000), nullable=True),
|
||||
sa.Column("next_hearing_date", sa.DateTime(), nullable=True),
|
||||
sa.Column("court_status_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_court_status_id", sa.Integer(), nullable=True),
|
||||
sa.Column("court_number", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("item_number", sa.Unicode(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(["case_id"], ["cases.id"], name=op.f("fk_hearings_case_id_cases")),
|
||||
sa.ForeignKeyConstraint(
|
||||
["court_status_id"], ["court_statuses.id"], name=op.f("fk_hearings_court_status_id_court_statuses")
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_hearings")),
|
||||
)
|
||||
op.create_index(op.f("ix_hearings_case_id"), "hearings", ["case_id"], unique=False)
|
||||
op.create_index(op.f("ix_hearings_next_hearing_date"), "hearings", ["next_hearing_date"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_hearings_next_hearing_date'), table_name='hearings')
|
||||
op.drop_index(op.f('ix_hearings_case_id'), table_name='hearings')
|
||||
op.drop_table('hearings')
|
||||
op.drop_table('contacts')
|
||||
op.drop_index(op.f('ix_cases_receipt_date'), table_name='cases')
|
||||
op.drop_index(op.f('ix_cases_limitation_date'), table_name='cases')
|
||||
op.drop_index(op.f('ix_cases_filing_date'), table_name='cases')
|
||||
op.drop_index(op.f('ix_cases_date_of_impugned_judgement'), table_name='cases')
|
||||
op.drop_table('cases')
|
||||
op.drop_table('user_roles')
|
||||
op.drop_table('role_permissions')
|
||||
op.drop_table('offices')
|
||||
op.drop_table('users')
|
||||
op.drop_table('roles')
|
||||
op.drop_table('permissions')
|
||||
op.drop_table('office_statuses')
|
||||
op.drop_table('natures')
|
||||
op.drop_table('departments')
|
||||
op.drop_table('courts')
|
||||
op.drop_table('court_statuses')
|
||||
op.drop_table('case_types')
|
||||
op.drop_table('advocates')
|
||||
op.drop_table('acts')
|
||||
op.drop_index(op.f("ix_hearings_next_hearing_date"), table_name="hearings")
|
||||
op.drop_index(op.f("ix_hearings_case_id"), table_name="hearings")
|
||||
op.drop_table("hearings")
|
||||
op.drop_table("contacts")
|
||||
op.drop_index(op.f("ix_cases_receipt_date"), table_name="cases")
|
||||
op.drop_index(op.f("ix_cases_limitation_date"), table_name="cases")
|
||||
op.drop_index(op.f("ix_cases_filing_date"), table_name="cases")
|
||||
op.drop_index(op.f("ix_cases_date_of_impugned_judgement"), table_name="cases")
|
||||
op.drop_table("cases")
|
||||
op.drop_table("user_roles")
|
||||
op.drop_table("role_permissions")
|
||||
op.drop_table("offices")
|
||||
op.drop_table("users")
|
||||
op.drop_table("roles")
|
||||
op.drop_table("permissions")
|
||||
op.drop_table("office_statuses")
|
||||
op.drop_table("natures")
|
||||
op.drop_table("departments")
|
||||
op.drop_table("courts")
|
||||
op.drop_table("court_statuses")
|
||||
op.drop_table("case_types")
|
||||
op.drop_table("advocates")
|
||||
op.drop_table("acts")
|
||||
# ### end Alembic commands ###
|
||||
|
@ -5,14 +5,16 @@ Revises: 74058d75b7a0
|
||||
Create Date: 2020-12-31 08:49:38.153235
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import table, column, select
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import column, select, table
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '87a06eaadd34'
|
||||
down_revision = '74058d75b7a0'
|
||||
revision = "87a06eaadd34"
|
||||
down_revision = "74058d75b7a0"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
@ -23,18 +25,8 @@ def update_acts():
|
||||
column("act_id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_act_id", sa.Integer()),
|
||||
)
|
||||
acts = table(
|
||||
"acts", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer())
|
||||
)
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"act_id": select([acts.c.id]).where(
|
||||
cases.c.old_act_id == acts.c.old_id
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
acts = table("acts", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()))
|
||||
op.execute(cases.update(values={"act_id": select([acts.c.id]).where(cases.c.old_act_id == acts.c.old_id)}))
|
||||
op.drop_column("cases", "old_act_id")
|
||||
op.drop_column("acts", "old_id")
|
||||
|
||||
@ -51,19 +43,16 @@ def update_case_types():
|
||||
)
|
||||
case_types = table(
|
||||
"case_types",
|
||||
column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()),
|
||||
column('name', sa.Unicode(length=255)),
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_id", sa.Integer()),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
)
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"case_type_id": select([case_types.c.id]).where(
|
||||
cases.c.old_case_type_id == case_types.c.old_id
|
||||
)
|
||||
}
|
||||
values={"case_type_id": select([case_types.c.id]).where(cases.c.old_case_type_id == case_types.c.old_id)}
|
||||
)
|
||||
)
|
||||
op.execute(case_types.update(values={"name": "Blank"}).where(case_types.c.name == ""))
|
||||
# op.execute(case_types.update(values={"name": "Blank"}).where(case_types.c.name == ""))
|
||||
op.drop_column("cases", "old_case_type_id")
|
||||
op.drop_column("case_types", "old_id")
|
||||
# op.alter_column('cases', 'case_type_id', existing_type=postgresql.UUID(), nullable=False)
|
||||
@ -82,8 +71,9 @@ def update_court_statuses():
|
||||
)
|
||||
court_statuses = table(
|
||||
"court_statuses",
|
||||
column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()),
|
||||
column('name', sa.Unicode(length=255)),
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_id", sa.Integer()),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
)
|
||||
op.execute(
|
||||
cases.update(
|
||||
@ -103,7 +93,7 @@ def update_court_statuses():
|
||||
}
|
||||
)
|
||||
)
|
||||
op.execute(court_statuses.update(values={"name": "Blank"}).where(court_statuses.c.name == ""))
|
||||
# op.execute(court_statuses.update(values={"name": "Blank"}).where(court_statuses.c.name == ""))
|
||||
op.drop_column("cases", "old_court_status_id")
|
||||
op.drop_column("hearings", "old_court_status_id")
|
||||
op.drop_column("court_statuses", "old_id")
|
||||
@ -117,18 +107,8 @@ def update_courts():
|
||||
column("court_id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_court_id", sa.Integer()),
|
||||
)
|
||||
courts = table(
|
||||
"courts", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer())
|
||||
)
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"court_id": select([courts.c.id]).where(
|
||||
cases.c.old_court_id == courts.c.old_id
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
courts = table("courts", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()))
|
||||
op.execute(cases.update(values={"court_id": select([courts.c.id]).where(cases.c.old_court_id == courts.c.old_id)}))
|
||||
op.drop_column("cases", "old_court_id")
|
||||
op.drop_column("courts", "old_id")
|
||||
# op.alter_column('cases', 'court_id', existing_type=postgresql.UUID(), nullable=False)
|
||||
@ -147,28 +127,25 @@ def update_departments():
|
||||
)
|
||||
departments = table(
|
||||
"departments",
|
||||
column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()),
|
||||
column('name', sa.Unicode(length=255)),
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_id", sa.Integer()),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
)
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"department_id": select([departments.c.id]).where(
|
||||
cases.c.old_department_id == departments.c.old_id
|
||||
)
|
||||
"department_id": select([departments.c.id]).where(cases.c.old_department_id == departments.c.old_id)
|
||||
}
|
||||
)
|
||||
)
|
||||
op.execute(
|
||||
offices.update(
|
||||
values={
|
||||
"department_id": select([departments.c.id]).where(
|
||||
offices.c.old_department_id == departments.c.old_id
|
||||
)
|
||||
"department_id": select([departments.c.id]).where(offices.c.old_department_id == departments.c.old_id)
|
||||
}
|
||||
)
|
||||
)
|
||||
op.execute(departments.update(values={"name": "Blank"}).where(departments.c.name == ""))
|
||||
# op.execute(departments.update(values={"name": "Blank"}).where(departments.c.name == ""))
|
||||
op.drop_column("cases", "old_department_id")
|
||||
op.drop_column("offices", "old_department_id")
|
||||
op.drop_column("departments", "old_id")
|
||||
@ -180,17 +157,9 @@ def update_natures():
|
||||
column("nature_id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_nature_id", sa.Integer()),
|
||||
)
|
||||
natures = table(
|
||||
"natures", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer())
|
||||
)
|
||||
natures = table("natures", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()))
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"nature_id": select([natures.c.id]).where(
|
||||
cases.c.old_nature_id == natures.c.old_id
|
||||
)
|
||||
}
|
||||
)
|
||||
cases.update(values={"nature_id": select([natures.c.id]).where(cases.c.old_nature_id == natures.c.old_id)})
|
||||
)
|
||||
op.drop_column("cases", "old_nature_id")
|
||||
op.drop_column("natures", "old_id")
|
||||
@ -224,17 +193,9 @@ def update_offices():
|
||||
column("office_id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_office_id", sa.Integer()),
|
||||
)
|
||||
offices = table(
|
||||
"offices", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer())
|
||||
)
|
||||
offices = table("offices", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()))
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"office_id": select([offices.c.id]).where(
|
||||
cases.c.old_office_id == offices.c.old_id
|
||||
)
|
||||
}
|
||||
)
|
||||
cases.update(values={"office_id": select([offices.c.id]).where(cases.c.old_office_id == offices.c.old_id)})
|
||||
)
|
||||
op.drop_column("cases", "old_office_id")
|
||||
op.drop_column("offices", "old_id")
|
||||
@ -246,17 +207,9 @@ def update_cases():
|
||||
column("case_id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_case_id", sa.Integer()),
|
||||
)
|
||||
cases = table(
|
||||
"cases", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer())
|
||||
)
|
||||
cases = table("cases", column("id", postgresql.UUID(as_uuid=True)), column("old_id", sa.Integer()))
|
||||
op.execute(
|
||||
hearings.update(
|
||||
values={
|
||||
"case_id": select([cases.c.id]).where(
|
||||
hearings.c.old_case_id == cases.c.old_id
|
||||
)
|
||||
}
|
||||
)
|
||||
hearings.update(values={"case_id": select([cases.c.id]).where(hearings.c.old_case_id == cases.c.old_id)})
|
||||
)
|
||||
op.drop_column("hearings", "old_case_id")
|
||||
op.drop_column("cases", "old_id")
|
||||
@ -267,26 +220,25 @@ def update_auth():
|
||||
"users",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_id", sa.Integer()),
|
||||
column('name', sa.Unicode(length=255)),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
)
|
||||
roles = table(
|
||||
"roles",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_id", sa.Integer()),
|
||||
column('name', sa.Unicode(length=255)),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
)
|
||||
permissions = table(
|
||||
"permissions",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_id", sa.Integer()),
|
||||
column('name', sa.Unicode(length=255)),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
)
|
||||
ur = table(
|
||||
"user_roles",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("user_id", postgresql.UUID(as_uuid=True)),
|
||||
column("role_id", postgresql.UUID(as_uuid=True)),
|
||||
|
||||
)
|
||||
rp = table(
|
||||
"role_permissions",
|
||||
@ -295,32 +247,19 @@ def update_auth():
|
||||
column("old_user_id", sa.Integer()),
|
||||
column("permission_id", postgresql.UUID(as_uuid=True)),
|
||||
column("old_permission_id", sa.Integer()),
|
||||
|
||||
)
|
||||
|
||||
op.execute(roles.insert().from_select([roles.c.old_id, roles.c.name], select([users.c.old_id, users.c.name])))
|
||||
op.execute(
|
||||
ur.insert().from_select(
|
||||
[ur.c.user_id, ur.c.role_id],
|
||||
select([users.c.id, roles.c.id]).select_from(users.join(roles, users.c.old_id == roles.c.old_id))
|
||||
select([users.c.id, roles.c.id]).select_from(users.join(roles, users.c.old_id == roles.c.old_id)),
|
||||
)
|
||||
)
|
||||
op.execute(rp.update(values={"role_id": select([roles.c.id]).where(rp.c.old_user_id == roles.c.old_id)}))
|
||||
op.execute(
|
||||
rp.update(
|
||||
values={
|
||||
"role_id": select([roles.c.id]).where(
|
||||
rp.c.old_user_id == roles.c.old_id
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
op.execute(
|
||||
rp.update(
|
||||
values={
|
||||
"permission_id": select([permissions.c.id]).where(
|
||||
rp.c.old_permission_id == permissions.c.old_id
|
||||
)
|
||||
}
|
||||
values={"permission_id": select([permissions.c.id]).where(rp.c.old_permission_id == permissions.c.old_id)}
|
||||
)
|
||||
)
|
||||
op.drop_column("role_permissions", "old_user_id")
|
||||
@ -328,9 +267,9 @@ def update_auth():
|
||||
op.drop_column("users", "old_id")
|
||||
op.drop_column("roles", "old_id")
|
||||
op.drop_column("permissions", "old_id")
|
||||
op.execute(rp.delete().where(rp.c.permission_id == None))
|
||||
op.alter_column('role_permissions', 'permission_id', existing_type=postgresql.UUID(), nullable=False)
|
||||
op.alter_column('role_permissions', 'role_id', existing_type=postgresql.UUID(), nullable=False)
|
||||
op.execute(rp.delete().where(rp.c.permission_id == None)) # noqa: E711
|
||||
op.alter_column("role_permissions", "permission_id", existing_type=postgresql.UUID(), nullable=False)
|
||||
op.alter_column("role_permissions", "role_id", existing_type=postgresql.UUID(), nullable=False)
|
||||
op.execute(
|
||||
permissions.update()
|
||||
.where(permissions.c.name == op.inline_literal("StatusInCourt"))
|
||||
@ -367,6 +306,39 @@ def update_hearings():
|
||||
op.drop_column("hearings", "old_id")
|
||||
|
||||
|
||||
def add_case_sources():
|
||||
sources = table(
|
||||
"case_sources",
|
||||
column("id", postgresql.UUID(as_uuid=True)),
|
||||
column("name", sa.Unicode(length=255)),
|
||||
column("prefix", sa.Unicode(length=255)),
|
||||
)
|
||||
op.execute(sources.insert().values(name="HLC Cases", prefix="HRC"))
|
||||
op.execute(sources.insert().values(name="HUDA Cases", prefix="AHC"))
|
||||
op.execute(sources.insert().values(name="Private Cases", prefix="APC"))
|
||||
op.execute(sources.insert().values(name="Board & Corp. Cases", prefix="A"))
|
||||
op.execute(sources.insert().values(name="Opinion Cases", prefix="AOC"))
|
||||
op.execute(sources.insert().values(name="Misc", prefix="Misc"))
|
||||
op.execute(sources.insert().values(name="PAC", prefix="PAC"))
|
||||
op.execute(sources.insert().values(name="ABC", prefix="ABC"))
|
||||
|
||||
cases = table(
|
||||
"cases",
|
||||
column("office_file_number", sa.Unicode(length=255)),
|
||||
column("case_source_id", postgresql.UUID(as_uuid=True)),
|
||||
)
|
||||
op.execute(
|
||||
cases.update(
|
||||
values={
|
||||
"case_source_id": select([sources.c.id]).where(
|
||||
cases.c.office_file_number.ilike(sources.c.prefix + "-%")
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
op.alter_column('cases', 'case_source_id', existing_type=postgresql.UUID(), nullable=False)
|
||||
|
||||
|
||||
def upgrade():
|
||||
update_acts()
|
||||
update_advocates()
|
||||
@ -380,7 +352,8 @@ def upgrade():
|
||||
update_cases()
|
||||
update_auth()
|
||||
update_hearings()
|
||||
add_case_sources()
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
pass
|
||||
|
@ -1,145 +0,0 @@
|
||||
"""Fix structure
|
||||
|
||||
Revision ID: bb71cd81fedb
|
||||
Revises: 87a06eaadd34
|
||||
Create Date: 2021-01-02 07:15:08.612253
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'bb71cd81fedb'
|
||||
down_revision = '87a06eaadd34'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('cases', 'aor_name',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'appear_on_behalf_of',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'brief_description',
|
||||
existing_type=sa.VARCHAR(length=10000),
|
||||
type_=sa.Unicode(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'bunch_cases',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'case_connected_with',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'contact_detail',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'court_case_number',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'date_of_impugned_judgement',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'department_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'docket_number',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'filing_date',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'limitation_date',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'lower_court_case_number',
|
||||
existing_type=sa.VARCHAR(length=2000),
|
||||
type_=sa.Unicode(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'nature_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'office_file_number',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'office_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'office_status_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'opposing_council_aor',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'opposing_council_detail',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'question_of_law',
|
||||
existing_type=sa.VARCHAR(length=4000),
|
||||
type_=sa.Unicode(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'receipt_date',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'remarks',
|
||||
existing_type=sa.VARCHAR(length=10000),
|
||||
type_=sa.Unicode(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'slp_counter',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('cases', 'title',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.create_unique_constraint(op.f('uq_cases_aor_name'), 'cases', ['aor_name'])
|
||||
op.create_unique_constraint(op.f('uq_cases_appear_on_behalf_of'), 'cases', ['appear_on_behalf_of'])
|
||||
op.create_unique_constraint(op.f('uq_cases_brief_description'), 'cases', ['brief_description'])
|
||||
op.create_unique_constraint(op.f('uq_cases_case_connected_with'), 'cases', ['case_connected_with'])
|
||||
op.create_unique_constraint(op.f('uq_cases_contact_detail'), 'cases', ['contact_detail'])
|
||||
op.create_unique_constraint(op.f('uq_cases_court_case_number'), 'cases', ['court_case_number'])
|
||||
op.create_unique_constraint(op.f('uq_cases_docket_number'), 'cases', ['docket_number'])
|
||||
op.create_unique_constraint(op.f('uq_cases_lower_court_case_number'), 'cases', ['lower_court_case_number'])
|
||||
op.create_unique_constraint(op.f('uq_cases_office_file_number'), 'cases', ['office_file_number'])
|
||||
op.create_unique_constraint(op.f('uq_cases_opposing_council_aor'), 'cases', ['opposing_council_aor'])
|
||||
op.create_unique_constraint(op.f('uq_cases_question_of_law'), 'cases', ['question_of_law'])
|
||||
op.create_unique_constraint(op.f('uq_cases_remarks'), 'cases', ['remarks'])
|
||||
op.create_unique_constraint(op.f('uq_cases_slp_counter'), 'cases', ['slp_counter'])
|
||||
op.create_unique_constraint(op.f('uq_cases_title'), 'cases', ['title'])
|
||||
op.create_unique_constraint(op.f('uq_cases_year'), 'cases', ['year'])
|
||||
op.alter_column('contact_persons', 'department_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.alter_column('contacts', 'office_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.alter_column('hearings', 'brief',
|
||||
existing_type=sa.VARCHAR(length=2000),
|
||||
type_=sa.Unicode(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('hearings', 'court_number',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('hearings', 'item_number',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('hearings', 'judges',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.alter_column('hearings', 'next_hearing_date',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
op.create_unique_constraint(op.f('uq_hearings_brief'), 'hearings', ['brief'])
|
||||
op.create_unique_constraint(op.f('uq_hearings_court_number'), 'hearings', ['court_number'])
|
||||
op.create_unique_constraint(op.f('uq_hearings_item_number'), 'hearings', ['item_number'])
|
||||
op.create_unique_constraint(op.f('uq_hearings_judges'), 'hearings', ['judges'])
|
||||
op.alter_column('offices', 'department_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
@ -4,6 +4,7 @@ from luthor.db.base_class import Base # noqa
|
||||
from luthor.models.act import Act # noqa
|
||||
from luthor.models.advocate import Advocate # noqa
|
||||
from luthor.models.case import Case # noqa
|
||||
from luthor.models.case_source import CaseSource # noqa
|
||||
from luthor.models.case_type import CaseType # noqa
|
||||
from luthor.models.contact import Contact # noqa
|
||||
from luthor.models.court import Court # noqa
|
||||
|
@ -9,6 +9,8 @@ from .db.session import engine
|
||||
from .routers import (
|
||||
act,
|
||||
advocate,
|
||||
case,
|
||||
case_source,
|
||||
case_type,
|
||||
contact,
|
||||
court,
|
||||
@ -19,34 +21,8 @@ from .routers import (
|
||||
office,
|
||||
office_status,
|
||||
role,
|
||||
sale_category,
|
||||
section,
|
||||
section_printer,
|
||||
table,
|
||||
tax,
|
||||
update_product_prices,
|
||||
user,
|
||||
)
|
||||
from .routers.reports import (
|
||||
beer_sale_report,
|
||||
bill_settlement_report,
|
||||
cashier_report,
|
||||
discount_report,
|
||||
product_sale_report,
|
||||
product_updates_report,
|
||||
sale_report,
|
||||
tax_report,
|
||||
)
|
||||
from .routers.voucher import (
|
||||
change,
|
||||
merge_move,
|
||||
receive_payment,
|
||||
save,
|
||||
show,
|
||||
split,
|
||||
update,
|
||||
void,
|
||||
)
|
||||
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
@ -62,6 +38,8 @@ app.include_router(user.router, prefix="/api/users", tags=["users"])
|
||||
|
||||
app.include_router(act.router, prefix="/api/acts", tags=["acts"])
|
||||
app.include_router(advocate.router, prefix="/api/advocates", tags=["advocates"])
|
||||
app.include_router(case.router, prefix="/api/cases", tags=["cases"])
|
||||
app.include_router(case_source.router, prefix="/api/case-sources", tags=["case-sources"])
|
||||
app.include_router(case_type.router, prefix="/api/case-types", tags=["case-types"])
|
||||
app.include_router(contact.router, prefix="/api/contacts", tags=["contacts"])
|
||||
app.include_router(court.router, prefix="/api/courts", tags=["courts"])
|
||||
|
@ -1,8 +1,9 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, Unicode, text
|
||||
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Unicode, text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import expression
|
||||
|
||||
from .meta import Base
|
||||
|
||||
@ -34,6 +35,7 @@ class Case(Base):
|
||||
contact_detail = Column("contact_detail", Unicode(255), nullable=False, unique=True)
|
||||
case_connected_with = Column("case_connected_with", Unicode(255), nullable=False, unique=True)
|
||||
bunch_cases = Column("bunch_cases", Unicode(255), nullable=False)
|
||||
is_deleted = Column("is_deleted", Boolean, nullable=False, server_default=expression.false(), default=False)
|
||||
|
||||
court_id = Column("court_id", UUID(as_uuid=True), ForeignKey("courts.id"), nullable=True)
|
||||
department_id = Column("department_id", UUID(as_uuid=True), ForeignKey("departments.id"), nullable=False)
|
||||
@ -47,6 +49,7 @@ class Case(Base):
|
||||
court_status_id = Column(
|
||||
"court_status_id", UUID(as_uuid=True), ForeignKey("court_statuses.id"), nullable=True
|
||||
) # Old Name Status In Court
|
||||
case_source_id = Column("case_source_id", UUID(as_uuid=True), ForeignKey("case_sources.id"), nullable=True)
|
||||
|
||||
court = relationship("Court", backref="cases")
|
||||
department = relationship("Department", backref="cases")
|
||||
@ -56,26 +59,72 @@ class Case(Base):
|
||||
nature = relationship("Nature", backref="cases")
|
||||
office_status = relationship("OfficeStatus")
|
||||
court_status = relationship("CourtStatus", back_populates="cases")
|
||||
case_source = relationship("CaseSource", back_populates="cases")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
date,
|
||||
pax,
|
||||
bill_id,
|
||||
kot_id,
|
||||
food_table_id,
|
||||
customer_id,
|
||||
voucher_type,
|
||||
user_id,
|
||||
office_file_number=None,
|
||||
court_case_number=None,
|
||||
year=None,
|
||||
title=None,
|
||||
docket_number=None,
|
||||
receipt_date=None,
|
||||
limitation_date=None,
|
||||
filing_date=None,
|
||||
appear_on_behalf_of=None,
|
||||
question_of_law=None,
|
||||
aor_name=None,
|
||||
opposing_council_aor=None,
|
||||
opposing_council_detail=None,
|
||||
lower_court_case_number=None,
|
||||
date_of_impugned_judgement=None,
|
||||
brief_description=None,
|
||||
remarks=None,
|
||||
slp_counter=None,
|
||||
contact_detail=None,
|
||||
case_connected_with=None,
|
||||
bunch_cases=None,
|
||||
court_id=None,
|
||||
department_id=None,
|
||||
office_id=None,
|
||||
case_type_id=None,
|
||||
act_id=None,
|
||||
nature_id=None,
|
||||
office_status_id=None,
|
||||
court_status_id=None,
|
||||
case_source_id=None,
|
||||
is_deleted=None,
|
||||
id=None,
|
||||
):
|
||||
self.date = date
|
||||
self.pax = pax
|
||||
self.creation_date = date
|
||||
self.last_edit_date = date
|
||||
self.bill_id = bill_id
|
||||
self.kot_id = kot_id
|
||||
self.food_table_id = food_table_id
|
||||
self.customer_id = customer_id
|
||||
self.narration = None
|
||||
self.voucher_type = voucher_type
|
||||
self.user_id = user_id
|
||||
self.office_file_number = office_file_number
|
||||
self.court_case_number = court_case_number
|
||||
self.year = year
|
||||
self.title = title
|
||||
self.docket_number = docket_number
|
||||
self.receipt_date = receipt_date
|
||||
self.limitation_date = limitation_date
|
||||
self.filing_date = filing_date
|
||||
self.appear_on_behalf_of = appear_on_behalf_of
|
||||
self.question_of_law = question_of_law
|
||||
self.aor_name = aor_name
|
||||
self.opposing_council_aor = opposing_council_aor
|
||||
self.opposing_council_detail = opposing_council_detail
|
||||
self.lower_court_case_number = lower_court_case_number
|
||||
self.date_of_impugned_judgement = date_of_impugned_judgement
|
||||
self.brief_description = brief_description
|
||||
self.remarks = remarks
|
||||
self.slp_counter = slp_counter
|
||||
self.contact_detail = contact_detail
|
||||
self.case_connected_with = case_connected_with
|
||||
self.bunch_cases = bunch_cases
|
||||
self.court_id = court_id
|
||||
self.department_id = department_id
|
||||
self.office_id = office_id
|
||||
self.case_type_id = case_type_id
|
||||
self.act_id = act_id
|
||||
self.nature_id = nature_id
|
||||
self.office_status_id = office_status_id
|
||||
self.court_status_id = court_status_id
|
||||
self.is_deleted = False if is_deleted is None else is_deleted
|
||||
self.case_source_id = case_source_id
|
||||
self.id = id
|
||||
|
25
luthor/luthor/models/case_source.py
Normal file
25
luthor/luthor/models/case_source.py
Normal file
@ -0,0 +1,25 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, Unicode, text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .case import Case
|
||||
from .meta import Base
|
||||
|
||||
|
||||
class CaseSource(Base):
|
||||
__tablename__ = "case_sources"
|
||||
|
||||
id = Column(
|
||||
"id", UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), default=uuid.uuid4
|
||||
)
|
||||
name = Column("name", Unicode(255), nullable=False, unique=True)
|
||||
prefix = Column("prefix", Unicode(255), nullable=False, unique=True)
|
||||
|
||||
cases = relationship("Case", back_populates="case_source")
|
||||
|
||||
def __init__(self, name=None, prefix=None, id_=None):
|
||||
self.name = name
|
||||
self.prefix = prefix
|
||||
self.id = id_
|
@ -1,15 +1,11 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
Unicode,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy import Column, Unicode, text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .case import Case # noqa
|
||||
from .hearing import Hearing # noqa
|
||||
from .case import Case
|
||||
from .hearing import Hearing
|
||||
from .meta import Base
|
||||
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
DateTime,
|
||||
ForeignKey,
|
||||
Unicode,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, Unicode, text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
|
@ -1,14 +1,8 @@
|
||||
import random
|
||||
import string
|
||||
import uuid
|
||||
|
||||
from datetime import datetime
|
||||
from hashlib import md5
|
||||
|
||||
from sqlalchemy import Boolean, Column, DateTime, Unicode, UniqueConstraint, desc, text
|
||||
from sqlalchemy import Column, Unicode, text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import Session, relationship, synonym
|
||||
from sqlalchemy.schema import ForeignKey, Table
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .meta import Base
|
||||
from .role_permission import role_permissions
|
||||
|
239
luthor/luthor/routers/case.py
Normal file
239
luthor/luthor/routers/case.py
Normal file
@ -0,0 +1,239 @@
|
||||
import uuid
|
||||
|
||||
from typing import List
|
||||
|
||||
import luthor.schemas.case as schemas
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||
from sqlalchemy import desc
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ..core.security import get_current_active_user as get_user
|
||||
from ..db.session import SessionLocal
|
||||
from ..models.case import Case
|
||||
from ..schemas.user_token import UserToken
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
# Dependency
|
||||
def get_db():
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.post("", response_model=schemas.Case)
|
||||
def save(
|
||||
data: schemas.CaseIn,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||
) -> schemas.Case:
|
||||
try:
|
||||
item = Case(
|
||||
office_file_number=data.office_file_number,
|
||||
court_case_number=data.court_case_number,
|
||||
year=data.year,
|
||||
title=data.title,
|
||||
docket_number=data.docket_number,
|
||||
receipt_date=data.receipt_date,
|
||||
limitation_date=data.limitation_date,
|
||||
filing_date=data.filing_date,
|
||||
appear_on_behalf_of=data.appear_on_behalf_of,
|
||||
question_of_law=data.question_of_law,
|
||||
aor_name=data.aor_name,
|
||||
opposing_council_aor=data.opposing_council_aor,
|
||||
opposing_council_detail=data.opposing_council_detail,
|
||||
lower_court_case_number=data.lower_court_case_number,
|
||||
date_of_impugned_judgement=data.date_of_impugned_judgement,
|
||||
brief_description=data.brief_description,
|
||||
remarks=data.remarks,
|
||||
slp_counter=data.slp_counter,
|
||||
contact_detail=data.contact_detail,
|
||||
case_connected_with=data.case_connected_with,
|
||||
bunch_cases=data.bunch_cases,
|
||||
court_id=data.court.id_ if data.court is not None else None,
|
||||
department_id=data.department.id_ if data.department is not None else None,
|
||||
office_id=data.office.id_ if data.office is not None else None,
|
||||
case_type_id=data.case_type.id_ if data.case_type is not None else None,
|
||||
act_id=data.act.id_ if data.act is not None else None,
|
||||
nature_id=data.nature.id_ if data.nature is not None else None,
|
||||
office_status_id=data.office_status.id_ if data.office_status is not None else None,
|
||||
court_status_id=data.court_status.id_ if data.court_status is not None else None,
|
||||
)
|
||||
db.add(item)
|
||||
db.commit()
|
||||
return case_info(item)
|
||||
except SQLAlchemyError as e:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail=str(e),
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.Case)
|
||||
def update(
|
||||
id_: uuid.UUID,
|
||||
data: schemas.CaseIn,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||
) -> schemas.Case:
|
||||
try:
|
||||
item: Case = db.query(Case).filter(Case.id == id_).first()
|
||||
item.office_file_number = data.office_file_number
|
||||
item.court_case_number = data.court_case_number
|
||||
item.year = data.year
|
||||
item.title = data.title
|
||||
item.docket_number = data.docket_number
|
||||
item.receipt_date = data.receipt_date
|
||||
item.limitation_date = data.limitation_date
|
||||
item.filing_date = data.filing_date
|
||||
item.appear_on_behalf_of = data.appear_on_behalf_of
|
||||
item.question_of_law = data.question_of_law
|
||||
item.aor_name = data.aor_name
|
||||
item.opposing_council_aor = data.opposing_council_aor
|
||||
item.opposing_council_detail = data.opposing_council_detail
|
||||
item.lower_court_case_number = data.lower_court_case_number
|
||||
item.date_of_impugned_judgement = data.date_of_impugned_judgement
|
||||
item.brief_description = data.brief_description
|
||||
item.remarks = data.remarks
|
||||
item.slp_counter = data.slp_counter
|
||||
item.contact_detail = data.contact_detail
|
||||
item.case_connected_with = data.case_connected_with
|
||||
item.bunch_cases = data.bunch_cases
|
||||
item.court_id = data.court.id_ if data.court is not None else None
|
||||
item.department_id = data.department.id_ if data.department is not None else None
|
||||
item.office_id = data.office.id_ if data.office is not None else None
|
||||
item.case_type_id = data.case_type.id_ if data.case_type is not None else None
|
||||
item.act_id = data.act.id_ if data.act is not None else None
|
||||
item.nature_id = data.nature.id_ if data.nature is not None else None
|
||||
item.office_status_id = data.office_status.id_ if data.office_status is not None else None
|
||||
item.court_status_id = data.court_status.id_ if data.court_status is not None else None
|
||||
db.commit()
|
||||
return case_info(item)
|
||||
except SQLAlchemyError as e:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail=str(e),
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id_}", response_model=schemas.CaseBlank)
|
||||
def delete(
|
||||
id_: uuid.UUID,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||
) -> schemas.CaseBlank:
|
||||
try:
|
||||
item: Case = db.query(Case).filter(Case.id == id_).first()
|
||||
if item is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="Sale Category not found",
|
||||
)
|
||||
item.is_deleted = True
|
||||
db.commit()
|
||||
return case_blank()
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=schemas.CaseBlank)
|
||||
def show_blank(
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||
) -> schemas.CaseBlank:
|
||||
return case_blank()
|
||||
|
||||
|
||||
@router.get("/list", response_model=List[schemas.Case])
|
||||
def show_list(db: Session = Depends(get_db), user: UserToken = Depends(get_user)) -> List[schemas.Case]:
|
||||
return [case_info(item) for item in db.query(Case).order_by(desc(Case.receipt_date)).all()]
|
||||
|
||||
|
||||
@router.get("/{id_}", response_model=schemas.Case)
|
||||
def show_id(
|
||||
id_: uuid.UUID,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||
) -> schemas.Case:
|
||||
item: Case = db.query(Case).filter(Case.id == id_).first()
|
||||
return case_info(item)
|
||||
|
||||
|
||||
def case_info(item: Case) -> schemas.Case:
|
||||
return schemas.Case(
|
||||
id=item.id,
|
||||
officeFileNumber=item.office_file_number if item.office_file_number is not None else "",
|
||||
courtCaseNumber=item.court_case_number if item.court_case_number is not None else "",
|
||||
year=item.year,
|
||||
title=item.title if item.title is not None else "",
|
||||
docketNumber=item.docket_number if item.docket_number is not None else "",
|
||||
receiptDate=item.receipt_date,
|
||||
limitation_date=item.limitation_date,
|
||||
filingDate=item.filing_date,
|
||||
appearOnBehalfOf=item.appear_on_behalf_of if item.appear_on_behalf_of is not None else "",
|
||||
questionOfLaw=item.question_of_law if item.question_of_law is not None else "",
|
||||
aorName=item.aor_name if item.aor_name is not None else "",
|
||||
opposingCouncilAor=item.opposing_council_aor if item.opposing_council_aor is not None else "",
|
||||
opposingCouncilDetail=item.opposing_council_detail if item.opposing_council_detail is not None else "",
|
||||
lowerCourtCaseNumber=item.lower_court_case_number if item.lower_court_case_number is not None else "",
|
||||
dateOfImpugnedJudgement=item.date_of_impugned_judgement,
|
||||
briefDescription=item.brief_description if item.brief_description is not None else "",
|
||||
remarks=item.remarks if item.remarks is not None else "",
|
||||
slpCounter=item.slp_counter if item.slp_counter is not None else "",
|
||||
contactDetail=item.contact_detail if item.contact_detail is not None else "",
|
||||
caseConnectedWith=item.case_connected_with if item.case_connected_with is not None else "",
|
||||
bunchCases=item.bunch_cases if item.bunch_cases is not None else "",
|
||||
court=schemas.CourtLink(id=item.court.id, name=item.court.name) if item.court is not None else None,
|
||||
department=schemas.DepartmentLink(id=item.department.id, name=item.department.name)
|
||||
if item.department is not None
|
||||
else None,
|
||||
office=schemas.OfficeLink(id=item.office.id, name=item.office.name) if item.office is not None else None,
|
||||
caseType=schemas.CaseTypeLink(id=item.case_type.id, name=item.case_type.name)
|
||||
if item.case_type is not None
|
||||
else None,
|
||||
act=schemas.ActLink(id=item.act.id, name=item.act.name) if item.act is not None else None,
|
||||
nature=schemas.NatureLink(id=item.nature.id, name=item.nature.name) if item.nature is not None else None,
|
||||
officeStatus=schemas.OfficeStatusLink(id=item.office_status.id, name=item.office_status.name)
|
||||
if item.office_status is not None
|
||||
else None,
|
||||
courtStatus=schemas.CourtStatusLink(id=item.court_status.id, name=item.court_status.name)
|
||||
if item.court_status is not None
|
||||
else None,
|
||||
)
|
||||
|
||||
|
||||
def case_blank() -> schemas.CaseBlank:
|
||||
return schemas.CaseBlank(
|
||||
officeFileNumber="",
|
||||
courtCaseNumber="",
|
||||
year="",
|
||||
title="",
|
||||
docketNumber="",
|
||||
appearOnBehalfOf="",
|
||||
questionOfLaw="",
|
||||
aorName="",
|
||||
opposingCouncilAor="",
|
||||
opposingCouncilDetail="",
|
||||
lowerCourtCaseNumber="",
|
||||
briefDescription="",
|
||||
remarks="",
|
||||
slpCounter="",
|
||||
contactDetail="",
|
||||
caseConnectedWith="",
|
||||
bunchCases="",
|
||||
)
|
125
luthor/luthor/routers/case_source.py
Normal file
125
luthor/luthor/routers/case_source.py
Normal file
@ -0,0 +1,125 @@
|
||||
import uuid
|
||||
|
||||
from typing import List
|
||||
|
||||
import luthor.schemas.case_source as schemas
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ..core.security import get_current_active_user as get_user
|
||||
from ..db.session import SessionLocal
|
||||
from ..models.case_source import CaseSource
|
||||
from ..schemas.user_token import UserToken
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
# Dependency
|
||||
def get_db():
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.post("", response_model=schemas.CaseSource)
|
||||
def save(
|
||||
data: schemas.CaseSourceIn,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["case_sources"]),
|
||||
) -> schemas.CaseSource:
|
||||
try:
|
||||
item = CaseSource(name=data.name, prefix=data.prefix)
|
||||
db.add(item)
|
||||
db.commit()
|
||||
return case_source_info(item)
|
||||
except SQLAlchemyError as e:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail=str(e),
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.CaseSource)
|
||||
def update(
|
||||
id_: uuid.UUID,
|
||||
data: schemas.CaseSourceIn,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["case_sources"]),
|
||||
) -> schemas.CaseSource:
|
||||
try:
|
||||
item: CaseSource = db.query(CaseSource).filter(CaseSource.id == id_).first()
|
||||
item.name = data.name
|
||||
item.prefix = data.prefix
|
||||
db.commit()
|
||||
return case_source_info(item)
|
||||
except SQLAlchemyError as e:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail=str(e),
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id_}", response_model=schemas.CaseSourceBlank)
|
||||
def delete(
|
||||
id_: uuid.UUID,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["case_sources"]),
|
||||
) -> schemas.CaseSourceBlank:
|
||||
try:
|
||||
item: CaseSource = db.query(CaseSource).filter(CaseSource.id == id_).first()
|
||||
db.delete(item)
|
||||
db.commit()
|
||||
return case_source_blank()
|
||||
except SQLAlchemyError as e:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail=str(e),
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=schemas.CaseSourceBlank)
|
||||
def show_blank(
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["case_sources"]),
|
||||
) -> schemas.CaseSourceBlank:
|
||||
return case_source_blank()
|
||||
|
||||
|
||||
@router.get("/list", response_model=List[schemas.CaseSource])
|
||||
def show_list(db: Session = Depends(get_db), user: UserToken = Depends(get_user)):
|
||||
return [case_source_info(item) for item in db.query(CaseSource).order_by(CaseSource.name).all()]
|
||||
|
||||
|
||||
@router.get("/{id_}", response_model=schemas.CaseSource)
|
||||
def show_id(
|
||||
id_: uuid.UUID,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["case_sources"]),
|
||||
) -> schemas.CaseSource:
|
||||
item: CaseSource = db.query(CaseSource).filter(CaseSource.id == id_).first()
|
||||
return case_source_info(item)
|
||||
|
||||
|
||||
def case_source_info(item: CaseSource) -> schemas.CaseSource:
|
||||
return schemas.CaseSource(id=item.id, name=item.name, prefix=item.prefix)
|
||||
|
||||
|
||||
def case_source_blank() -> schemas.CaseSourceBlank:
|
||||
return schemas.CaseSourceBlank(name="", prefix="")
|
@ -71,7 +71,7 @@ def update(
|
||||
item.address = data.address
|
||||
item.email = data.email
|
||||
item.office_id = data.office.id_ if data.office is not None else None
|
||||
item.department_id = data.department.id_ if data.department is not None else None,
|
||||
item.department_id = (data.department.id_ if data.department is not None else None,)
|
||||
db.commit()
|
||||
return contact_info(item)
|
||||
except SQLAlchemyError as e:
|
||||
@ -140,7 +140,9 @@ def contact_info(item: Contact) -> schemas.Contact:
|
||||
address=item.address,
|
||||
email=item.email,
|
||||
office=schemas.OfficeLink(id=item.office.id, name=item.office.name) if item.office is not None else None,
|
||||
department=schemas.DepartmentLink(id=item.department.id, name=item.department.name) if item.department is not None else None,
|
||||
department=schemas.DepartmentLink(id=item.department.id, name=item.department.name)
|
||||
if item.department is not None
|
||||
else None,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,13 +1,6 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from fastapi import (
|
||||
APIRouter,
|
||||
Depends,
|
||||
HTTPException,
|
||||
Response,
|
||||
Security,
|
||||
status,
|
||||
)
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response, Security, status
|
||||
from fastapi.security import OAuth2PasswordRequestForm
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import uuid
|
||||
|
||||
from typing import List, Optional
|
||||
from typing import List
|
||||
|
||||
import luthor.schemas.office as schemas
|
||||
|
||||
@ -33,7 +33,12 @@ def save(
|
||||
user: UserToken = Security(get_user, scopes=["offices"]),
|
||||
) -> schemas.Office:
|
||||
try:
|
||||
item = Office(name=data.name, address=data.address, email=data.email, department_id=data.department.id_ if data.department is not None else None)
|
||||
item = Office(
|
||||
name=data.name,
|
||||
address=data.address,
|
||||
email=data.email,
|
||||
department_id=data.department.id_ if data.department is not None else None,
|
||||
)
|
||||
db.add(item)
|
||||
db.commit()
|
||||
return office_info(item)
|
||||
@ -107,12 +112,20 @@ def show_blank(
|
||||
|
||||
@router.get("/of-department", response_model=List[schemas.Office])
|
||||
def show_list_of_department(db: Session = Depends(get_db), user: UserToken = Depends(get_user)) -> List[schemas.Office]:
|
||||
return [office_info(item) for item in db.query(Office).filter(Office.department_id == None).order_by(Office.name).all()]
|
||||
return [
|
||||
office_info(item)
|
||||
for item in db.query(Office).filter(Office.department_id == None).order_by(Office.name).all() # noqa: E711
|
||||
]
|
||||
|
||||
|
||||
@router.get("/of-department/{department_id}", response_model=List[schemas.Office])
|
||||
def show_list_of_department_id(department_id: uuid.UUID, db: Session = Depends(get_db), user: UserToken = Depends(get_user)) -> List[schemas.Office]:
|
||||
return [office_info(item) for item in db.query(Office).filter(Office.department_id == department_id).order_by(Office.name).all()]
|
||||
def show_list_of_department_id(
|
||||
department_id: uuid.UUID, db: Session = Depends(get_db), user: UserToken = Depends(get_user)
|
||||
) -> List[schemas.Office]:
|
||||
return [
|
||||
office_info(item)
|
||||
for item in db.query(Office).filter(Office.department_id == department_id).order_by(Office.name).all()
|
||||
]
|
||||
|
||||
|
||||
@router.get("/list", response_model=List[schemas.Office])
|
||||
@ -136,7 +149,9 @@ def office_info(item: Office) -> schemas.Office:
|
||||
name=item.name,
|
||||
address=item.address,
|
||||
email=item.email,
|
||||
department=schemas.DepartmentLink(id=item.department.id, name=item.department.name) if item.department is not None else None,
|
||||
department=schemas.DepartmentLink(id=item.department.id, name=item.department.name)
|
||||
if item.department is not None
|
||||
else None,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
import uuid
|
||||
|
||||
from datetime import date
|
||||
from datetime import date, datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field, validator
|
||||
|
||||
from . import to_camel
|
||||
from .act import ActLink
|
||||
from .case_type import CaseTypeLink
|
||||
from .court import CourtLink
|
||||
@ -11,9 +14,6 @@ from .department import DepartmentLink
|
||||
from .nature import NatureLink
|
||||
from .office import OfficeLink
|
||||
from .office_status import OfficeStatusLink
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from . import to_camel
|
||||
|
||||
|
||||
class CaseIn(BaseModel):
|
||||
@ -22,16 +22,16 @@ class CaseIn(BaseModel):
|
||||
year: str
|
||||
title: str
|
||||
docket_number: str
|
||||
receipt_date: date
|
||||
limitation_date: date
|
||||
filing_date: date
|
||||
receipt_date: Optional[date]
|
||||
limitation_date: Optional[date]
|
||||
filing_date: Optional[date]
|
||||
appear_on_behalf_of: str
|
||||
question_of_law: str
|
||||
aor_name: str
|
||||
opposing_council_aor: str
|
||||
opposing_council_detail: str
|
||||
lower_court_case_number: str
|
||||
date_of_impugned_judgement: date
|
||||
date_of_impugned_judgement: Optional[date]
|
||||
brief_description: str
|
||||
remarks: str
|
||||
slp_counter: str
|
||||
@ -39,18 +39,51 @@ class CaseIn(BaseModel):
|
||||
case_connected_with: str
|
||||
bunch_cases: str
|
||||
|
||||
court = CourtLink
|
||||
department = DepartmentLink
|
||||
office = OfficeLink
|
||||
case_type = CaseTypeLink
|
||||
act = ActLink
|
||||
nature = NatureLink
|
||||
office_status = OfficeStatusLink
|
||||
court_status = CourtStatusLink
|
||||
court: Optional[CourtLink]
|
||||
department: Optional[DepartmentLink]
|
||||
office: Optional[OfficeLink]
|
||||
case_type: Optional[CaseTypeLink]
|
||||
act: Optional[ActLink]
|
||||
nature: Optional[NatureLink]
|
||||
office_status: Optional[OfficeStatusLink]
|
||||
court_status: Optional[CourtStatusLink]
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
json_encoders = {datetime: lambda v: v.strftime("%d-%b-%Y %H:%M"), date: lambda v: v.strftime("%d-%b-%Y")}
|
||||
|
||||
@validator("receipt_date", pre=True)
|
||||
def parse_receipt_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
if value is None:
|
||||
return None
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
@validator("limitation_date", pre=True)
|
||||
def parse_limitation_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
if value is None:
|
||||
return None
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
@validator("filing_date", pre=True)
|
||||
def parse_filing_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
if value is None:
|
||||
return None
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
@validator("date_of_impugned_judgement", pre=True)
|
||||
def parse_date_of_impugned_judgement(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
if value is None:
|
||||
return None
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
|
||||
class Case(CaseIn):
|
||||
@ -62,15 +95,6 @@ class Case(CaseIn):
|
||||
|
||||
|
||||
class CaseBlank(CaseIn):
|
||||
court = [CourtLink]
|
||||
department = [DepartmentLink]
|
||||
office = [OfficeLink]
|
||||
case_type = [CaseTypeLink]
|
||||
act = [ActLink]
|
||||
nature = [NatureLink]
|
||||
office_status = [OfficeStatusLink]
|
||||
court_status = [CourtStatusLink]
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
|
37
luthor/luthor/schemas/case_source.py
Normal file
37
luthor/luthor/schemas/case_source.py
Normal file
@ -0,0 +1,37 @@
|
||||
import uuid
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CaseSourceIn(BaseModel):
|
||||
name: str = Field(..., min_length=1)
|
||||
prefix: str = Field(..., min_length=1)
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
|
||||
|
||||
class CaseSource(CaseSourceIn):
|
||||
id_: uuid.UUID
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
fields = {"id_": "id"}
|
||||
|
||||
|
||||
class CaseSourceBlank(BaseModel):
|
||||
name: str
|
||||
prefix: str
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
|
||||
|
||||
class CaseSourceLink(BaseModel):
|
||||
id_: uuid.UUID = Field(...)
|
||||
name: Optional[str]
|
||||
|
||||
class Config:
|
||||
fields = {"id_": "id"}
|
@ -2,12 +2,11 @@ import uuid
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .department import DepartmentLink
|
||||
from .office import OfficeLink
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from . import to_camel
|
||||
from .tax import TaxLink
|
||||
from .department import DepartmentLink
|
||||
from .office import OfficeLink
|
||||
|
||||
|
||||
class ContactIn(BaseModel):
|
||||
|
@ -2,10 +2,10 @@ import uuid
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .department import DepartmentLink
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from . import to_camel
|
||||
from .department import DepartmentLink
|
||||
|
||||
|
||||
class OfficeIn(BaseModel):
|
||||
|
@ -3,9 +3,10 @@ import uuid
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from . import to_camel
|
||||
from .role import RoleItem
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class UserIn(BaseModel):
|
||||
|
@ -18,6 +18,10 @@ const routes: Routes = [
|
||||
path: 'case-types',
|
||||
loadChildren: () => import('./case-types/case-types.module').then((mod) => mod.CaseTypesModule),
|
||||
},
|
||||
{
|
||||
path: 'cases',
|
||||
loadChildren: () => import('./cases/cases.module').then((mod) => mod.CasesModule),
|
||||
},
|
||||
{
|
||||
path: 'contacts',
|
||||
loadChildren: () => import('./contacts/contacts.module').then((mod) => mod.ContactsModule),
|
||||
|
@ -5,9 +5,15 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { distinctUntilChanged, startWith, switchMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { Act } from '../../core/act';
|
||||
import { Case } from '../../core/case';
|
||||
import { CaseType } from '../../core/case-type';
|
||||
import { Court } from '../../core/court';
|
||||
import { CourtStatus } from '../../core/court-status';
|
||||
import { Department } from '../../core/department';
|
||||
import { Nature } from '../../core/nature';
|
||||
import { Office } from '../../core/office';
|
||||
import { OfficeStatus } from '../../core/office-status';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { OfficeService } from '../../offices/office.service';
|
||||
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
|
||||
@ -57,13 +63,36 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
showItem(item: Case) {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
name: this.item.name,
|
||||
mobile: this.item.mobile,
|
||||
landline: this.item.landline,
|
||||
email: this.item.email,
|
||||
address: this.item.address,
|
||||
officeFileNumber: this.item.officeFileNumber,
|
||||
courtCaseNumber: this.item.courtCaseNumber,
|
||||
year: this.item.year,
|
||||
title: this.item.title,
|
||||
docketNumber: this.item.docketNumber,
|
||||
receiptDate: this.item.receiptDate,
|
||||
limitationDate: this.item.limitationDate,
|
||||
filingDate: this.item.filingDate,
|
||||
appearOnBehalfOf: this.item.appearOnBehalfOf,
|
||||
questionOfLaw: this.item.questionOfLaw,
|
||||
aorName: this.item.aorName,
|
||||
opposingCouncilAor: this.item.opposingCouncilAor,
|
||||
opposingCouncilDetail: this.item.opposingCouncilDetail,
|
||||
lowerCourtCaseNumber: this.item.lowerCourtCaseNumber,
|
||||
dateOfImpugnedJudgement: this.item.dateOfImpugnedJudgement,
|
||||
briefDescription: this.item.briefDescription,
|
||||
remarks: this.item.remarks,
|
||||
slpCounter: this.item.slpCounter,
|
||||
contactDetail: this.item.contactDetail,
|
||||
caseConnectedWith: this.item.caseConnectedWith,
|
||||
bunchCases: this.item.bunchCases,
|
||||
|
||||
court: this.item.court ? this.item.court.id : '',
|
||||
department: this.item.department ? this.item.department.id : '',
|
||||
office: this.item.office ? this.item.office.id : '',
|
||||
caseType: this.item.caseType ? this.item.caseType.id : '',
|
||||
act: this.item.act ? this.item.act.id : '',
|
||||
nature: this.item.nature ? this.item.nature.id : '',
|
||||
officeStatus: this.item.officeStatus ? this.item.officeStatus.id : '',
|
||||
courtStatus: this.item.courtStatus ? this.item.courtStatus.id : '',
|
||||
});
|
||||
this.offices = (this.form.get('department') as FormControl).valueChanges.pipe(
|
||||
startWith(this.item.department ? this.item.department.id : ''),
|
||||
@ -119,11 +148,36 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
getItem(): Case {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
this.item.mobile = formModel.mobile;
|
||||
this.item.landline = formModel.landline;
|
||||
this.item.email = formModel.email;
|
||||
this.item.address = formModel.address;
|
||||
this.item.officeFileNumber = formModel.officeFileNumber;
|
||||
this.item.courtCaseNumber = formModel.courtCaseNumber;
|
||||
this.item.year = formModel.year;
|
||||
this.item.title = formModel.title;
|
||||
this.item.docketNumber = formModel.docketNumber;
|
||||
this.item.receiptDate = formModel.receiptDate;
|
||||
this.item.limitationDate = formModel.limitationDate;
|
||||
this.item.filingDate = formModel.filingDate;
|
||||
this.item.appearOnBehalfOf = formModel.appearOnBehalfOf;
|
||||
this.item.questionOfLaw = formModel.questionOfLaw;
|
||||
this.item.aorName = formModel.aorName;
|
||||
this.item.opposingCouncilAor = formModel.opposingCouncilAor;
|
||||
this.item.opposingCouncilDetail = formModel.opposingCouncilDetail;
|
||||
this.item.lowerCourtCaseNumber = formModel.lowerCourtCaseNumber;
|
||||
this.item.dateOfImpugnedJudgement = formModel.dateOfImpugnedJudgement;
|
||||
this.item.briefDescription = formModel.briefDescription;
|
||||
this.item.remarks = formModel.remarks;
|
||||
this.item.slpCounter = formModel.slpCounter;
|
||||
this.item.contactDetail = formModel.contactDetail;
|
||||
this.item.caseConnectedWith = formModel.caseConnectedWith;
|
||||
this.item.bunchCases = formModel.bunchCases;
|
||||
|
||||
if (formModel.court === undefined || formModel.court === '') {
|
||||
this.item.court = undefined;
|
||||
} else {
|
||||
if (this.item.court === null || this.item.court === undefined) {
|
||||
this.item.court = new Court();
|
||||
}
|
||||
this.item.court.id = formModel.court;
|
||||
}
|
||||
if (formModel.department === undefined || formModel.department === '') {
|
||||
this.item.department = undefined;
|
||||
} else {
|
||||
@ -140,6 +194,46 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
this.item.office.id = formModel.office;
|
||||
}
|
||||
if (formModel.caseType === undefined || formModel.caseType === '') {
|
||||
this.item.caseType = undefined;
|
||||
} else {
|
||||
if (this.item.caseType === null || this.item.caseType === undefined) {
|
||||
this.item.caseType = new CaseType();
|
||||
}
|
||||
this.item.caseType.id = formModel.caseType;
|
||||
}
|
||||
if (formModel.act === undefined || formModel.act === '') {
|
||||
this.item.act = undefined;
|
||||
} else {
|
||||
if (this.item.act === null || this.item.act === undefined) {
|
||||
this.item.act = new Act();
|
||||
}
|
||||
this.item.act.id = formModel.act;
|
||||
}
|
||||
if (formModel.nature === undefined || formModel.nature === '') {
|
||||
this.item.nature = undefined;
|
||||
} else {
|
||||
if (this.item.nature === null || this.item.nature === undefined) {
|
||||
this.item.nature = new Nature();
|
||||
}
|
||||
this.item.nature.id = formModel.nature;
|
||||
}
|
||||
if (formModel.officeStatus === undefined || formModel.officeStatus === '') {
|
||||
this.item.officeStatus = undefined;
|
||||
} else {
|
||||
if (this.item.officeStatus === null || this.item.officeStatus === undefined) {
|
||||
this.item.officeStatus = new OfficeStatus();
|
||||
}
|
||||
this.item.officeStatus.id = formModel.officeStatus;
|
||||
}
|
||||
if (formModel.courtStatus === undefined || formModel.courtStatus === '') {
|
||||
this.item.courtStatus = undefined;
|
||||
} else {
|
||||
if (this.item.courtStatus === null || this.item.courtStatus === undefined) {
|
||||
this.item.courtStatus = new CourtStatus();
|
||||
}
|
||||
this.item.courtStatus.id = formModel.courtStatus;
|
||||
}
|
||||
return this.item;
|
||||
}
|
||||
}
|
||||
|
@ -8,45 +8,88 @@
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
|
||||
<!-- Office File Number Column -->
|
||||
<ng-container matColumnDef="officeFileNumber">
|
||||
<mat-header-cell *matHeaderCellDef>File No.</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"
|
||||
><a [routerLink]="['/cases', row.id]">{{ row.name }}</a></mat-cell
|
||||
><a [routerLink]="['/cases', row.id]">{{ row.officeFileNumber }}</a></mat-cell
|
||||
>
|
||||
</ng-container>
|
||||
|
||||
<!-- Mobile Column -->
|
||||
<ng-container matColumnDef="mobile">
|
||||
<mat-header-cell *matHeaderCellDef>Mobile</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.mobile }}</mat-cell>
|
||||
<!-- Title Column -->
|
||||
<ng-container matColumnDef="title">
|
||||
<mat-header-cell *matHeaderCellDef>Title</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.title }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Landline Column -->
|
||||
<ng-container matColumnDef="landline">
|
||||
<mat-header-cell *matHeaderCellDef>Landline</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.landline }}</mat-cell>
|
||||
<!-- Title Column -->
|
||||
<ng-container matColumnDef="courtCaseNumber">
|
||||
<mat-header-cell *matHeaderCellDef>Case No.</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.courtCaseNumber }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Email Column -->
|
||||
<ng-container matColumnDef="email">
|
||||
<mat-header-cell *matHeaderCellDef>Email</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.email }}</mat-cell>
|
||||
<!-- Case Connected With Column -->
|
||||
<ng-container matColumnDef="caseConnectedWith">
|
||||
<mat-header-cell *matHeaderCellDef>Connected Case</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.caseConnectedWith }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Address Column -->
|
||||
<ng-container matColumnDef="address">
|
||||
<!-- Court Column -->
|
||||
<ng-container matColumnDef="court">
|
||||
<mat-header-cell *matHeaderCellDef>Forum</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.court?.name }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Appear On Behalf Of Column -->
|
||||
<ng-container matColumnDef="appearOnBehalfOf">
|
||||
<mat-header-cell *matHeaderCellDef>Address</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.address }}</mat-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.appearOnBehalfOf }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Case Column -->
|
||||
<!-- Next Hearing Date Column -->
|
||||
<ng-container matColumnDef="nextHearingDate">
|
||||
<mat-header-cell *matHeaderCellDef>Next Hearing Date</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">Not Implemented</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Court Satus Column -->
|
||||
<ng-container matColumnDef="courtStatus">
|
||||
<mat-header-cell *matHeaderCellDef>Court Status</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.courtStatus?.name }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Office Status Column -->
|
||||
<ng-container matColumnDef="officeStatus">
|
||||
<mat-header-cell *matHeaderCellDef>Office Status</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.officeStatus?.name }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Remarks Column -->
|
||||
<ng-container matColumnDef="remarks">
|
||||
<mat-header-cell *matHeaderCellDef>Remarks</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.remarks }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Receipt Date Column -->
|
||||
<ng-container matColumnDef="receiptDate">
|
||||
<mat-header-cell *matHeaderCellDef>Receipt Date</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.receiptDate }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Office Column -->
|
||||
<ng-container matColumnDef="office">
|
||||
<mat-header-cell *matHeaderCellDef>Address</mat-header-cell>
|
||||
<mat-header-cell *matHeaderCellDef>Office</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"
|
||||
>{{ row.department?.name }} / {{ row.office?.name }}</mat-cell
|
||||
>
|
||||
</ng-container>
|
||||
|
||||
<!-- Lower Court Case Number Column -->
|
||||
<ng-container matColumnDef="lowerCourtCaseNumber">
|
||||
<mat-header-cell *matHeaderCellDef>Lower Court Case Number</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.lowerCourtCaseNumber }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
</mat-table>
|
||||
|
@ -14,7 +14,21 @@ export class CaseListComponent implements OnInit {
|
||||
list: Case[] = [];
|
||||
dataSource: CaseListDataSource = new CaseListDataSource(this.list);
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name'];
|
||||
displayedColumns = [
|
||||
'officeFileNumber',
|
||||
'title',
|
||||
'courtCaseNumber',
|
||||
'caseConnectedWith',
|
||||
'court',
|
||||
'appearOnBehalfOf',
|
||||
'nextHearingDate',
|
||||
'courtStatus',
|
||||
'officeStatus',
|
||||
'remarks',
|
||||
'receiptDate',
|
||||
'office',
|
||||
'lowerCourtCaseNumber',
|
||||
];
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
|
@ -3,8 +3,8 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { Case } from '../core/case';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
@ -31,23 +31,23 @@ export class CaseService {
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<Case[]>;
|
||||
}
|
||||
|
||||
save(case: Case): Observable<Case> {
|
||||
save(case_: Case): Observable<Case> {
|
||||
return this.http
|
||||
.post<Case>(url, case, httpOptions)
|
||||
.post<Case>(url, case_, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<Case>;
|
||||
}
|
||||
|
||||
update(case: Case): Observable<Case> {
|
||||
update(case_: Case): Observable<Case> {
|
||||
return this.http
|
||||
.put<Case>(`${url}/${case.id}`, case, httpOptions)
|
||||
.put<Case>(`${url}/${case_.id}`, case_, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<Case>;
|
||||
}
|
||||
|
||||
saveOrUpdate(case: Case): Observable<Case> {
|
||||
if (!case.id) {
|
||||
return this.save(case);
|
||||
saveOrUpdate(case_: Case): Observable<Case> {
|
||||
if (!case_.id) {
|
||||
return this.save(case_);
|
||||
}
|
||||
return this.update(case);
|
||||
return this.update(case_);
|
||||
}
|
||||
|
||||
delete(id: string): Observable<Case> {
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
<!-- Contact Column -->
|
||||
<ng-container matColumnDef="office">
|
||||
<mat-header-cell *matHeaderCellDef>Address</mat-header-cell>
|
||||
<mat-header-cell *matHeaderCellDef>Office</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"
|
||||
>{{ row.department?.name }} / {{ row.office?.name }}</mat-cell
|
||||
>
|
||||
|
@ -1,220 +1,3 @@
|
||||
<div fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('customers')"
|
||||
[routerLink]="['/', 'guest-book']"
|
||||
>
|
||||
<h3 class="item-name">Guest Book</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('sales')"
|
||||
[routerLink]="['/', 'sales']"
|
||||
>
|
||||
<h3 class="item-name">Sales</h3>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('cashier-report')"
|
||||
[routerLink]="['/', 'cashier-report']"
|
||||
>
|
||||
<h3 class="item-name">Cashier Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('sale-report')"
|
||||
[routerLink]="['/', 'sale-report']"
|
||||
>
|
||||
<h3 class="item-name">Sale Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('tax-report')"
|
||||
[routerLink]="['/', 'tax-report']"
|
||||
>
|
||||
<h3 class="item-name">Tax Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('product-sale-report')"
|
||||
[routerLink]="['/', 'product-sale-report']"
|
||||
>
|
||||
<h3 class="item-name">Product Sale Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('bill-settlement-report')"
|
||||
[routerLink]="['/', 'bill-settlement-report']"
|
||||
>
|
||||
<h3 class="item-name">Bill Settlement Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('beer-sale-report')"
|
||||
[routerLink]="['/', 'beer-sale-report']"
|
||||
>
|
||||
<h3 class="item-name">Beer Sale Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('discount-report')"
|
||||
[routerLink]="['/', 'discount-report']"
|
||||
>
|
||||
<h3 class="item-name">Discount Report</h3>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('products')"
|
||||
[routerLink]="['/', 'products']"
|
||||
>
|
||||
<h3 class="item-name">Products</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('products')"
|
||||
[routerLink]="['/', 'update-product-prices']"
|
||||
>
|
||||
<h3 class="item-name">Update Product Prices</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('products')"
|
||||
[routerLink]="['/', 'product-updates-report']"
|
||||
>
|
||||
<h3 class="item-name">Product Updates Report</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('modifiers')"
|
||||
[routerLink]="['/', 'modifiers']"
|
||||
>
|
||||
<h3 class="item-name">Modifiers</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('modifiers')"
|
||||
[routerLink]="['/', 'modifier-categories']"
|
||||
>
|
||||
<h3 class="item-name">Modifier Categories</h3>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('sections')"
|
||||
[routerLink]="['/', 'tables']"
|
||||
>
|
||||
<h3 class="item-name">Tables</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('sections')"
|
||||
[routerLink]="['/', 'sections']"
|
||||
>
|
||||
<h3 class="item-name">Sections</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('products')"
|
||||
[routerLink]="['/', 'menu-categories']"
|
||||
>
|
||||
<h3 class="item-name">Menu Categories</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('products')"
|
||||
[routerLink]="['/', 'sale-categories']"
|
||||
>
|
||||
<h3 class="item-name">Sale Categories</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('taxes')"
|
||||
[routerLink]="['/', 'taxes']"
|
||||
>
|
||||
<h3 class="item-name">Taxes</h3>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('users')"
|
||||
[routerLink]="['/', 'roles']"
|
||||
>
|
||||
<h3 class="item-name">Roles</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('users')"
|
||||
[routerLink]="['/', 'users']"
|
||||
>
|
||||
<h3 class="item-name">Users</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('owner')"
|
||||
[routerLink]="['/', 'header-footer']"
|
||||
>
|
||||
<h3 class="item-name">Header / Footer</h3>
|
||||
</mat-card>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngIf="auth.allowed('owner')"
|
||||
[routerLink]="['/', 'settle-options']"
|
||||
>
|
||||
<h3 class="item-name">Settle Options</h3>
|
||||
</mat-card>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<p>Backend: v{{ auth.user?.ver }} / Frontend: v{{ version }}</p>
|
||||
</footer>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<mat-icon>home</mat-icon>
|
||||
Home
|
||||
</a>
|
||||
<a mat-button [routerLink]="['/cases']"> Cases </a>
|
||||
<mat-menu #mastersMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/acts">Acts</a>
|
||||
<a mat-menu-item routerLink="/advocates">Advocates</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user