feat: validate action input in updateStep

This commit is contained in:
Ali BARIN
2023-03-12 11:17:41 +00:00
parent dc1002659b
commit 4c4bd267d4
2 changed files with 15 additions and 0 deletions

View File

@@ -36,6 +36,16 @@ class App {
return appInfoConverter(rawAppData);
}
static async checkAppAndAction(appKey: string, actionKey: string): Promise<void> {
const app = await this.findOneByKey(appKey);
const hasAction = app.actions?.find(action => action.key === actionKey);
if (!hasAction) {
throw new Error(`${app.name} does not have an action with the "${actionKey}" key!`);
}
}
}
export default App;