mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat(accountStatusesController): query for media faster
This commit is contained in:
parent
b037be44a4
commit
c3966be65b
1 changed files with 6 additions and 1 deletions
|
|
@ -197,12 +197,13 @@ const accountStatusesQuerySchema = z.object({
|
|||
limit: z.coerce.number().nonnegative().transform((v) => Math.min(v, 40)).catch(20),
|
||||
exclude_replies: booleanParamSchema.optional(),
|
||||
tagged: z.string().optional(),
|
||||
only_media: z.coerce.boolean().catch(false),
|
||||
});
|
||||
|
||||
const accountStatusesController: AppController = async (c) => {
|
||||
const pubkey = c.req.param('pubkey');
|
||||
const { since, until } = c.get('pagination');
|
||||
const { pinned, limit, exclude_replies, tagged } = accountStatusesQuerySchema.parse(c.req.query());
|
||||
const { pinned, limit, exclude_replies, tagged, only_media } = accountStatusesQuerySchema.parse(c.req.query());
|
||||
const { signal } = c.req.raw;
|
||||
|
||||
const store = await Storages.db();
|
||||
|
|
@ -240,6 +241,10 @@ const accountStatusesController: AppController = async (c) => {
|
|||
limit,
|
||||
};
|
||||
|
||||
if (only_media) {
|
||||
filter.search = 'only_media:true';
|
||||
}
|
||||
|
||||
if (tagged) {
|
||||
filter['#t'] = [tagged];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue