mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Remove old paginationSchema
This commit is contained in:
parent
979f2cffb4
commit
6f1312b67f
6 changed files with 6 additions and 24 deletions
|
|
@ -72,8 +72,8 @@ const verifyCredentialsController: AppController = async (c) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const account = author
|
const account = author
|
||||||
? await renderAccount(author, { withSource: true, settingsStore })
|
? renderAccount(author, { withSource: true, settingsStore })
|
||||||
: await accountFromPubkey(pubkey, { withSource: true, settingsStore });
|
: accountFromPubkey(pubkey, { withSource: true, settingsStore });
|
||||||
|
|
||||||
return c.json(account);
|
return c.json(account);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { HTTPException } from '@hono/hono/http-exception';
|
import { HTTPException } from '@hono/hono/http-exception';
|
||||||
import { paginated, paginatedList } from '@ditto/mastoapi/pagination';
|
import { paginated, paginatedList, paginationSchema } from '@ditto/mastoapi/pagination';
|
||||||
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
|
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
|
||||||
import 'linkify-plugin-hashtag';
|
import 'linkify-plugin-hashtag';
|
||||||
import linkify from 'linkifyjs';
|
import linkify from 'linkifyjs';
|
||||||
|
|
@ -10,7 +10,6 @@ import { type AppController } from '@/app.ts';
|
||||||
import { DittoUpload, dittoUploads } from '@/DittoUploads.ts';
|
import { DittoUpload, dittoUploads } from '@/DittoUploads.ts';
|
||||||
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
|
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||||
import { getAncestors, getAuthor, getDescendants, getEvent } from '@/queries.ts';
|
import { getAncestors, getAuthor, getDescendants, getEvent } from '@/queries.ts';
|
||||||
import { paginationSchema } from '@/schemas/pagination.ts';
|
|
||||||
import { addTag, deleteTag } from '@/utils/tags.ts';
|
import { addTag, deleteTag } from '@/utils/tags.ts';
|
||||||
import { asyncReplaceAll } from '@/utils/text.ts';
|
import { asyncReplaceAll } from '@/utils/text.ts';
|
||||||
import { lookupPubkey } from '@/utils/lookup.ts';
|
import { lookupPubkey } from '@/utils/lookup.ts';
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import { paginated, paginatedList } from '@ditto/mastoapi/pagination';
|
import { paginated, paginatedList, paginationSchema } from '@ditto/mastoapi/pagination';
|
||||||
import { NostrFilter } from '@nostrify/nostrify';
|
import { NostrFilter } from '@nostrify/nostrify';
|
||||||
import { matchFilter } from 'nostr-tools';
|
import { matchFilter } from 'nostr-tools';
|
||||||
|
|
||||||
import { AppContext, AppController } from '@/app.ts';
|
import { AppContext, AppController } from '@/app.ts';
|
||||||
import { paginationSchema } from '@/schemas/pagination.ts';
|
|
||||||
import { hydrateEvents } from '@/storages/hydrate.ts';
|
import { hydrateEvents } from '@/storages/hydrate.ts';
|
||||||
import { getTagSet } from '@/utils/tags.ts';
|
import { getTagSet } from '@/utils/tags.ts';
|
||||||
import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts';
|
import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts';
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import { type DittoConf } from '@ditto/conf';
|
import { type DittoConf } from '@ditto/conf';
|
||||||
import { paginated } from '@ditto/mastoapi/pagination';
|
import { paginated, paginationSchema } from '@ditto/mastoapi/pagination';
|
||||||
import { NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify';
|
import { NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify';
|
||||||
import { logi } from '@soapbox/logi';
|
import { logi } from '@soapbox/logi';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { AppController } from '@/app.ts';
|
import { AppController } from '@/app.ts';
|
||||||
import { paginationSchema } from '@/schemas/pagination.ts';
|
|
||||||
import { hydrateEvents } from '@/storages/hydrate.ts';
|
import { hydrateEvents } from '@/storages/hydrate.ts';
|
||||||
import { generateDateRange, Time } from '@/utils/time.ts';
|
import { generateDateRange, Time } from '@/utils/time.ts';
|
||||||
import { PreviewCard, unfurlCardCached } from '@/utils/unfurl.ts';
|
import { PreviewCard, unfurlCardCached } from '@/utils/unfurl.ts';
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
/** Schema to parse pagination query params. */
|
|
||||||
export const paginationSchema = z.object({
|
|
||||||
max_id: z.string().transform((val) => {
|
|
||||||
if (!val.includes('-')) return val;
|
|
||||||
return val.split('-')[1];
|
|
||||||
}).optional().catch(undefined),
|
|
||||||
min_id: z.string().optional().catch(undefined),
|
|
||||||
since: z.coerce.number().nonnegative().optional().catch(undefined),
|
|
||||||
until: z.coerce.number().nonnegative().optional().catch(undefined),
|
|
||||||
limit: z.coerce.number().catch(20).transform((value) => Math.min(Math.max(value, 0), 40)),
|
|
||||||
offset: z.coerce.number().nonnegative().catch(0),
|
|
||||||
});
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { paginated, paginatedList } from '@ditto/mastoapi/pagination';
|
import { paginated, paginatedList, paginationSchema } from '@ditto/mastoapi/pagination';
|
||||||
import { NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
import { NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
||||||
|
|
||||||
import { AppContext } from '@/app.ts';
|
import { AppContext } from '@/app.ts';
|
||||||
import { paginationSchema } from '@/schemas/pagination.ts';
|
|
||||||
import { renderAccount } from '@/views/mastodon/accounts.ts';
|
import { renderAccount } from '@/views/mastodon/accounts.ts';
|
||||||
import { renderStatus } from '@/views/mastodon/statuses.ts';
|
import { renderStatus } from '@/views/mastodon/statuses.ts';
|
||||||
import { hydrateEvents } from '@/storages/hydrate.ts';
|
import { hydrateEvents } from '@/storages/hydrate.ts';
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue