Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS-5349] - Core ESUP amendment changes table #2730

Merged
merged 8 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function loadExternalSecrets() {
echo -e "Make sure you download the OpenShift cli binary (oc) from https://github.com/openshift/okd/releases ?"

if [ "$CODESPACES" = "true" ]; then
echo -e "${bold}Do you want to download and install oc? (only accepts 'yes')${normal}"
echo -e "${bold}Do you want to download and install oc? (answering anything except 'yes' will bypass this step)${normal}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES.

read INSTALL_OC

if [ "$INSTALL_OC" = "yes" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IMagazine } from "@/index";
import { IExplosivesPermitAmendment, IMagazine } from "./";

export interface IExplosivesPermit {
explosives_permit_id: number;
Expand Down Expand Up @@ -35,4 +35,5 @@ export interface IExplosivesPermit {
documents: any[];
mines_permit_number: string;
now_number: string;
explosives_permit_amendments: IExplosivesPermitAmendment[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { IExplosivesPermit } from "./";

export interface IExplosivesPermitAmendment extends IExplosivesPermit {
explosives_permit_amendment_id: number;
explosives_permit_amendment_guid: string;
}
1 change: 1 addition & 0 deletions services/common/src/interfaces/permits/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export * from "./updatePermitAmendmentPayload.interface";
export * from "./PermitAmendmentMineDocument.interface";
export * from "./patchPermitNumber.interface";
export * from "./draftPermitAmendment.interface";
export * from "./explosivesPermitAmendment.interface";

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from app.api.mines.explosives_permit_amendment.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MAGAZINE_MODEL, \
EXPLOSIVES_PERMIT_AMENDMENT_DOCUMENT_MODEL
from app.extensions import api
from flask_restplus import fields
from app.api.mines.response_models import MINE_DOCUMENT_MODEL
Expand Down Expand Up @@ -27,6 +29,45 @@
'explosives_permit_document_type_code': fields.String
})

EXPLOSIVES_PERMIT_AMENDMENT_MODEL = api.model(
'ExplosivesPermitAmendment', {
'explosives_permit_amendment_id': fields.Integer,
'explosives_permit_amendment_guid': fields.String,
'mine_guid': fields.String,
'permit_guid': fields.String,
'now_application_guid': fields.String,
'explosives_permit_id': fields.Integer,
'issuing_inspector_party_guid': fields.String,
'issuing_inspector_name': fields.String,
'mine_manager_mine_party_appt_id': fields.Integer,
'permittee_mine_party_appt_id': fields.Integer,
'mine_manager_name': fields.String,
'permittee_name': fields.String,
'application_status': fields.String,
'permit_number': fields.String,
'issue_date': fields.Date,
'expiry_date': fields.Date,
'application_number': fields.String,
'application_date': fields.Date,
'originating_system': fields.String,
'received_timestamp': fields.DateTime,
'decision_timestamp': fields.DateTime,
'decision_reason': fields.String,
'latitude': fields.Fixed(decimals=7),
'longitude': fields.Fixed(decimals=7),
'is_closed': fields.Boolean,
'closed_timestamp': fields.DateTime,
'closed_reason': fields.String,
'total_detonator_quantity': fields.Integer,
'total_explosive_quantity': fields.Integer,
'description': fields.String,
'explosive_magazines': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_MAGAZINE_MODEL)),
'detonator_magazines': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_MAGAZINE_MODEL)),
'documents': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_DOCUMENT_MODEL)),
'mines_permit_number': fields.String(attribute='mines_act_permit.permit_no'),
'now_number': fields.String(attribute='now_application_identity.now_number')
})

EXPLOSIVES_PERMIT_MODEL = api.model(
'ExplosivesPermit', {
'explosives_permit_id': fields.Integer,
Expand Down Expand Up @@ -62,7 +103,8 @@
'detonator_magazines': fields.List(fields.Nested(EXPLOSIVES_PERMIT_MAGAZINE_MODEL)),
'documents': fields.List(fields.Nested(EXPLOSIVES_PERMIT_DOCUMENT_MODEL)),
'mines_permit_number': fields.String(attribute='mines_act_permit.permit_no'),
'now_number': fields.String(attribute='now_application_identity.now_number')
'now_number': fields.String(attribute='now_application_identity.now_number'),
'explosives_permit_amendments': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_MODEL))
})

