asobi_ops_chat (asobi v0.84.0)

View Source

Chat reads for the ops plane: the live channel list, and one channel's messages.

Two different sources, and they answer two different questions. The channel list is process state - which rooms exist right now and how many players are in them - so it is sorted and paged in memory like the matchmaker queue. The message history is in Postgres and is paged by the database like every other list here, because moderation means reading past the last screenful.

Searching message content is the reason this endpoint exists rather than a raw LIMIT: an operator acting on a report needs to find one message, and the console this replaces could only offer the newest fifty.

Summary

Functions

The live channel rows and the order to page them in.

Wire-name to column mapping the channel list accepts in ?sort=.

One channel's persisted messages as an ordered query for the shared paginator.

Wire-name to column mapping the message list accepts in ?sort=.

Positive allowlist of the fields a channel row may carry off this endpoint.

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

Functions

channels(Params)

-spec channels(asobi_ops_params:params()) ->
                  {ok, {[map()], asobi_ops_params:sort_spec()}} |
                  {error, {unknown_sort, binary()} | {unknown_order, binary()}}.

The live channel rows and the order to page them in.

Busiest first, since a channel with two hundred people in it is the one an operator is being asked about. channel_id is unique across the rows and ends the order, so the offset window cannot repeat one.

channels_sortable()

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

Wire-name to column mapping the channel list accepts in ?sort=.

messages_query(ChannelId, Params)

-spec messages_query(binary(), 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()}}.

One channel's persisted messages as an ordered query for the shared paginator.

messages_sortable()

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

Wire-name to column mapping the message list accepts in ?sort=.

project_channel(Channel)

-spec project_channel(map()) -> map().

Positive allowlist of the fields a channel row may carry off this endpoint.

project_message(Message)

-spec project_message(map()) -> map().

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

content stays: a moderation screen that cannot show what was said is not one. metadata is game-authored and does not leave, the same rule asobi_ops_matches applies to a match record.