Skip to content

Commit

Permalink
Merge pull request #2883 from HHS/OPS-2838/can-funding-details
Browse files Browse the repository at this point in the history
Add CANFundingDetails Endpoint
  • Loading branch information
rajohnson90 authored Oct 11, 2024
2 parents b4c3445 + b6c61ac commit 38e02fc
Show file tree
Hide file tree
Showing 11 changed files with 824 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Adding OPS events for CANFundingDetails
Revision ID: a5a535a5e285
Revises: acfeadc7868c
Create Date: 2024-10-03 21:23:21.134273+00:00
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op
from alembic_postgresql_enum import TableReference

# revision identifiers, used by Alembic.
revision: str = 'a5a535a5e285'
down_revision: Union[str, None] = 'acfeadc7868c'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values('ops', 'opseventtype', ['CREATE_BLI', 'UPDATE_BLI', 'DELETE_BLI', 'SEND_BLI_FOR_APPROVAL', 'CREATE_PROJECT', 'CREATE_NEW_AGREEMENT', 'UPDATE_AGREEMENT', 'DELETE_AGREEMENT', 'CREATE_NEW_CAN', 'UPDATE_CAN', 'DELETE_CAN', 'CREATE_CAN_FUNDING_BUDGET', 'UPDATE_CAN_FUNDING_BUDGET', 'DELETE_CAN_FUNDING_BUDGET', 'CREATE_CAN_FUNDING_DETAILS', 'UPDATE_CAN_FUNDING_DETAILS', 'DELETE_CAN_FUNDING_DETAILS', 'ACKNOWLEDGE_NOTIFICATION', 'CREATE_BLI_PACKAGE', 'UPDATE_BLI_PACKAGE', 'CREATE_SERVICES_COMPONENT', 'UPDATE_SERVICES_COMPONENT', 'DELETE_SERVICES_COMPONENT', 'CREATE_PROCUREMENT_ACQUISITION_PLANNING', 'UPDATE_PROCUREMENT_ACQUISITION_PLANNING', 'DELETE_PROCUREMENT_ACQUISITION_PLANNING', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'LOGIN_ATTEMPT', 'LOGOUT', 'GET_USER_DETAILS', 'CREATE_USER', 'UPDATE_USER', 'DEACTIVATE_USER'],
[TableReference(table_schema='ops', table_name='ops_event', column_name='event_type'), TableReference(table_schema='ops', table_name='ops_event_version', column_name='event_type')],
enum_values_to_rename=[])
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values('ops', 'opseventtype', ['CREATE_BLI', 'UPDATE_BLI', 'DELETE_BLI', 'SEND_BLI_FOR_APPROVAL', 'CREATE_PROJECT', 'CREATE_NEW_AGREEMENT', 'UPDATE_AGREEMENT', 'DELETE_AGREEMENT', 'CREATE_NEW_CAN', 'UPDATE_CAN', 'DELETE_CAN', 'CREATE_CAN_FUNDING_BUDGET', 'UPDATE_CAN_FUNDING_BUDGET', 'DELETE_CAN_FUNDING_BUDGET', 'ACKNOWLEDGE_NOTIFICATION', 'CREATE_BLI_PACKAGE', 'UPDATE_BLI_PACKAGE', 'CREATE_SERVICES_COMPONENT', 'UPDATE_SERVICES_COMPONENT', 'DELETE_SERVICES_COMPONENT', 'CREATE_PROCUREMENT_ACQUISITION_PLANNING', 'UPDATE_PROCUREMENT_ACQUISITION_PLANNING', 'DELETE_PROCUREMENT_ACQUISITION_PLANNING', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'LOGIN_ATTEMPT', 'LOGOUT', 'GET_USER_DETAILS', 'CREATE_USER', 'UPDATE_USER', 'DEACTIVATE_USER'],
[TableReference(table_schema='ops', table_name='ops_event', column_name='event_type'), TableReference(table_schema='ops', table_name='ops_event_version', column_name='event_type')],
enum_values_to_rename=[])
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Re-adding canFundingReceived events
Revision ID: af64d84afb2e
Revises: a5a535a5e285
Create Date: 2024-10-09 13:42:16.462841+00:00
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op
from alembic_postgresql_enum import TableReference

