From 0bee46d3314fe8c9f394d884b142710a6b30293e Mon Sep 17 00:00:00 2001 From: "Michael J. Roberts" Date: Thu, 2 Feb 2023 14:19:48 +0000 Subject: [PATCH] feat: Added { ..., a } (semi-major axis) field to Body model. feat: Added { ..., a } (semi-major axis) field to Body model. Includes associated updates to BodyBase and BodyCreate schema. Includes updating alembic migrations for "feat: Added Body model (e.g., Star, Galaxy, Nebulae etc.)". --- ...4ae9a6_feat_added_body_model_e_g_star_galaxy_.py} | 7 ++++--- app/models/body.py | 12 ++++++++++++ app/schemas/body.py | 7 +++++++ 3 files changed, 23 insertions(+), 3 deletions(-) rename alembic/versions/{f8d61d72ba0e_feat_added_body_model_e_g_star_galaxy_.py => a7e7624ae9a6_feat_added_body_model_e_g_star_galaxy_.py} (94%) diff --git a/alembic/versions/f8d61d72ba0e_feat_added_body_model_e_g_star_galaxy_.py b/alembic/versions/a7e7624ae9a6_feat_added_body_model_e_g_star_galaxy_.py similarity index 94% rename from alembic/versions/f8d61d72ba0e_feat_added_body_model_e_g_star_galaxy_.py rename to alembic/versions/a7e7624ae9a6_feat_added_body_model_e_g_star_galaxy_.py index a13baf0..41e6add 100644 --- a/alembic/versions/f8d61d72ba0e_feat_added_body_model_e_g_star_galaxy_.py +++ b/alembic/versions/a7e7624ae9a6_feat_added_body_model_e_g_star_galaxy_.py @@ -1,8 +1,8 @@ """feat: Added Body model (e.g., Star, Galaxy, Nebulae etc.) -Revision ID: f8d61d72ba0e +Revision ID: a7e7624ae9a6 Revises: -Create Date: 2023-02-02 13:29:06.339028 +Create Date: 2023-02-02 14:16:08.403149 """ from alembic import op @@ -10,7 +10,7 @@ # revision identifiers, used by Alembic. -revision = 'f8d61d72ba0e' +revision = 'a7e7624ae9a6' down_revision = None branch_labels = None depends_on = None @@ -38,6 +38,7 @@ def upgrade(): sa.Column('ngc', sa.String(length=12), nullable=True, comment='New General Catalogue (NGC) Number'), sa.Column('ic', sa.String(length=12), nullable=True, comment='Indexed Catalogue (IC) Number'), sa.Column('eccentricity', sa.Float(precision=5, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Eccentricity (e)'), + sa.Column('semi_major_axis', sa.Float(precision=5, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Semi-major axis (a)'), sa.Column('simbad', sa.String(length=200), nullable=True, comment='SIMBAD Search Query URL'), sa.PrimaryKeyConstraint('uid') ) diff --git a/app/models/body.py b/app/models/body.py index 885b7ba..fb6344e 100644 --- a/app/models/body.py +++ b/app/models/body.py @@ -285,6 +285,18 @@ class Body(Base): comment="Eccentricity (e)", ) + # The Body's Semi-major axis (arcminutes): + a = Column( + Float( + precision=5, + asdecimal=True, + decimal_return_scale=10, + ), + index=False, + name="semi_major_axis", + comment="Semi-major axis (a)", + ) + # SIMBAD Search Query URL simbad = Column( String( diff --git a/app/schemas/body.py b/app/schemas/body.py index e58a2d9..a43fa39 100644 --- a/app/schemas/body.py +++ b/app/schemas/body.py @@ -129,6 +129,11 @@ class BodyBase(BaseModel): title="Eccentricity", description="The eccentricity of the astronomical object (unitless)", ) + a: Optional[float] = Field( + None, + title="Semi-major Axis", + description="The semi-major axis of the astronomical object in arcminutes", + ) # SIMBAD Query URL: simbad: Optional[str] = Field( None, @@ -196,6 +201,8 @@ class BodyCreate(BaseModel): ic: Optional[str] = None # Eccentricity: e: Optional[float] = None + # Semi-major Axis: + a: Optional[float] = None # SIMBAD simbad: Optional[str] = None