mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 16:46:22 +08:00
chore(admin): remove useless config diff (#12545)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a GraphQL mutation to validate multiple app configuration updates, returning detailed validation results for each item. - Extended the API schema to support validation feedback, enabling client-side checks before applying changes. - Introduced a detailed, parameterized error message system for configuration validation errors. - Enabled validation of configuration inputs via the admin UI with clear, descriptive error messages. - **Improvements** - Enhanced error reporting with specific, context-rich messages for invalid app configurations. - Simplified admin settings UI by removing the confirmation dialog and streamlining save actions. - Improved clarity and maintainability of validation logic and error handling components. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -4,7 +4,7 @@ import { resolve } from 'node:path';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { Command, CommandRunner } from 'nest-commander';
|
||||
|
||||
import { ConfigFactory } from '../../base';
|
||||
import { ConfigFactory, InvalidAppConfigInput } from '../../base';
|
||||
import { Models } from '../../models';
|
||||
|
||||
@Command({
|
||||
@@ -50,7 +50,13 @@ export class ImportConfigCommand extends CommandRunner {
|
||||
});
|
||||
});
|
||||
|
||||
this.configFactory.validate(forValidation);
|
||||
const errors = this.configFactory.validate(forValidation);
|
||||
|
||||
if (errors?.length) {
|
||||
throw new InvalidAppConfigInput({
|
||||
message: errors.map(error => error.message).join('\n '),
|
||||
});
|
||||
}
|
||||
|
||||
// @ts-expect-error null as user id
|
||||
await this.models.appConfig.save(null, forSaving);
|
||||
|
||||
Reference in New Issue
Block a user