Skip to content

Commit

Permalink
Merge pull request #2854 from HHS/OPS-2837/can-funding-budget
Browse files Browse the repository at this point in the history
Add endpoint for CANFundingBudgets
  • Loading branch information
rajohnson90 authored Sep 30, 2024
2 parents ed20957 + f9c250f commit 465af7a
Show file tree
Hide file tree
Showing 13 changed files with 835 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Adding CANFundingBudget meta events
Revision ID: d5610e0988b0
Revises: cbbaf27a11ee
Create Date: 2024-09-25 20:46:07.501389+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 = 'd5610e0988b0'
down_revision: Union[str, None] = 'cbbaf27a11ee'
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', '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', '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 @@ -27,6 +27,11 @@ class OpsEventType(Enum):
UPDATE_CAN = auto()
DELETE_CAN = auto()

# CAN Funding Budget Related Events
CREATE_CAN_FUNDING_BUDGET = auto()
UPDATE_CAN_FUNDING_BUDGET = auto()
DELETE_CAN_FUNDING_BUDGET = auto()

# Notification Related Events
ACKNOWLEDGE_NOTIFICATION = auto()

Expand Down
303 changes: 302 additions & 1 deletion backend/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,273 @@ paths:
example:
"0":
$ref: "#/components/examples/CAN"
patch:
tags:
- CANs
summary: Update an existing CAN with the provided fields
operationId: patchCan
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_id
description: Id
required: true
schema:
type: integer
format: int32
minimum: 1
default: 1
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateCANRequestSchema"
examples:
"0":
$ref: "#/components/examples/CreateUpdateCANRequestSchema"
responses:
"200":
description: CAN Updated
content:
application/json:
schema:
$ref: "#/components/schemas/CAN"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
"404":
description: CAN not found
put:
tags:
- CANs
summary: Update an existing CAN
operationId: putCan
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_id
description: Id
required: true
schema:
type: integer
format: int32
minimum: 1
default: 1
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateCANRequestSchema"
examples:
"0":
$ref: "#/components/examples/CreateUpdateCANRequestSchema"
responses:
"200":
description: CAN Updated
content:
application/json:
schema:
$ref: "#/components/schemas/CAN"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
"404":
description: CAN not found
delete:
tags:
- CANs
operationId: deleteCan
summary: Delete a Common Accounting Number (CAN)
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_id
description: Id
required: true
schema:
type: integer
format: int32
minimum: 1
default: 1
responses:
"200":
description: OK
"400":
description: Bad Request
"401":
description: Unauthorized
/api/v1/can-funding-budgets/:
get:
tags:
- CAN Funding Budgets
operationId: getAllCANFundingBudgets
summary: Get a list of all the CAN funding budgets
parameters:
- $ref: "#/components/parameters/simulatedError"
description: Get CANFundingBudgetss
responses:
"200":
description: OK
post:
tags:
- CAN Funding Budgets
operationId: createCANFundingBudget
summary: Create a new CANFundingBudget object
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateCANFundingBudgetRequest"
examples:
"0":
$ref: "#/components/examples/CreateUpdateCANFundingBudgetRequest"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/FundingBudget"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
/api/v1/can-funding-budgets/{can_funding_budget_id}:
get:
tags:
- CAN Funding Budgets
summary: Get an individual CANFundingBudget
operationId: getCANFundingBudgetById
description: Get CANFundingBudget by Id
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_budget_id
description: CAN Funding Budget Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/FundingBudget"
example:
"0":
$ref: "#/components/examples/FundingBudget"
"404":
description: The specified CANFundingBudget was not found.
patch:
tags:
- CAN Funding Budgets
summary: Update an existing CANFundingBudget with the provided fields
operationId: patchCanFundingBudget
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_budget_id
description: CAN Funding Budget Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateCANFundingBudgetRequest"
examples:
"0":
$ref: "#/components/examples/CreateUpdateCANFundingBudgetRequest"
responses:
"200":
description: CANFundingBudget Updated
content:
application/json:
schema:
$ref: "#/components/schemas/FundingBudget"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
"404":
description: CANFundingBudget not found
put:
tags:
- CAN Funding Budgets
summary: Update an existing CANFundingBudget
operationId: putCanFundingBudget
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_budget_id
description: CAN Funding Budget Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUpdateCANFundingBudgetRequest"
examples:
"0":
$ref: "#/components/examples/CreateUpdateCANFundingBudgetRequest"
responses:
"200":
description: CAN Updated
content:
application/json:
schema:
$ref: "#/components/schemas/FundingBudget"
"400":
description: Bad Request
"401":
description: Insufficient Privileges to use this endpoint.
"404":
description: CAN not found
delete:
tags:
- CAN Funding Budgets
operationId: deleteCanFundingBudget
summary: Delete a CANFundingBudget
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: can_funding_budget_id
description: CANFundingBudget 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 CANFundingBudget
/api/v1/portfolios:
get:
tags:
Expand Down Expand Up @@ -2212,14 +2479,29 @@ components:
- fiscal_year
- fund_code
- id
CreateUpdateCANFundingBudgetRequest:
description: A request object for the creation or updating of a FundingBudget
type: object
properties:
fiscal_year:
type: integer
can_id:
type: integer
budget:
type: number
notes:
type: string
required:
- fiscal_year
- can_id
FundingBudget:
description: Funding Budget Object
type: object
properties:
budget:
type: number
can:
type: integer
$ref: "#/components/schemas/BasicCAN"
can_id:
type: integer
display_name:
Expand Down Expand Up @@ -3656,6 +3938,25 @@ components:
portfolio_id: 6,
description: "A very good CAN to use for examples."
}
CreateUpdateCANFundingBudgetRequest:
value: |
{
can_id: 500,
fiscal_year: 2024,
budget: 123456,
notes: "A new test Funding Budget"
}
FundingBudget:
value: |
{
budget: 1234567.89
can: {}
can_id: 500
display_name: CANFundingBudget.1
fiscal_year: 2024
id: 1
notes: "A funding budget"
versions: {}
Notifications:
value: |
[
Expand Down
Loading

0 comments on commit 465af7a

Please sign in to comment.