feature: reactions
This commit is contained in:
parent
b8467ec870
commit
7046bb0389
11 changed files with 371 additions and 133 deletions
|
|
@ -53,7 +53,8 @@ export async function GET(request: Request, meta: Record<string, any>): Promise<
|
|||
|
||||
const options: FSDB_SEARCH_OPTIONS<EVENT> = {
|
||||
...(meta.query ?? {}),
|
||||
limit: Math.min(parseInt(meta.query?.limit ?? '10'), 1_000),
|
||||
limit: Math.min(parseInt(meta.query?.limit ?? '10', 10), 1_000),
|
||||
offset: Math.max(parseInt(meta.query?.offset ?? '0', 10), 0),
|
||||
sort,
|
||||
filter: (entry: WALK_ENTRY<EVENT>) => {
|
||||
const {
|
||||
|
|
@ -63,13 +64,11 @@ export async function GET(request: Request, meta: Record<string, any>): Promise<
|
|||
}
|
||||
} = /^.*\/events\/(?<event_type>.*?)\/.*\/(?<event_id>[A-Za-z-]+)\.json$/.exec(entry.path) ?? { groups: {} };
|
||||
|
||||
const id = `${event_type}:${event_id}`;
|
||||
|
||||
if (meta.query.after_id && id <= meta.query.after_id) {
|
||||
if (meta.query.after_id && event_id <= meta.query.after_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (meta.query.before_id && id >= meta.query.before_id) {
|
||||
if (meta.query.before_id && event_id >= meta.query.before_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ export async function GET(request: Request, meta: Record<string, any>): Promise<
|
|||
if (results.length === 0 && meta.query.wait) {
|
||||
return new Promise((resolve, reject) => {
|
||||
function on_create(create_event: any) {
|
||||
if (meta.query.type && create_event.item.type !== meta.query.type) {
|
||||
if (meta.query.type && !meta.query.type.split(',').includes(create_event.item.type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue