mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
91e2f055f2
* feat(core): seed demo app for fresh DB * feat(core): throw 404 when demo app deleted * fix(core): import * fix: lockfile
22 lines
482 B
TypeScript
22 lines
482 B
TypeScript
import { demoAppApplicationId } from '@logto/schemas/lib/seeds';
|
|
import { MiddlewareType } from 'koa';
|
|
|
|
import { findApplicationById } from '@/queries/application';
|
|
|
|
export default function koaCheckDemoApp<StateT, ContextT, ResponseBodyT>(): MiddlewareType<
|
|
StateT,
|
|
ContextT,
|
|
ResponseBodyT
|
|
> {
|
|
return async (ctx, next) => {
|
|
try {
|
|
await findApplicationById(demoAppApplicationId);
|
|
|
|
await next();
|
|
|
|
return;
|
|
} catch {
|
|
ctx.throw(404);
|
|
}
|
|
};
|
|
}
|