# revision identifiers, used by Alembic.
revision: str = 'af64d84afb2e'
down_revision: Union[str, None] = 'a5a535a5e285'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values('ops', 'opseventtype', ['CREATE_BLI', 'UPDATE_BLI', 'DELETE_BLI', 'SEND_BLI_FOR_APPROVAL', 'CREATE_PROJECT', 'CREATE_NEW_AGREEMENT', 'UPDATE_AGREEMENT', 'DELETE_AGREEMENT', 'CREATE_NEW_CAN', 'UPDATE_CAN', 'DELETE_CAN', 'CREATE_CAN_FUNDING_RECEIVED', 'UPDATE_CAN_FUNDING_RECEIVED', 'DELETE_CAN_FUNDING_RECEIVED', 'CREATE_CAN_FUNDING_BUDGET', 'UPDATE_CAN_FUNDING_BUDGET', 'DELETE_CAN_FUNDING_BUDGET', 'CREATE_CAN_FUNDING_DETAILS', 'UPDATE_CAN_FUNDING_DETAILS', 'DELETE_CAN_FUNDING_DETAILS', 'ACKNOWLEDGE_NOTIFICATION', 'CREATE_BLI_PACKAGE', 'UPDATE_BLI_PACKAGE', 'CREATE_SERVICES_COMPONENT', 'UPDATE_SERVICES_COMPONENT', 'DELETE_SERVICES_COMPONENT', 'CREATE_PROCUREMENT_ACQUISITION_PLANNING', 'UPDATE_PROCUREMENT_ACQUISITION_PLANNING', 'DELETE_PROCUREMENT_ACQUISITION_PLANNING', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'LOGIN_ATTEMPT', 'LOGOUT', 'GET_USER_DETAILS', 'CREATE_USER', 'UPDATE_USER', 'DEACTIVATE_USER'],
[TableReference(table_schema='ops', table_name='ops_event', column_name='event_type'), TableReference(table_schema='ops', table_name='ops_event_version', column_name='event_type')],
enum_values_to_rename=[])
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values('ops', 'opseventtype', ['CREATE_BLI', 'UPDATE_BLI', 'DELETE_BLI', 'SEND_BLI_FOR_APPROVAL', 'CREATE_PROJECT', 'CREATE_NEW_AGREEMENT', 'UPDATE_AGREEMENT', 'DELETE_AGREEMENT', 'CREATE_NEW_CAN', 'UPDATE_CAN', 'DELETE_CAN', 'CREATE_CAN_FUNDING_BUDGET', 'UPDATE_CAN_FUNDING_BUDGET', 'DELETE_CAN_FUNDING_BUDGET', 'CREATE_CAN_FUNDING_DETAILS', 'UPDATE_CAN_FUNDING_DETAILS', 'DELETE_CAN_FUNDING_DETAILS', 'ACKNOWLEDGE_NOTIFICATION', 'CREATE_BLI_PACKAGE', 'UPDATE_BLI_PACKAGE', 'CREATE_SERVICES_COMPONENT', 'UPDATE_SERVICES_COMPONENT', 'DELETE_SERVICES_COMPONENT', 'CREATE_PROCUREMENT_ACQUISITION_PLANNING', 'UPDATE_PROCUREMENT_ACQUISITION_PLANNING', 'DELETE_PROCUREMENT_ACQUISITION_PLANNING', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'LOGIN_ATTEMPT', 'LOGOUT', 'GET_USER_DETAILS', 'CREATE_USER', 'UPDATE_USER', 'DEACTIVATE_USER'],
[TableReference(table_schema='ops', table_name='ops_event', column_name='event_type'), TableReference(table_schema='ops', table_name='ops_event_version', column_name='event_type')],
enum_values_to_rename=[])
# ### end Alembic commands ###
5 changes: 5 additions & 0 deletions backend/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class OpsEventType(Enum):
UPDATE_CAN_FUNDING_BUDGET = auto()
DELETE_CAN_FUNDING_BUDGET = auto()

# CAN Funding Details related events
CREATE_CAN_FUNDING_DETAILS = auto()
UPDATE_CAN_FUNDING_DETAILS = auto()
DELETE_CAN_FUNDING_DETAILS = auto()

