Change Curseforge relation projectID type from string to number

This commit is contained in:
CPTProgrammer
2026-07-18 22:09:50 +08:00
parent 54af762365
commit b16c9546b8
3 changed files with 7 additions and 8 deletions
+4 -5
View File
@@ -293,9 +293,9 @@ const LIST_DEFS: ListValidationDef<Config>[] = [
target: "projectID",
deps: ["projectID"],
async validate(getVal, row, setVal) {
const id = getVal("projectID") as string | undefined;
if (!id) return null;
const r = await lookupCurseforgeProject(Number(id));
const id = getVal("projectID") as number | undefined;
if (id == null) return null;
const r = await lookupCurseforgeProject(id);
if (r.ok) {
setVal("slug", r.slug);
return { status: "success", help: `项目:${r.name}` };
@@ -967,7 +967,6 @@ function ConfigModalForm({
name={[name, "projectID"]}
rules={[{ required: true, message: "必填" }]}
style={{ marginBottom: 0 }}
normalize={(v) => v != null ? String(v) : undefined}
>
<InputNumber
placeholder="ID"
@@ -1007,7 +1006,7 @@ function ConfigModalForm({
<Button
type="dashed"
onClick={() =>
add({ projectID: "", slug: "", type: "requiredDependency" })
add({ slug: "", type: "requiredDependency" })
}
icon={<PlusOutlined />}
block
+1 -1
View File
@@ -34,7 +34,7 @@ export const RelationProjectSchema = z.object({
/** 关联项目的 slug */
slug: z.string(),
/** 关联项目的 ID(精确匹配),可选 */
projectID: z.string().optional(),
projectID: z.number().int().positive().optional(),
/** 关联类型 */
type: UploadRelationTypeSchema,
});