Skip to content

Commit

Permalink
Merge pull request #44 from jadmsaadaot/SUBMIT-task#29-C
Browse files Browse the repository at this point in the history
Add ea certificate to Project model
  • Loading branch information
jadmsaadaot authored Aug 26, 2024
2 parents 9574df4 + 7794757 commit d749b34
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 9 deletions.
5 changes: 3 additions & 2 deletions submit-api/migrations/versions/0eabfcf062e3_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
Create Date: 2024-08-22 12:20:35.863982
"""
from alembic import op
import sqlalchemy as sa
from datetime import datetime

import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = '0eabfcf062e3'
Expand Down
32 changes: 32 additions & 0 deletions submit-api/migrations/versions/41e672288201_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Add EA certificate column
Revision ID: 41e672288201
Revises: 646de6f8c38b
Create Date: 2024-08-23 16:01:10.236907
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '41e672288201'
down_revision = '646de6f8c38b'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('projects', schema=None) as batch_op:
batch_op.add_column(sa.Column('ea_certificate', sa.String(length=255), nullable=True))

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('projects', schema=None) as batch_op:
batch_op.drop_column('ea_certificate')

# ### end Alembic commands ###
3 changes: 2 additions & 1 deletion submit-api/migrations/versions/646de6f8c38b_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
Create Date: 2024-08-23 11:32:52.949718
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql


# revision identifiers, used by Alembic.
revision = '646de6f8c38b'
down_revision = '0eabfcf062e3'
Expand Down
2 changes: 1 addition & 1 deletion submit-api/migrations/versions/b573a1a7347f_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Create Date: 2024-08-22 12:13:06.001628
"""
from alembic import op
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
Expand Down
2 changes: 1 addition & 1 deletion submit-api/migrations/versions/b79603b76ea0_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Create Date: 2024-08-20 15:17:44.896108
"""
from alembic import op
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
Expand Down
2 changes: 1 addition & 1 deletion submit-api/src/submit_api/models/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import enum

from sqlalchemy import Column, ForeignKey, Enum
from sqlalchemy import Column, Enum, ForeignKey

from .base_model import BaseModel
from .db import db
Expand Down
2 changes: 1 addition & 1 deletion submit-api/src/submit_api/models/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import enum

from sqlalchemy import Column, ForeignKey, Enum
from sqlalchemy import Column, Enum, ForeignKey

from .base_model import BaseModel
from .db import db
Expand Down
1 change: 1 addition & 0 deletions submit-api/src/submit_api/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Project(db.Model):
name = Column(db.String(), nullable=False)
proponent_id = Column(db.Integer(), nullable=False, unique=True)
proponent_name = Column(db.String(), nullable=False)
ea_certificate = Column(db.String(255), nullable=True, default=None)

def __init__(self, **kwargs):
"""Initialize the Project entity."""
Expand Down
1 change: 1 addition & 0 deletions submit-api/src/submit_api/schemas/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Meta: # pylint: disable=too-few-public-methods
name = fields.Str(data_key="name")
proponent_id = fields.Int(data_key="proponent_id")
proponent_name = fields.Str(data_key="proponent_name")
ea_certificate = fields.Str(data_key="ea_certificate")


class AddProjectSchema(Schema):
Expand Down
6 changes: 4 additions & 2 deletions submit-web/src/components/Projects/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const Project = ({ accountProject }: ProjectParam) => {
(subPackage) => subPackage.status !== PACKAGE_STATUS.IN_REVIEW.value,
);

const { name, ea_certificate } = accountProject.project;

return (
<Paper
sx={{
Expand All @@ -55,7 +57,7 @@ export const Project = ({ accountProject }: ProjectParam) => {
px={2}
color={BCDesignTokens.typographyColorPrimary}
>
{accountProject.project.name}
{name}
</Typography>
<Typography
variant="h4"
Expand All @@ -65,7 +67,7 @@ export const Project = ({ accountProject }: ProjectParam) => {
fontWeight: 400,
}}
>
EAC #1234567
{ea_certificate ? `EAC #${ea_certificate}` : ""}
</Typography>
</Box>

Expand Down

0 comments on commit d749b34

Please sign in to comment.