add gloabl proxy to app settings
This commit is contained in:
1 parent
cf13bc329e
commit
edd9335e96
4 files changed
+18
-1
No files matched your search
@@ -40,5 +40,16 @@ export const updateAppSettingsBodyValidation = z
|
|||||||
temperature: z.number().min(1).max(150).optional(),
|
temperature: z.number().min(1).max(150).optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
globalProxyEnabled: z.boolean().optional(),
|
||||||
|
globalProxyId: z.string().nullable().optional(),
|
||||||
})
|
})
|
||||||
.strip();
|
.strip()
|
||||||
|
.superRefine((body, ctx) => {
|
||||||
|
if (body.globalProxyEnabled === true && !body.globalProxyId) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: "custom",
|
||||||
|
path: ["globalProxyId"],
|
||||||
|
message: "A proxy must be selected to enable the global proxy",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -40,6 +40,8 @@ const AppSettingsSchema = new Schema<AppSettingsDocument>(
|
|||||||
singleton: { type: Boolean, required: true, unique: true, default: true },
|
singleton: { type: Boolean, required: true, unique: true, default: true },
|
||||||
version: { type: Number, default: 1 },
|
version: { type: Number, default: 1 },
|
||||||
globalThresholds: { type: thresholdsSchema },
|
globalThresholds: { type: thresholdsSchema },
|
||||||
|
globalProxyEnabled: { type: Boolean, default: false },
|
||||||
|
globalProxyId: { type: String, default: null },
|
||||||
},
|
},
|
||||||
{ timestamps: true }
|
{ timestamps: true }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class MongoSettingsRepository implements ISettingsRepository {
|
|||||||
singleton: doc.singleton,
|
singleton: doc.singleton,
|
||||||
version: doc.version ?? 1,
|
version: doc.version ?? 1,
|
||||||
globalThresholds: doc.globalThresholds ?? undefined,
|
globalThresholds: doc.globalThresholds ?? undefined,
|
||||||
|
globalProxyEnabled: doc.globalProxyEnabled ?? false,
|
||||||
|
globalProxyId: doc.globalProxyId ?? undefined,
|
||||||
createdAt: toDateString(doc.createdAt),
|
createdAt: toDateString(doc.createdAt),
|
||||||
updatedAt: toDateString(doc.updatedAt),
|
updatedAt: toDateString(doc.updatedAt),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ export interface Settings {
|
|||||||
singleton: boolean;
|
singleton: boolean;
|
||||||
version: number;
|
version: number;
|
||||||
globalThresholds?: SettingsThresholds;
|
globalThresholds?: SettingsThresholds;
|
||||||
|
globalProxyEnabled: boolean;
|
||||||
|
globalProxyId?: string | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user