forked from andyburke/autonomous.contact
refactor: finish UX refactor and move events storage
This commit is contained in:
parent
4347d20263
commit
f760156651
10 changed files with 269 additions and 27 deletions
|
|
@ -56,7 +56,12 @@ export async function GET(request: Request, meta: Record<string, any>): Promise<
|
|||
limit: Math.min(parseInt(meta.query?.limit ?? '10'), 1_000),
|
||||
sort,
|
||||
filter: (entry: WALK_ENTRY<EVENT>) => {
|
||||
const [event_id, event_type] = path.basename(entry.path).replace(/\.json$/i, '').split(':');
|
||||
const {
|
||||
groups: {
|
||||
event_type,
|
||||
event_id
|
||||
}
|
||||
} = /^.*\/events\/(?<event_type>.*?)\/.*\/(?<event_id>[A-Za-z-]+)\.json$/.exec(entry.path) ?? { groups: {} };
|
||||
|
||||
if (meta.query.after_id && event_id <= meta.query.after_id) {
|
||||
return false;
|
||||
|
|
@ -165,7 +170,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
}
|
||||
};
|
||||
|
||||
event.id = `${lurid()}:${event.type}`;
|
||||
event.id = `${event.type}:${lurid()}`;
|
||||
|
||||
await events.create(event);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ const DEFAULT_USER_PERMISSIONS: string[] = [
|
|||
'self.read',
|
||||
'self.write',
|
||||
'topics.read',
|
||||
'topics.chat.write',
|
||||
'topics.chat.read',
|
||||
'topics.threads.write',
|
||||
'topics.threads.read',
|
||||
'users.read'
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue