Uh oh!
There was an error while loading. Please reload this page.
refactor: split buzz/api into domain packages - #304
Closed
github-actions[bot] wants to merge 1 commit into
Closed
Conversation
* refactor: split buzz/api into domain packages
buzz/api/__init__.py held 1364 lines covering booking, tickets,
sponsorships, check-in, account, campaigns and coupons in one module.
Since a Frappe endpoint's URL is its dotted module path, that layout also
made the public API surface unreadable.
Each domain now owns a package, so an endpoint's URL names its domain:
buzz.api.booking.process_booking rather than buzz.api.process_booking.
forms.py, auth.py and proposals.py become packages of the same shape.
Function bodies are unchanged; this is relocation only. Landed alongside
are api/schemas.py and api/exceptions.py, the pydantic and error base
classes later PRs build on, currently unused.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* refactor(dashboard): point API calls at the domain packages
Follows the backend split: every createResource url moves from
buzz.api.<fn> to buzz.api.<domain>.<fn>. String changes only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs: update ARCHITECTURE endpoint paths for the api split
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* feat(api): give BuzzAPIError class-defined user messages
The base error carried only http_status_code, so every call site still had
to pass its own message string and no default copy existed.
Subclasses now declare title and message as class attributes, raised via a
throw() classmethod:
class AlreadyRegistered(Conflict):
title = _lt("Already Registered")
message = _lt("You have already registered your interest.")
AlreadyRegistered.throw()
throw() routes through frappe.throw so the text lands in _server_messages,
which is what the dashboard reads as err.messages[0]. A bare raise skips
msgprint and leaves the user with "Internal Server Error" — covered by a
test so the distinction stays visible.
Messages use _lt rather than _ because class bodies run at import, before a
request has a language. frappe's translation extractor already scans _lt.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 66396ad)
This file contains hidden or 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
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated backport of #295 to
main.