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

feat: Added { ..., a } (semi-major axis) field to Body model. #79

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""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
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f8d61d72ba0e'
revision = 'a7e7624ae9a6'
down_revision = None
branch_labels = None
depends_on = None
Expand Down Expand Up @@ -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')
)
Expand Down
12 changes: 12 additions & 0 deletions app/models/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions app/schemas/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down