Change Curseforge relation projectID type from string to number
This commit is contained in:
parent
54af762365
commit
b16c9546b8
@ -97,7 +97,7 @@ Content-Type: multipart/form-data
|
|||||||
"relations": {
|
"relations": {
|
||||||
"projects": [{
|
"projects": [{
|
||||||
"slug": "mantle", // 关联项目的 slug
|
"slug": "mantle", // 关联项目的 slug
|
||||||
"projectID": "74924", // 可选,用于精确匹配项目
|
"projectID": 74924, // 可选,用于精确匹配项目
|
||||||
"type": "requiredDependency" // 关联类型,可选值见下方
|
"type": "requiredDependency" // 关联类型,可选值见下方
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ Content-Type: multipart/form-data
|
|||||||
"relations": {
|
"relations": {
|
||||||
"projects": [{
|
"projects": [{
|
||||||
"slug": "mantle",
|
"slug": "mantle",
|
||||||
"projectID": "74924",
|
"projectID": 74924,
|
||||||
"type": "requiredDependency"
|
"type": "requiredDependency"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -293,9 +293,9 @@ const LIST_DEFS: ListValidationDef<Config>[] = [
|
|||||||
target: "projectID",
|
target: "projectID",
|
||||||
deps: ["projectID"],
|
deps: ["projectID"],
|
||||||
async validate(getVal, row, setVal) {
|
async validate(getVal, row, setVal) {
|
||||||
const id = getVal("projectID") as string | undefined;
|
const id = getVal("projectID") as number | undefined;
|
||||||
if (!id) return null;
|
if (id == null) return null;
|
||||||
const r = await lookupCurseforgeProject(Number(id));
|
const r = await lookupCurseforgeProject(id);
|
||||||
if (r.ok) {
|
if (r.ok) {
|
||||||
setVal("slug", r.slug);
|
setVal("slug", r.slug);
|
||||||
return { status: "success", help: `项目:${r.name}` };
|
return { status: "success", help: `项目:${r.name}` };
|
||||||
@ -967,7 +967,6 @@ function ConfigModalForm({
|
|||||||
name={[name, "projectID"]}
|
name={[name, "projectID"]}
|
||||||
rules={[{ required: true, message: "必填" }]}
|
rules={[{ required: true, message: "必填" }]}
|
||||||
style={{ marginBottom: 0 }}
|
style={{ marginBottom: 0 }}
|
||||||
normalize={(v) => v != null ? String(v) : undefined}
|
|
||||||
>
|
>
|
||||||
<InputNumber
|
<InputNumber
|
||||||
placeholder="ID"
|
placeholder="ID"
|
||||||
@ -1007,7 +1006,7 @@ function ConfigModalForm({
|
|||||||
<Button
|
<Button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
add({ projectID: "", slug: "", type: "requiredDependency" })
|
add({ slug: "", type: "requiredDependency" })
|
||||||
}
|
}
|
||||||
icon={<PlusOutlined />}
|
icon={<PlusOutlined />}
|
||||||
block
|
block
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export const RelationProjectSchema = z.object({
|
|||||||
/** 关联项目的 slug */
|
/** 关联项目的 slug */
|
||||||
slug: z.string(),
|
slug: z.string(),
|
||||||
/** 关联项目的 ID(精确匹配),可选 */
|
/** 关联项目的 ID(精确匹配),可选 */
|
||||||
projectID: z.string().optional(),
|
projectID: z.number().int().positive().optional(),
|
||||||
/** 关联类型 */
|
/** 关联类型 */
|
||||||
type: UploadRelationTypeSchema,
|
type: UploadRelationTypeSchema,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user