fix: Fetch app auth clients for app config endpoint
This commit is contained in:
@@ -3,6 +3,9 @@ import AppConfig from '../../../../models/app-config.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const appConfig = await AppConfig.query()
|
||||
.withGraphFetched({
|
||||
appAuthClients: true,
|
||||
})
|
||||
.findOne({
|
||||
key: request.params.appKey,
|
||||
})
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import App from './app.js';
|
||||
import AppAuthClient from './app-auth-client.js';
|
||||
import Base from './base.js';
|
||||
|
||||
class AppConfig extends Base {
|
||||
@@ -17,6 +18,17 @@ class AppConfig extends Base {
|
||||
},
|
||||
};
|
||||
|
||||
static relationMappings = () => ({
|
||||
appAuthClients: {
|
||||
relation: Base.HasManyRelation,
|
||||
modelClass: AppAuthClient,
|
||||
join: {
|
||||
from: 'app_configs.key',
|
||||
to: 'app_auth_clients.app_key',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
static get virtualAttributes() {
|
||||
return ['canConnect', 'canCustomConnect'];
|
||||
}
|
||||
|
Reference in New Issue
Block a user