# Notification Related Events
ACKNOWLEDGE_NOTIFICATION = auto()

Expand Down
219 changes: 219 additions & 0 deletions backend/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,171 @@ paths:
description: Unauthorized
"404":
description: Unable to find specified CANFundingReceived
/api/v1/cans-funding-details/:
get:
tags:
- CANs Funding Details
operationId: getAllCANFundingDetails
summary: Get a list all CANs funding details objects
parameters:
- $ref: "#/components/parameters/simulatedError"
description: Get CANFundingDetails
responses:
"200":
description: OK
post:
tags:
- CANs Funding Details
operationId: createCANFundingDetails
summary: Create a new CANFundingDetails object
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateFundingDetails"
examples:
"0":
$ref: "#/components/examples/CreateUpdateFundingDetails"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/FundingDetails"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
/api/v1/can-funding-details/{can_funding_details_id}:
get:
tags:
- CANs Funding Details
summary: Get an individual CANFundingDetails
operationId: getCANFundingDetailsById
description: Get CANFundingDetails by Id
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_details_id
description: CAN Funding Details Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/FundingDetails"
"404":
description: The specified CANFundingDetails was not found.
patch:
tags:
- CANs Funding Details
summary: Update an existing CANFundingDetails with the provided fields
operationId: patchCANFundingDetails
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_details_id
description: CAN Funding Details Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateFundingDetails"
examples:
"0":
$ref: "#/components/examples/CreateUpdateFundingDetails"
responses:
"200":
description: CANFundingDetails Updated
content:
application/json:
schema:
$ref: "#/components/schemas/FundingDetails"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
"404":
description: CANFundingDetails not found
put:
tags:
- CANs Funding Details
summary: Update an existing CANFundingDetails
operationId: putCanFundingDetails
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_details_id
description: CAN Funding Details Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateFundingDetails"
examples:
"0":
$ref: "#/components/examples/CreateUpdateFundingDetails"
responses:
"200":
description: CAN Updated
content:
application/json:
schema:
$ref: "#/components/schemas/FundingDetails"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
"404":
description: CAN not found
delete:
tags:
- CANs Funding Details
operationId: deleteCanFundingDetails
summary: Delete a CANFundingDetails
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_details_id
description: CANFundingDetails ID
required: true
schema:
type: integer
format: int32
minimum: 1
default: 1
responses:
"200":
description: OK
"400":
description: Bad Request
"401":
description: Unauthorized
"404":
description: Unable to find specified CANFundingDetails
/api/v1/can-funding-budgets/:
get:
tags:
Expand Down Expand Up @@ -2622,6 +2787,37 @@ components:
required:
- fiscal_year
- can_id
CreateUpdateFundingDetails:
description: A request object for the creation or updating of a FundingDetails object
type: object
properties:
allotment:
type: string
allowance:
type: string
display_name:
type: string
fiscal_year:
type: integer
fund_code:
type: string
funding_partner:
type: string
funding_source:
type: string
enum:
- OPRE
- ACF
- HHS
method_of_transfer:
type: string
enum:
- DIRECT
- COST_SHARE
- IAA
- IDDA
sub_allowance:
type: string
FundingDetails:
description: Funding Detail Object
type: object
Expand All @@ -2642,10 +2838,19 @@ components:
type: string
funding_source:
type: string
enum:
- OPRE
- ACF
- HHS
id:
type: integer
method_of_transfer:
type: string
enum:
- DIRECT
- COST_SHARE
- IAA
- IDDA
sub_allowance:
type: string
created_on:
Expand Down Expand Up @@ -4159,6 +4364,20 @@ components:
funding: 123456,
notes: "A new test Funding Funding"
}
CreateUpdateFundingDetails:
value: |
{
allotment: "Allotment"
allowance: "Allowance"
display_name: "Display name"
fiscal_year: 2024
fund_code: "AAXXXX20231DAD"
funding_partner: "OPRE Partner"
funding_source: "OPRE"
method_of_transfer: "DIRECT"
sub_allowance: "Money"
}
FundingBudget:
value: |
{
Expand Down
Loading

0 comments on commit 38e02fc

Please sign in to comment.