0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

feat(core): GET /application/:id (#106)

This commit is contained in:
Gao Sun 2021-09-01 18:23:53 +08:00 committed by GitHub
parent 211a5a1760
commit 5d5d43deee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import koaGuard from '@/middleware/koa-guard';
import { generateOidcClientMetadata } from '@/oidc/utils';
import {
deleteApplicationById,
findApplicationById,
insertApplication,
updateApplicationById,
} from '@/queries/application';
@ -37,6 +38,21 @@ export default function applicationRoutes<T extends AuthedRouter>(router: T) {
}
);
router.get(
'/application/:id',
koaGuard({
params: object({ id: string().min(1) }),
}),
async (ctx, next) => {
const {
params: { id },
} = ctx.guard;
ctx.body = await findApplicationById(id);
return next();
}
);
router.patch(
'/application/:id',
koaGuard({