Change Curseforge relation projectID type from string to number
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user