EXPLOSIVES_PERMIT_STATUS_MODEL = api.model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ExplosivesPermitAmendment(SoftDeleteMixin, AuditMixin, PermitMixin, Base):
explosives_permit = db.relationship(
'ExplosivesPermit',
primaryjoin='ExplosivesPermit.explosives_permit_id == ExplosivesPermitAmendment.explosives_permit_id',
backref='explosives_permit_amendments'
back_populates='explosives_permit_amendments'
)

documents = db.relationship('ExplosivesPermitAmendmentDocumentXref', lazy='select')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from werkzeug.exceptions import NotFound
from flask_restplus import Resource, inputs

from app.api.mines.explosives_permit.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MODEL
from app.api.mines.mine.models.mine import Mine
from app.extensions import api
from app.api.utils.access_decorators import requires_any_of, VIEW_ALL, MINESPACE_PROPONENT, MINE_ADMIN, requires_role_edit_explosives_permit
from app.api.utils.resources_mixins import UserMixin
from app.api.utils.custom_reqparser import CustomReqparser
from app.api.mines.explosives_permit_amendment.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MODEL
from app.api.mines.explosives_permit_amendment.models.explosives_permit_amendment import ExplosivesPermitAmendment
class ExplosivesPermitAmendmentResource(Resource, UserMixin):
parser = CustomReqparser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from werkzeug.exceptions import NotFound
from decimal import Decimal

from app.api.mines.explosives_permit.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MODEL
from app.api.mines.explosives_permit_amendment.models.explosives_permit_amendment import ExplosivesPermitAmendment
from app.api.mines.explosives_permit_amendment.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MODEL
from app.extensions import api
from app.api.utils.resources_mixins import UserMixin
from app.api.utils.custom_reqparser import CustomReqparser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from app.api.mines.explosives_permit.response_models import EXPLOSIVES_PERMIT_MODEL
from app.api.mines.response_models import MINE_DOCUMENT_MODEL
from app.extensions import api
from flask_restplus import fields
Expand All @@ -25,45 +24,4 @@
EXPLOSIVES_PERMIT_AMENDMENT_DOCUMENT_MODEL = api.inherit('ExplosivesPermitAmendmentDocument', MINE_DOCUMENT_MODEL, {
'explosives_permit_amendment_id': fields.Integer,
'explosives_permit_amendment_document_type_code': fields.String
})

EXPLOSIVES_PERMIT_AMENDMENT_MODEL = api.model(
'ExplosivesPermitAmendment', {
'explosives_permit_amendment_id': fields.Integer,
'explosives_permit_amendment_guid': fields.String,
'mine_guid': fields.String,
'permit_guid': fields.String,
'now_application_guid': fields.String,
'explosives_permit_id': fields.Integer,
'now_application_guid': fields.String,
'issuing_inspector_party_guid': fields.String,
'issuing_inspector_name': fields.String,
'mine_manager_mine_party_appt_id': fields.Integer,
'permittee_mine_party_appt_id': fields.Integer,
'mine_manager_name': fields.String,
'permittee_name': fields.String,
'application_status': fields.String,
'permit_number': fields.String,
'issue_date': fields.Date,
'expiry_date': fields.Date,
'application_number': fields.String,
'application_date': fields.Date,
'originating_system': fields.String,
'received_timestamp': fields.DateTime,
'decision_timestamp': fields.DateTime,
'decision_reason': fields.String,
'latitude': fields.Fixed(decimals=7),
'longitude': fields.Fixed(decimals=7),
'is_closed': fields.Boolean,
'closed_timestamp': fields.DateTime,
'closed_reason': fields.String,
'total_detonator_quantity': fields.Integer,
'total_explosive_quantity': fields.Integer,
'description': fields.String,
'explosives_permit': fields.Nested(EXPLOSIVES_PERMIT_MODEL),
'explosive_magazines': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_MAGAZINE_MODEL)),
'detonator_magazines': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_MAGAZINE_MODEL)),
'documents': fields.List(fields.Nested(EXPLOSIVES_PERMIT_AMENDMENT_DOCUMENT_MODEL)),
'mines_permit_number': fields.String(attribute='mines_act_permit.permit_no'),
'now_number': fields.String(attribute='now_application_identity.now_number')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from tests.factories import ExplosivesPermitAmendmentFactory
from flask_restplus import marshal
from app.api.mines.explosives_permit_amendment.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MODEL
from app.api.mines.explosives_permit.response_models import EXPLOSIVES_PERMIT_AMENDMENT_MODEL


def test_get_explosives_permit_amendment_by_explosives_permit_amendment_guid(test_client, db_session, auth_headers):
Expand Down
Loading
Loading