mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Updated factory to return instantiated class
This commit is contained in:
parent
c34ed0bbe0
commit
bf34393ceb
2 changed files with 4 additions and 4 deletions
|
|
@ -3,8 +3,8 @@ from onboarders.parity import ParityOnboarder
|
|||
|
||||
class OnboarderFactory:
|
||||
@staticmethod
|
||||
def create_onboarder(onboarder_type):
|
||||
def create_onboarder(onboarder_type, **kwargs):
|
||||
if onboarder_type == "parity":
|
||||
return ParityOnboarder
|
||||
return ParityOnboarder(**kwargs)
|
||||
|
||||
raise ValueError(f"Unknown onboarder type: {onboarder_type}")
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ def handler(event, context):
|
|||
logger.info("Processing record with body: %s", event_body)
|
||||
|
||||
validated_event = OnboardingEvent(**event_body)
|
||||
Onboarder = OnboarderFactory.create_onboarder(validated_event.system)
|
||||
onboarder = Onboarder(
|
||||
onboarder = OnboarderFactory.create_onboarder(
|
||||
validated_event.system,
|
||||
fileuri=validated_event.s3_uri,
|
||||
format=validated_event.format,
|
||||
sheet_name=validated_event.sheet_name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue