-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Describe your changes The logic for updating unavailability is simple. Updating any field in the unavailability with the matching fields in the payload. The most important part is the payload validation, the payload data is checked in the repository function and raise custom errors to catch later in the controller. Some features: - a user can only edit their own unavailability (this feature will be later discussed within the meeting to see if it should be applied for other API endpoints) - custom errors (EventNotFoundError, InvalidArgumentError) ## Issue ticket number and link
- Loading branch information
Showing
6 changed files
with
66 additions
and
34 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
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,2 @@ | ||
from .client_exception import EventNotFoundError, InvalidArgumentError | ||
|
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,20 @@ | ||
from .fireapp_exception import FireAppException | ||
|
||
|
||
class EventNotFoundError(FireAppException): | ||
def __init__(self, event_id, *args): | ||
super().__init__(f"Event not found", *args) | ||
self.event_id = event_id | ||
|
||
def __str__(self): | ||
# Optionally customize the string representation for this specific error | ||
return f"{self.message}: Event ID {self.event_id} could not be located." | ||
|
||
|
||
class InvalidArgumentError(FireAppException): | ||
def __init__(self, *args): | ||
super().__init__(f"Invalid argument(s)", *args) | ||
|
||
def __str__(self): | ||
# Optionally customize the string representation for this specific error | ||
return f"{self.message}: unexpected values in the payload" |
Empty file.
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,3 @@ | ||
class FireAppException(Exception): | ||
pass | ||
|
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