stats: Make sent_data_schema specifically expect human and bot keys.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-29 21:46:12 -07:00 committed by Tim Abbott
parent 7b51a89847
commit 27a993a504
1 changed files with 11 additions and 2 deletions

View File

@ -79,10 +79,19 @@ const read_data_schema = instantiate_type_DataByEveryoneUser(
z.object({read: z.array(z.number())}),
).extend({...common_data_schema.shape});
const sent_data_schema = instantiate_type_DataByEveryoneUser(z.record(z.array(z.number()))).extend({
const sent_data_schema = instantiate_type_DataByEveryoneUser(
z.object({
human: z.array(z.number()),
bot: z.array(z.number()),
}),
).extend({...common_data_schema.shape});
const ordered_sent_data_schema = instantiate_type_DataByEveryoneUser(
z.record(z.array(z.number())),
).extend({
...common_data_schema.shape,
display_order: z.array(z.string()),
});
const ordered_sent_data_schema = sent_data_schema.extend({display_order: z.array(z.string())});
const user_count_data_schema = z
.object({everyone: active_user_data})