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

Add DB configuration to filing-api similar to the user-fi api #18

Closed
jcadam14 opened this issue Jan 8, 2024 · 0 comments · Fixed by #19
Closed

Add DB configuration to filing-api similar to the user-fi api #18

jcadam14 opened this issue Jan 8, 2024 · 0 comments · Fixed by #19
Assignees

Comments

@jcadam14
Copy link
Contributor

jcadam14 commented Jan 8, 2024

Add a config.py file that uses pydantic_settings to set config vars in the filing-api service. These will be pulled from a .env (or .env.local) as well as env vars, just like user fi. Start with the following DB configurations:
inst_db_schema: str = "public"
inst_db_name: str
inst_db_user: str
inst_db_pwd: str
inst_db_host: str
inst_db_scheme: str = "postgresql+asyncpg"
inst_conn: PostgresDsn | None = None

This should also include pyproject.toml updates to support testing. Include default .env.local file.

Will need an update to the sbl-project to create a new database, schema, user/pass for this service.

@jcadam14 jcadam14 self-assigned this Jan 8, 2024
@jcadam14 jcadam14 linked a pull request Jan 8, 2024 that will close this issue
25 tasks
lchen-2101 pushed a commit that referenced this issue Jan 9, 2024
Closes #18 

- config.py for reading in .env and env vars for service
- test_config.py to test the db connection string
- pyproject.toml update for test env vars
- .env.local and .env.template for development env vars

[Short description explaining the high-level reason for the pull
request]

## Additions

-

## Removals

-

## Changes

-

## Testing

1.

## Screenshots


## Notes

-

## Todos

-

## Checklist

- [ ] PR has an informative and human-readable title
- [ ] Changes are limited to a single goal (no scope creep)
- [ ] Code can be automatically merged (no conflicts)
- [ ] Code follows the standards laid out in the [development
playbook](https://github.com/cfpb/development)
- [ ] Passes all existing automated tests
- [ ] Any _change_ in functionality is tested
- [ ] New functions are documented (with a description, list of inputs,
and expected output)
- [ ] Placeholder code is flagged / future todos are captured in
comments
- [ ] Visually tested in supported browsers and devices (see checklist
below 👇)
- [ ] Project documentation has been updated (including the "Unreleased"
section of the CHANGELOG)
- [ ] Reviewers requested with the [Reviewers
tool](https://help.github.com/articles/requesting-a-pull-request-review/)
:arrow_right:

## Testing checklist

### Browsers

- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Internet Explorer 8, 9, 10, and 11
- [ ] Edge
- [ ] iOS Safari
- [ ] Chrome for Android

### Accessibility

- [ ] Keyboard friendly
- [ ] Screen reader friendly

### Other

- [ ] Is useable without CSS
- [ ] Is useable without JS
- [ ] Flexible from small to large screens
- [ ] No linting errors or warnings
- [ ] JavaScript tests are passing
jcadam14 added a commit that referenced this issue Jan 17, 2024
Closes #13 

Created a new branch that focuses purely on the alembic script needs
instead of a full merge of #7 and #18 into the #13 branch. Makes it so
only the code related to the migrations is needed for review. Originally
I merged them all together to test starting the service in poetry to
make sure the tables are created correctly in Postgres but that made the
PR have a lot of files that were already covered in other PRs. Still the
case with the entities/models directory but couldn't get around that.

## Additions

- Added db_revision folder using alembic init and updated files for SBL
specifics (using user-fi as an example)
- Added migration files using alembic revision for each submission table
(submission, filing, filing_period)
- Updated migration files for table specifics
- Added pytest migrations tests for new tables, columns, and fks
- Had to merge in the entities/models dir since the migrations use the
enumerations

## Removals

-

## Changes

-

## Testing

1. Run pytest in poetry shell (or poetry run pytest) and verify the
tests pass

## Screenshots


## Notes

-

## Todos

-

## Checklist

- [ ] PR has an informative and human-readable title
- [ ] Changes are limited to a single goal (no scope creep)
- [ ] Code can be automatically merged (no conflicts)
- [ ] Code follows the standards laid out in the [development
playbook](https://github.com/cfpb/development)
- [ ] Passes all existing automated tests
- [ ] Any _change_ in functionality is tested
- [ ] New functions are documented (with a description, list of inputs,
and expected output)
- [ ] Placeholder code is flagged / future todos are captured in
comments
- [ ] Visually tested in supported browsers and devices (see checklist
below 👇)
- [ ] Project documentation has been updated (including the "Unreleased"
section of the CHANGELOG)
- [ ] Reviewers requested with the [Reviewers
tool](https://help.github.com/articles/requesting-a-pull-request-review/)
:arrow_right:

## Testing checklist

### Browsers

- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Internet Explorer 8, 9, 10, and 11
- [ ] Edge
- [ ] iOS Safari
- [ ] Chrome for Android

### Accessibility

- [ ] Keyboard friendly
- [ ] Screen reader friendly

### Other

- [ ] Is useable without CSS
- [ ] Is useable without JS
- [ ] Flexible from small to large screens
- [ ] No linting errors or warnings
- [ ] JavaScript tests are passing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant