asobi_ops_economy (asobi v0.72.6)

View Source

Economy reads for the ops plane: the item catalogue, and the store listings.

/economy/listings is the endpoint the integration plan singles out. The console query it replaces had no ORDER BY at all, so Postgres was free to return the rows in whatever order the plan produced them and offset paging over that can repeat one row while skipping another - a store the operator scrolls past without ever seeing the listing they went looking for. Both orders here end on id.

store_listings carries no inserted_at, so the default order is id descending rather than a timestamp. That is still newest-first: ids are UUIDv7 and their high bits are a millisecond clock (asobi_id).

Summary

Functions

Wire-name to column mapping the item catalogue accepts in ?sort=.

Wire-name to column mapping the store listings accept in ?sort=.

Positive allowlist of the fields an item definition may carry off this endpoint.

Positive allowlist of the fields a store listing may carry off this endpoint.

Functions

items_query(Params)

-spec items_query(asobi_ops_params:params()) ->
                     {ok,
                      #kura_query{from :: atom() | module() | undefined,
                                  select :: [atom() | term()] | {exprs, [term()]},
                                  wheres :: [term()],
                                  joins :: [term()],
                                  order_bys :: [term()],
                                  group_bys :: [atom()],
                                  havings :: [term()],
                                  limit :: non_neg_integer() | undefined,
                                  offset :: non_neg_integer() | undefined,
                                  distinct :: boolean() | [atom()],
                                  lock :: binary() | undefined,
                                  prefix :: binary() | undefined,
                                  preloads :: [atom() | {atom(), list()}],
                                  ctes :: [{binary(), #kura_query{}}],
                                  combinations ::
                                      [{union | union_all | intersect | except, #kura_query{}}],
                                  include_deleted :: boolean()}} |
                     {error,
                      {unknown_sort, binary()} | {unknown_order, binary()} | {invalid_filter, binary()}}.

items_sortable()

-spec items_sortable() -> asobi_ops_params:sort_allowlist().

Wire-name to column mapping the item catalogue accepts in ?sort=.

listings_query(Params)

-spec listings_query(asobi_ops_params:params()) ->
                        {ok,
                         #kura_query{from :: atom() | module() | undefined,
                                     select :: [atom() | term()] | {exprs, [term()]},
                                     wheres :: [term()],
                                     joins :: [term()],
                                     order_bys :: [term()],
                                     group_bys :: [atom()],
                                     havings :: [term()],
                                     limit :: non_neg_integer() | undefined,
                                     offset :: non_neg_integer() | undefined,
                                     distinct :: boolean() | [atom()],
                                     lock :: binary() | undefined,
                                     prefix :: binary() | undefined,
                                     preloads :: [atom() | {atom(), list()}],
                                     ctes :: [{binary(), #kura_query{}}],
                                     combinations ::
                                         [{union | union_all | intersect | except, #kura_query{}}],
                                     include_deleted :: boolean()}} |
                        {error,
                         {unknown_sort, binary()} |
                         {unknown_order, binary()} |
                         {invalid_filter, binary()}}.

listings_sortable()

-spec listings_sortable() -> asobi_ops_params:sort_allowlist().

Wire-name to column mapping the store listings accept in ?sort=.

project_item(Item)

-spec project_item(map()) -> map().

Positive allowlist of the fields an item definition may carry off this endpoint.

metadata stays. On an item definition it is the operator-authored half of the catalogue - icons, tuning, whatever the game reads - and an economy screen that cannot show it cannot tell two items apart.

project_listing(Listing)

-spec project_listing(map()) -> map().

Positive allowlist of the fields a store listing may carry off this endpoint.