feat: write PATCH /v1/admin/apps/:appKey/auth-clients/:appAuthClientId

This commit is contained in:
Ali BARIN
2024-08-27 16:02:16 +00:00
parent 09b255f99e
commit b2bda8479e
4 changed files with 131 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { renderObject } from '../../../../../helpers/renderer.js';
import AppAuthClient from '../../../../../models/app-auth-client.js';
export default async (request, response) => {
const id = request.params.appAuthClientId;
const appAuthClient = await AppAuthClient.query()
.findById(id)
.throwIfNotFound();
await appAuthClient.$query().patchAndFetch(appAuthClientParams(request));
renderObject(response, appAuthClient);
};
const appAuthClientParams = (request) => {
const { active, name, formattedAuthDefaults } = request.body;
return {
active,
name,
formattedAuthDefaults,
};
};