chore: deprecatedKeys

This commit is contained in:
lisonge
2023-10-24 15:13:49 +08:00
parent 0410162897
commit c4635e2fc4
2 changed files with 15 additions and 0 deletions

View File

@@ -88,8 +88,18 @@ export const validSnapshotUrl = (s: string) => {
export const checkConfig = (newConfig: SubscriptionConfig) => {
// check duplicated group key
newConfig.apps?.forEach((app) => {
const deprecatedKeys = app.deprecatedKeys || [];
const keys = new Set<number>();
app.groups?.forEach((g) => {
if (deprecatedKeys.includes(g.key)) {
console.error({
configName: newConfig.name,
appId: app.id,
groupName: g.name,
groupKey: g.key,
});
throw new Error('invalid deprecated group key');
}
if (keys.has(g.key)) {
console.error({
configName: newConfig.name,