Shared plumbing for the admin HTTP layer.
Leaf namespace requiring no handler or route namespaces. Provides the
error mappings, query/form parsing, and handler helpers used by the handler
namespaces and the route definitions in boundary.admin.shell.http.
Shared plumbing for the admin HTTP layer. Leaf namespace requiring no handler or route namespaces. Provides the error mappings, query/form parsing, and handler helpers used by the handler namespaces and the route definitions in `boundary.admin.shell.http`.
Error type mappings for admin-specific errors.
Extends base error mappings with admin-specific error types:
Error type mappings for admin-specific errors. Extends base error mappings with admin-specific error types: - :table-not-found - Entity/table doesn't exist in database - :entity-not-allowed - Entity not in allowlist - :invalid-entity-data - Validation failed on entity data
(build-entity-detail-opts admin-service
schema-provider
entity-name
entity-config
record
request)Builds opts for entity-detail-page and the surrounding admin-layout. Shared between entity-detail-handler and update-entity-handler.
Returns a map with: :entities - all available entity names :entity-configs - map of entity-name -> entity-config :page-opts - opts map for entity-detail-page (related-records, return-to, parent-context, sibling-nav)
Builds opts for entity-detail-page and the surrounding admin-layout.
Shared between entity-detail-handler and update-entity-handler.
Returns a map with:
:entities - all available entity names
:entity-configs - map of entity-name -> entity-config
:page-opts - opts map for entity-detail-page
(related-records, return-to, parent-context, sibling-nav)Merged error mappings: base + admin-specific
Merged error mappings: base + admin-specific
(get-current-user request)Extract authenticated user from request.
The authentication middleware sets [:user {...}] with the full user entity (including :id, :role, :email, :name, etc.).
Args: request: Ring request map
Returns: Full user entity map, or nil if not authenticated
Extract authenticated user from request.
The authentication middleware sets [:user {...}] with the full user entity
(including :id, :role, :email, :name, etc.).
Args:
request: Ring request map
Returns:
Full user entity map, or nil if not authenticated(get-entity-id request)Extract entity ID from path parameters.
Args: request: Ring request map
Returns: Entity ID as UUID
Extract entity ID from path parameters. Args: request: Ring request map Returns: Entity ID as UUID
(get-entity-name request)Extract entity name from path parameters.
Args: request: Ring request map
Returns: Entity name as keyword
Extract entity name from path parameters. Args: request: Ring request map Returns: Entity name as keyword
(html-response request html)Create HTML response with standard headers, resolving [:t ...] i18n markers.
Args: request: Ring request map (used to extract :i18n/t translation function) html: Hiccup data structure or HTML string
Returns: Ring response map
Create HTML response with standard headers, resolving [:t ...] i18n markers. Args: request: Ring request map (used to extract :i18n/t translation function) html: Hiccup data structure or HTML string Returns: Ring response map
(htmx-fragment-response request html)Create HTMX fragment response, resolving [:t ...] i18n markers.
Args: request: Ring request map html: Hiccup data or HTML string
Returns: Ring response map with HTMX headers
Create HTMX fragment response, resolving [:t ...] i18n markers. Args: request: Ring request map html: Hiccup data or HTML string Returns: Ring response map with HTMX headers
(parse-advanced-filters params)Parse nested filter parameters from query string (Week 2).
Expected formats:
Args: params: Ring query-params map
Returns: Map of field-name -> filter-spec {:field-name {:op :operator :value val} :other-field {:op :between :min 10 :max 100}}
Example: (parse-advanced-filters {"filters[created-at][op]" "gte" "filters[created-at][value]" "2024-01-01"}) => {:created-at {:op :gte :value "2024-01-01"}}
Parse nested filter parameters from query string (Week 2).
Expected formats:
- filters[field][op]=operator
- filters[field][value]=single-value
- filters[field][values][]=multi-value-1
- filters[field][values][]=multi-value-2
- filters[field][min]=min-value
- filters[field][max]=max-value
Args:
params: Ring query-params map
Returns:
Map of field-name -> filter-spec
{:field-name {:op :operator :value val}
:other-field {:op :between :min 10 :max 100}}
Example:
(parse-advanced-filters {"filters[created-at][op]" "gte"
"filters[created-at][value]" "2024-01-01"})
=> {:created-at {:op :gte :value "2024-01-01"}}(parse-form-params params entity-config)Parse form parameters into entity data map.
Converts string form values to appropriate types based on field config.
Args: params: Ring form-params map (all string values) entity-config: Entity configuration with field metadata
Returns: Entity data map with typed values
Examples: (parse-form-params {name John active true} entity-config) => {:name John :active true}
(parse-form-params {price 19.99 quantity 5} entity-config) => {:price 19.99 :quantity 5}
Parse form parameters into entity data map.
Converts string form values to appropriate types based on field config.
Args:
params: Ring form-params map (all string values)
entity-config: Entity configuration with field metadata
Returns:
Entity data map with typed values
Examples:
(parse-form-params {name John active true} entity-config)
=> {:name John :active true}
(parse-form-params {price 19.99 quantity 5} entity-config)
=> {:price 19.99 :quantity 5}(parse-query-params params)Parse query parameters into admin service options.
Extracts and normalizes:
Args: params: Ring query-params map (all string values)
Returns: Options map with normalized keys and parsed values
Examples: (parse-query-params {page 2 page-size 25 search john}) => {:page 2 :page-size 25 :search john}
(parse-query-params {sort email sort-dir desc role admin}) => {:sort :email :sort-dir :desc :filters {:role admin}}
Parse query parameters into admin service options.
Extracts and normalizes:
- Pagination: page, page-size, limit, offset
- Sorting: sort, sort-dir
- Search: search (text search across search-fields)
- Filters: Any other params become field filters
Args:
params: Ring query-params map (all string values)
Returns:
Options map with normalized keys and parsed values
Examples:
(parse-query-params {page 2 page-size 25 search john})
=> {:page 2 :page-size 25 :search john}
(parse-query-params {sort email sort-dir desc role admin})
=> {:sort :email :sort-dir :desc :filters {:role admin}}(require-admin-user! request)Assert current user is an admin, throw if not.
Args: request: Ring request map
Returns: User entity map if admin
Throws: ExceptionInfo with :type :forbidden if not admin
Assert current user is an admin, throw if not. Args: request: Ring request map Returns: User entity map if admin Throws: ExceptionInfo with :type :forbidden if not admin
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |