Skip to content

Commit

Permalink
Review fixes. Removed server declaration. Versioned track claim endpo…
Browse files Browse the repository at this point in the history
…int.
  • Loading branch information
dfitchett committed Sep 5, 2024
1 parent 00346a6 commit db50694
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 30 deletions.
43 changes: 21 additions & 22 deletions domain-bie-events/svc-claim-tracker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Max Claim for Increase (CFI) API
# Claim Tracker Service

`/track/claim` track a claim by events

Expand Down Expand Up @@ -38,26 +38,29 @@ uvicorn api:app --port 8150 --reload

## Testing it all together

Run the Python webserver (uvicorn command above). Now you should be able to make a post request to the `track/claim`
Run the Python webserver (uvicorn command above). Now you should be able to make a post request to the `/track/v1/claim`
endpoint with a request body of the format:

```
{
"claim_id": "1",
"established_time": "2024-01-01T00:00:00-06:00",
"features": [
{
"name": "feature_under_test",
"enabled": true,
}
]
"claim_id": 123,
"established_at": "2024-01-01T00:00:00Z",
"feature_name":"feature",
"feature_enabled":true
}
```

This should result in a response with the following body:

```
{
"claim_id": 123,
"established_at": "2024-01-01T00:00:00",
"feature_name": "feature",
"feature_enabled": true,
"id": "d6c959f8-4106-4067-b65c-077c1a691222",
"created_at": "2024-09-05T16:30:15.353744"
}
```


Expand Down Expand Up @@ -101,28 +104,24 @@ python3 src/python_src/pull_api_documentation.py
### Build the image

Follow steps for
[Platform Base + API-Gateway](https://github.com/department-of-veterans-affairs/abd-vro/wiki/Docker-Compose#platform-base)
[Platform Base](https://github.com/department-of-veterans-affairs/abd-vro/wiki/Docker-Compose#platform-base)
then run the svc-claim-tracker with the following command from the `abd_vro directory`:

```
COMPOSE_PROFILES="all" ./gradlew :domain-bie-events:dockerComposeUp
```

### Verify API in API Gateway
### Verify API

Navigate to [Swagger](http://localhost:8060/webjars/swagger-ui/index.html?urls.primaryName=3.%20Max%20CFI%20API)
Navigate to [Swagger Docs](http://localhost:8150/docs)

Try to send a request on the post endpoint with the following request body:

```
{
"claim_id": "1",
"established_time": "2024-01-01T00:00:00-06:00",
"features": [
{
"name": "feature_under_test",
"enabled": true,
}
]
"claim_id": 123,
"established_at": "2024-01-01T00:00:00Z",
"feature_name":"feature",
"feature_enabled":true
}
```
10 changes: 2 additions & 8 deletions domain-bie-events/svc-claim-tracker/src/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ async def lifespan(api: FastAPI) -> AsyncIterator[None]:
contact={},
version='v0.1',
license={'name': 'CCO 1.0', 'url': 'https://github.com/department-of-veterans-affairs/abd-vro/blob/master/LICENSE.md'},
servers=[
{
'url': '/track',
'description': 'Claim Tracker for BIE Claim Events',
},
],
lifespan=lifespan,
)

Expand All @@ -53,7 +47,7 @@ async def welcome() -> dict[str, Any]:
'links': {
'docs': '/docs',
'health check': '/health',
'track claim': '/track/claim',
'track claim': '/track/v1/claim',
},
}

Expand Down Expand Up @@ -83,7 +77,7 @@ def health_check_errors(db: Session) -> list[str]:
return errors


@app.post(path='/claim', summary='Track a Claim', status_code=status.HTTP_202_ACCEPTED, response_model=TrackClaimResponse)
@app.post(path='/track/v1/claim', summary='Track a Claim', status_code=status.HTTP_202_ACCEPTED, response_model=TrackClaimResponse)
def track_claim(request: Request, track_request: TrackClaimRequest, db: Session = Depends(get_session)) -> TrackedClaim | JSONResponse:
errors = health_check_errors(db)
if errors:
Expand Down

0 comments on commit db50694

Please sign in to comment.