Skip to content
Snippets Groups Projects
Commit 55bf6bab authored by Mohammad Torkashvand's avatar Mohammad Torkashvand
Browse files

resolve review notes

parent 67d1e814
No related branches found
No related tags found
1 merge request!176added partner model
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import csv import csv
import ipaddress import ipaddress
import json import json
from datetime import datetime, UTC from datetime import UTC, datetime
from pathlib import Path from pathlib import Path
from typing import TypeVar from typing import TypeVar
...@@ -216,7 +216,7 @@ def import_partners(file_path: str = typer.Argument(..., help="Path to the CSV f ...@@ -216,7 +216,7 @@ def import_partners(file_path: str = typer.Argument(..., help="Path to the CSV f
"""Import partners from a CSV file into the database.""" """Import partners from a CSV file into the database."""
typer.echo(f"Importing partners from {file_path} ...") typer.echo(f"Importing partners from {file_path} ...")
partners = import_partners_from_csv(file_path) partners = import_partners_from_csv(Path(file_path))
try: try:
for partner in partners: for partner in partners:
......
"""Partner schema module.""" """It is used to group the schema files together as a package."""
...@@ -47,6 +47,8 @@ def create_partner( ...@@ -47,6 +47,8 @@ def create_partner(
except SQLAlchemyError: except SQLAlchemyError:
db.session.rollback() db.session.rollback()
raise raise
finally:
db.session.close()
def delete_partner_by_name(name: str) -> None: def delete_partner_by_name(name: str) -> None:
...@@ -61,3 +63,5 @@ def delete_partner_by_name(name: str) -> None: ...@@ -61,3 +63,5 @@ def delete_partner_by_name(name: str) -> None:
except SQLAlchemyError: except SQLAlchemyError:
db.session.rollback() db.session.rollback()
raise raise
finally:
db.session.close()
...@@ -257,7 +257,8 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant ...@@ -257,7 +257,8 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant
iptrunk_side_b = iptrunk_side_subscription_factory() iptrunk_side_b = iptrunk_side_subscription_factory()
iptrunk_sides = iptrunk_sides or [iptrunk_side_a, iptrunk_side_b] iptrunk_sides = iptrunk_sides or [iptrunk_side_a, iptrunk_side_b]
iptrunk_subscription = IptrunkInactive.from_product_id(product_id, customer_id=partner["partner_id"], insync=True) iptrunk_subscription = IptrunkInactive.from_product_id(
product_id, customer_id=partner["partner_id"], insync=True)
iptrunk_subscription.iptrunk.geant_s_sid = geant_s_sid iptrunk_subscription.iptrunk.geant_s_sid = geant_s_sid
iptrunk_subscription.iptrunk.iptrunk_description = iptrunk_description iptrunk_subscription.iptrunk.iptrunk_description = iptrunk_description
iptrunk_subscription.iptrunk.iptrunk_type = iptrunk_type iptrunk_subscription.iptrunk.iptrunk_type = iptrunk_type
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment