-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[To Main] Tenant CRUD implementation (#2524)
* [To Feature Branch] - DESENG-605 - Tenant backend api (#2508) * DESENG-605: Tenant API and Unit test * DESENG-605 - Add Tenant - Frontend UI (#2510) * DESENG-605 - Tenant detail page (#2511) * DESENG-605: Tenant API and Unit test * DESENG-605: Tenant detail page * DESENG-606: Add tenant edit page (#2513) * DESENG-605: Delete tenant flow * DESENG-605 - Delete tenant functionality (#2515) * DESENG-605 - Adding Unit test (#2518) * DESENG-605: Tenant unit test for listing and detail * Multi tenancy - UX Pass 1 (#2519) * DESENG-605-606-unit-tests (#2522) * Frontend unit tests * Update changelog --------- Co-authored-by: Ratheesh kumar R <ratheesh.kumar@aot-technologies.com>
- Loading branch information
1 parent
4993462
commit 0959d82
Showing
51 changed files
with
3,228 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
met-api/migrations/versions/2c2ce3421cd6_tenant_table_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""Tenant table update | ||
Revision ID: 2c2ce3421cd6 | ||
Revises: 1407e0ad88f6 | ||
Create Date: 2024-05-14 11:45:22.800840 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '2c2ce3421cd6' | ||
down_revision = '5388f257abfb' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('tenant', sa.Column('contact_name', sa.String(length=50), nullable=True, comment='Name of the primary contact')) | ||
op.add_column('tenant', sa.Column('contact_email', sa.String(length=255), nullable=True, comment='Email of the primary contact')) | ||
op.add_column('tenant', sa.Column('logo_credit', sa.String(length=60), nullable=True, comment='Hero banner image credit')) | ||
op.add_column('tenant', sa.Column('logo_description', sa.String(length=80), nullable=True, comment='Hero banner image description')) | ||
# Set the default values for existing rows | ||
op.execute('UPDATE tenant SET contact_name = \'Default Contact Name\' WHERE contact_name IS NULL') | ||
op.execute('UPDATE tenant SET contact_email = \'default@example.com\' WHERE contact_email IS NULL') | ||
# Remove server_default after setting the default values | ||
# future inserts into the table do not use these default values | ||
op.alter_column('tenant', 'contact_name', server_default=None) | ||
op.alter_column('tenant', 'contact_email', server_default=None) | ||
# Alter the columns to set them as NOT NULL | ||
op.alter_column('tenant', 'contact_name', nullable=False) | ||
op.alter_column('tenant', 'contact_email', nullable=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('tenant', 'logo_description') | ||
op.drop_column('tenant', 'logo_credit') | ||
op.drop_column('tenant', 'contact_email') | ||
op.drop_column('tenant', 'contact_name') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""add unique constraint to tenant short_name | ||
Revision ID: ae232e299180 | ||
Revises: 2c2ce3421cd6 | ||
Create Date: 2024-05-17 15:41:52.346746 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'ae232e299180' | ||
down_revision = '2c2ce3421cd6' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_unique_constraint(None, 'tenant', ['short_name']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, 'tenant', type_='unique') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema", | ||
"$id": "https://met.gov.bc.ca/.well_known/schemas/tenant", | ||
"type": "object", | ||
"title": "Tenant Schema", | ||
"description": "The schema for a tenant.", | ||
"default": {}, | ||
"examples": [ | ||
{ | ||
"short_name": "GDX", | ||
"name": "Government Digital Experience", | ||
"contact_name": "John Doe", | ||
"contact_email": "john.doe@gov.bc.ca", | ||
"title": "Modern Engagement", | ||
"description": "Responsible for digital experience projects.", | ||
"logo_url": "https://example.com/logo.png", | ||
"logo_credit": "Logo by Example", | ||
"logo_description": "Official logo of the Government Digital Experience." | ||
} | ||
], | ||
"required": ["short_name", "contact_name", "contact_email", "title"], | ||
"properties": { | ||
"id": { | ||
"$id": "#/properties/id", | ||
"type": "integer", | ||
"title": "Tenant ID", | ||
"description": "The unique identifier for the tenant.", | ||
"examples": [1] | ||
}, | ||
"short_name": { | ||
"$id": "#/properties/short_name", | ||
"type": "string", | ||
"title": "Short Name", | ||
"description": "A small code for the tenant, e.g., GDX, EAO.", | ||
"examples": ["GDX"] | ||
}, | ||
"name": { | ||
"$id": "#/properties/name", | ||
"type": "string", | ||
"title": "Full Name", | ||
"description": "Full name of the tenant or ministry, e.g., Government Digital Experience.", | ||
"examples": ["Government Digital Experience"] | ||
}, | ||
"contact_name": { | ||
"$id": "#/properties/contact_name", | ||
"type": "string", | ||
"title": "Contact Name", | ||
"description": "Name of the primary contact.", | ||
"examples": ["John Doe"] | ||
}, | ||
"contact_email": { | ||
"$id": "#/properties/contact_email", | ||
"type": "string", | ||
"title": "Contact Email", | ||
"description": "Email of the primary contact.", | ||
"examples": ["john.doe@gov.bc.ca"] | ||
}, | ||
"title": { | ||
"$id": "#/properties/title", | ||
"type": "string", | ||
"title": "Title", | ||
"description": "Title of the tenant's website.", | ||
"examples": ["Modern Engagement"] | ||
}, | ||
"description": { | ||
"$id": "#/properties/description", | ||
"type": "string", | ||
"title": "Description", | ||
"description": "A brief description of the tenant.", | ||
"examples": ["Responsible for digital experience projects."] | ||
}, | ||
"logo_url": { | ||
"$id": "#/properties/logo_url", | ||
"type": "string", | ||
"title": "Logo URL", | ||
"description": "URL to the tenant's logo.", | ||
"examples": ["https://example.com/logo.png"] | ||
}, | ||
"logo_credit": { | ||
"$id": "#/properties/logo_credit", | ||
"type": "string", | ||
"title": "Logo Credit", | ||
"description": "Credit for the logo image.", | ||
"examples": ["Logo by Example"] | ||
}, | ||
"logo_description": { | ||
"$id": "#/properties/logo_description", | ||
"type": "string", | ||
"title": "Logo Description", | ||
"description": "Description of the logo image.", | ||
"examples": ["Official logo of the Government Digital Experience."] | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.