Refactor contact handling across backend and frontend
Replaced usage of "ContactPerson" with "Contact" for consistency across the codebase. Updated related component props, state variables, API calls, and database queries to align with the new model. Also enhanced backend functionality with stricter validations and added support for handling active pgroups in contact management.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from app.models import (
|
||||
ContactPerson,
|
||||
Contact,
|
||||
Address,
|
||||
Dewar,
|
||||
Proposal,
|
||||
@ -34,71 +34,81 @@ serial_numbers = [
|
||||
|
||||
# Define contact persons
|
||||
contacts = [
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=1,
|
||||
pgroups="p20000, p20001",
|
||||
firstname="Frodo",
|
||||
lastname="Baggins",
|
||||
phone_number="123-456-7890",
|
||||
email="frodo.baggins@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=2,
|
||||
pgroups="p20000, p20002",
|
||||
firstname="Samwise",
|
||||
lastname="Gamgee",
|
||||
phone_number="987-654-3210",
|
||||
email="samwise.gamgee@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=3,
|
||||
pgroups="p20001, p20002",
|
||||
firstname="Aragorn",
|
||||
lastname="Elessar",
|
||||
phone_number="123-333-4444",
|
||||
email="aragorn.elessar@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=4,
|
||||
pgroups="p20003, p20004",
|
||||
firstname="Legolas",
|
||||
lastname="Greenleaf",
|
||||
phone_number="555-666-7777",
|
||||
email="legolas.greenleaf@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=5,
|
||||
pgroups="p20002, p20003",
|
||||
firstname="Gimli",
|
||||
lastname="Son of Gloin",
|
||||
phone_number="888-999-0000",
|
||||
email="gimli.sonofgloin@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=6,
|
||||
pgroups="p20001, p20002",
|
||||
firstname="Gandalf",
|
||||
lastname="The Grey",
|
||||
phone_number="222-333-4444",
|
||||
email="gandalf.thegrey@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=7,
|
||||
pgroups="p20000, p20004",
|
||||
firstname="Boromir",
|
||||
lastname="Son of Denethor",
|
||||
phone_number="111-222-3333",
|
||||
email="boromir.sonofdenethor@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=8,
|
||||
pgroups="p20001, p20002",
|
||||
firstname="Galadriel",
|
||||
lastname="Lady of Lothlórien",
|
||||
phone_number="444-555-6666",
|
||||
email="galadriel.lothlorien@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=9,
|
||||
pgroups="p20001, p20004",
|
||||
firstname="Elrond",
|
||||
lastname="Half-elven",
|
||||
phone_number="777-888-9999",
|
||||
email="elrond.halfelven@lotr.com",
|
||||
),
|
||||
ContactPerson(
|
||||
Contact(
|
||||
id=10,
|
||||
pgroups="p20004, p20006",
|
||||
firstname="Eowyn",
|
||||
lastname="Shieldmaiden of Rohan",
|
||||
phone_number="000-111-2222",
|
||||
@ -184,7 +194,7 @@ dewars = [
|
||||
dewar_serial_number_id=2,
|
||||
tracking_number="TRACK123",
|
||||
return_address_id=1,
|
||||
contact_person_id=1,
|
||||
contact_id=1,
|
||||
status="Ready for Shipping",
|
||||
ready_date=datetime.strptime("2023-09-30", "%Y-%m-%d"),
|
||||
shipping_date=None,
|
||||
@ -199,7 +209,7 @@ dewars = [
|
||||
dewar_serial_number_id=1,
|
||||
tracking_number="TRACK124",
|
||||
return_address_id=2,
|
||||
contact_person_id=2,
|
||||
contact_id=2,
|
||||
status="In Preparation",
|
||||
ready_date=None,
|
||||
shipping_date=None,
|
||||
@ -214,7 +224,7 @@ dewars = [
|
||||
dewar_serial_number_id=3,
|
||||
tracking_number="TRACK125",
|
||||
return_address_id=1,
|
||||
contact_person_id=3,
|
||||
contact_id=3,
|
||||
status="Not Shipped",
|
||||
ready_date=datetime.strptime("2024-01-01", "%Y-%m-%d"),
|
||||
shipping_date=None,
|
||||
@ -229,7 +239,7 @@ dewars = [
|
||||
dewar_serial_number_id=4,
|
||||
tracking_number="",
|
||||
return_address_id=1,
|
||||
contact_person_id=3,
|
||||
contact_id=3,
|
||||
status="Delayed",
|
||||
ready_date=datetime.strptime("2024-01-01", "%Y-%m-%d"),
|
||||
shipping_date=datetime.strptime("2024-01-02", "%Y-%m-%d"),
|
||||
@ -244,7 +254,7 @@ dewars = [
|
||||
dewar_serial_number_id=1,
|
||||
tracking_number="",
|
||||
return_address_id=1,
|
||||
contact_person_id=3,
|
||||
contact_id=3,
|
||||
status="Returned",
|
||||
arrival_date=datetime.strptime("2024-01-03", "%Y-%m-%d"),
|
||||
returning_date=datetime.strptime("2024-01-07", "%Y-%m-%d"),
|
||||
@ -277,7 +287,7 @@ shipments = [
|
||||
shipment_date=datetime.strptime("2024-10-10", "%Y-%m-%d"),
|
||||
shipment_name="Shipment from Mordor",
|
||||
shipment_status="Delivered",
|
||||
contact_person_id=2,
|
||||
contact_id=2,
|
||||
proposal_id=3,
|
||||
return_address_id=1,
|
||||
comments="Handle with care",
|
||||
@ -288,7 +298,7 @@ shipments = [
|
||||
shipment_date=datetime.strptime("2024-10-24", "%Y-%m-%d"),
|
||||
shipment_name="Shipment from Mordor",
|
||||
shipment_status="In Transit",
|
||||
contact_person_id=4,
|
||||
contact_id=4,
|
||||
proposal_id=4,
|
||||
return_address_id=2,
|
||||
comments="Contains the one ring",
|
||||
@ -299,7 +309,7 @@ shipments = [
|
||||
shipment_date=datetime.strptime("2024-10-28", "%Y-%m-%d"),
|
||||
shipment_name="Shipment from Mordor",
|
||||
shipment_status="In Transit",
|
||||
contact_person_id=5,
|
||||
contact_id=5,
|
||||
proposal_id=5,
|
||||
return_address_id=1,
|
||||
comments="Contains the one ring",
|
||||
|
Reference in New Issue
Block a user