-
Notifications
You must be signed in to change notification settings - Fork 8
Adds organisation API support #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
e6b71b8
0e22d10
f11dda2
819ebc8
bbb6e4d
1a49a6d
a3bcdec
c79a15e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,16 @@ | |
| ] | ||
|
|
||
|
|
||
| def feature_required(feature_flag): | ||
| def decorator(cls): | ||
| if feature_flag == "organisations": | ||
| return cls | ||
| else: | ||
| raise ImportError(f"Feature '{feature_flag}' is not enabled") | ||
|
|
||
| return decorator | ||
|
Comment on lines
+15
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the The current implementation of the Consider modifying the decorator to check a global settings object or configuration that maintains the status of feature flags. For example: def feature_required(feature_flag):
def decorator(cls):
- if feature_flag:
+ if settings.FEATURE_FLAGS.get(feature_flag, False):
return cls
else:
raise ImportError(f"Feature '{feature_flag}' is not enabled")
return decoratorEnsure that you import the
|
||
|
|
||
|
|
||
| class FrozenBaseSchema(BaseModel): | ||
| model_config = ConfigDict( | ||
| alias_generator=to_camel, | ||
|
|
@@ -91,3 +101,61 @@ class StartAuth(FrozenBaseSchema): | |
| rfid_format: str | ||
| rfid: str | ||
| external_transaction_id: str | ||
|
|
||
|
|
||
| class RfidTag(FrozenBaseSchema): | ||
| active: bool | ||
| rfid: str | None | ||
| rfidDec: str | None | ||
| rfidDecReverse: str | None | ||
|
|
||
|
|
||
| class User(FrozenBaseSchema): | ||
| id: str | ||
| first_name: str | None | ||
| last_name: str | None | ||
| email: str | None | ||
| mobile: str | None | ||
| rfid_tags: list[RfidTag] | None | ||
| user_status: str | ||
|
|
||
|
|
||
| class Partner(FrozenBaseSchema): | ||
| id: int | ||
| name: str | ||
| description: str | ||
| email: str | ||
| phone: str | ||
|
|
||
|
|
||
| # Only way to register new RFID seems to be through an Organization | ||
| @feature_required("organisations") | ||
| class Rfid(FrozenBaseSchema): | ||
| rfid: str | None | ||
| rfidDec: str | None | ||
| rfidDecReverse: str | None | ||
|
|
||
|
|
||
| @feature_required("organisations") | ||
| class Organisation(FrozenBaseSchema): | ||
| id: str | ||
| name: str | ||
| description: str | ||
|
|
||
|
|
||
| @feature_required("organisations") | ||
| class OrganisationChargingSession(FrozenBaseSchema): | ||
| id: int | ||
| charge_point_id: str | None | ||
| connector_id: int | ||
| user_id: str | ||
| rfid: str | None | ||
| rfidDec: str | None | ||
| rfidDecReverse: str | None | ||
| organisation_id: str | None | ||
| session_type: str | ||
| start_time: CustomDateTime | None = None | ||
| end_time: CustomDateTime | None = None | ||
| external_transaction_id: str | None | ||
| total_consumption_kwh: float | ||
| external_id: str | None | ||
Uh oh!
There was an error while loading. Please reload this page.