Skip to content

Commit a052725

Browse files
authored
Callsign Migration (#623)
# Purpose Closes #616 . Explain the purpose of the PR here if it doesn't match the linked issue. Be sure to add a comment in the linked issue explaining the changes. Check PR for purpose # New Changes Explain new changes below in short bullet points. - added to callsigns.csv (ty julian!) to resources - created new model in aro users to store callsigns - read csv file with csv lib and return a list of all callsigns - checks if callsigns table is already populated. if not, migrate list contents upon app startup - automatic B-tree indexing thanks to PostgreSQL # Testing Explain tests that you ran to verify code functionality. - [x] I have unit-tested this PR. Otherwise, explain why it cannot be unit-tested. I performed startup and callsign data was created in local database (see screenshots below) - [x] I have included screenshots of the tests performed below. 1. delete pre-existing data in callsigns table <img width="274" height="31" alt="image" src="https://github.com/user-attachments/assets/ddb5175d-0020-45b0-be72-5ce3242403a8" /> 2. start app with ```fastapi dev gs/backend/main.py``` <img width="350" height="213" alt="image" src="https://github.com/user-attachments/assets/9198f32d-d533-463d-8c8d-3be7df050ff8" /> 3. check db to see newly inserted callsign entries <img width="299" height="290" alt="image" src="https://github.com/user-attachments/assets/55ea51d8-6902-4b51-ac7b-f600bf156051" /> # Outstanding Changes If there are non-critical changes (i.e. additional features) that can be made to this feature in the future, indicate them here. update wrappers to support new callsigns table.
1 parent 8118fa3 commit a052725

File tree

6 files changed

+90925
-3
lines changed

6 files changed

+90925
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: end-of-file-fixer
1010
exclude: '((libs|hal)/.*|\.(ts|tsx|css|html|json|md|yaml|yml|ipynb)$)'
1111
- id: check-added-large-files
12-
exclude: "(libs|hal)/.*"
12+
exclude: "(libs|hal)/.*|gs/backend/data/resources/callsigns\\.csv$"
1313
- repo: https://github.com/pre-commit/mirrors-clang-format
1414
rev: v17.0.6
1515
hooks:

gs/backend/api/lifespan.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from fastapi_cache.backends.inmemory import InMemoryBackend
77

88
from gs.backend.data.database.engine import get_db_session, setup_database
9-
from gs.backend.data.resources.utils import add_main_commands
9+
from gs.backend.data.resources.utils import add_callsigns, add_main_commands
1010

1111

1212
@asynccontextmanager
@@ -19,4 +19,5 @@ async def lifespan(_: FastAPI) -> AsyncGenerator[None, None]:
1919
# Otherwise, will get transaction is inactive error
2020
setup_database(get_db_session())
2121
add_main_commands(get_db_session())
22+
add_callsigns(get_db_session())
2223
yield

0 commit comments

Comments
 (0)