refactor: rewrite create-app-auth-client mutation as REST endpoint

This commit is contained in:
Ali BARIN
2024-08-23 13:51:31 +00:00
parent 164d31dfbc
commit 81c39d7d93
14 changed files with 168 additions and 63 deletions

View File

@@ -0,0 +1,14 @@
import { renderObject } from '../../../../../helpers/renderer.js';
import AppConfig from '../../../../../models/app-config.js';
export default async (request, response) => {
const appConfig = await AppConfig.query()
.findOne({ key: request.params.appKey })
.throwIfNotFound();
const appAuthClient = await appConfig
.$relatedQuery('appAuthClients')
.insert(request.body);
renderObject(response, appAuthClient, { status: 201 });
};