refactor: add server side validation schema for authProviders (#4876)

* refactor: move files to subfolder

* refactor: schema for authenticationProviders.info

* refactor: schema for authenticationProviders.update

* refactor: use validated body
This commit is contained in:
Mohamed ELIDRISSI
2023-02-14 23:49:24 +01:00
committed by GitHub
parent ab7b20958b
commit 0976e85a1a
5 changed files with 40 additions and 12 deletions

View File

@@ -15,7 +15,7 @@ router.post(
auth({ member: true }),
validate(T.APIKeysCreateSchema),
async (ctx: APIContext<T.APIKeysCreateReq>) => {
const { name } = ctx.request.body;
const { name } = ctx.input.body;
const { user } = ctx.state.auth;
authorize(user, "createApiKey", user.team);
@@ -68,7 +68,7 @@ router.post(
auth({ member: true }),
validate(T.APIKeysDeleteSchema),
async (ctx: APIContext<T.APIKeysDeleteReq>) => {
const { id } = ctx.request.body;
const { id } = ctx.input.body;
const { user } = ctx.state.auth;
const key = await ApiKey.findByPk(id);