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": {
|
||||
"projects": [{
|
||||
"slug": "mantle", // 关联项目的 slug
|
||||
"projectID": "74924", // 可选,用于精确匹配项目
|
||||
"projectID": 74924, // 可选,用于精确匹配项目
|
||||
"type": "requiredDependency" // 关联类型,可选值见下方
|
||||
}]
|
||||
}
|
||||
@ -152,7 +152,7 @@ Content-Type: multipart/form-data
|
||||
"relations": {
|
||||
"projects": [{
|
||||
"slug": "mantle",
|
||||
"projectID": "74924",
|
||||
"projectID": 74924,
|
||||
"type": "requiredDependency"
|
||||
}]
|
||||
}
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user