字段名 修改
This commit is contained in:
parent
1d674d510d
commit
ed9ae23f84
@ -124,7 +124,7 @@ export default (resTool: ResTool, toolsNames?: string[]) => {
|
||||
|
||||
await u.db("o_script_assets").insert(assetId.map((i) => ({ scriptId, assetId: i })));
|
||||
}
|
||||
|
||||
socket.emit("setPlanData", { key: "script", value: scriptId });
|
||||
return true;
|
||||
},
|
||||
}),
|
||||
|
||||
@ -28,7 +28,7 @@ export default router.post(
|
||||
query = query.andWhere("name", "like", `%${name}%`);
|
||||
}
|
||||
// 分页查询
|
||||
const parentAssets = await query.where("o_assets.assetId", null).offset(offset).limit(limit);
|
||||
const parentAssets = await query.where("o_assets.assetsId", null).offset(offset).limit(limit);
|
||||
|
||||
// 获取所有子资产供关联使用
|
||||
let childQuery = u
|
||||
@ -37,7 +37,7 @@ export default router.post(
|
||||
.select("o_assets.*", "o_image.filePath")
|
||||
.where("o_assets.projectId", projectId)
|
||||
.andWhere("o_assets.type", type)
|
||||
.whereNotNull("o_assets.assetId");
|
||||
.whereNotNull("o_assets.assetsId");
|
||||
if (name) {
|
||||
childQuery = childQuery.andWhere("o_assets.name", "like", `%${name}%`);
|
||||
}
|
||||
@ -47,7 +47,7 @@ export default router.post(
|
||||
const result = await Promise.all(
|
||||
parentAssets.map(async (parent) => ({
|
||||
...parent,
|
||||
sonAssets: childAssets.filter((child) => child.assetId === parent.id),
|
||||
sonAssets: childAssets.filter((child) => child.assetsId === parent.id),
|
||||
src: parent.filePath && (await u.oss.getFileUrl(parent.filePath!)),
|
||||
})),
|
||||
);
|
||||
@ -57,7 +57,7 @@ export default router.post(
|
||||
.db("o_assets")
|
||||
.where("projectId", projectId)
|
||||
.andWhere("type", type)
|
||||
.andWhere("assetId", null)
|
||||
.andWhere("assetsId", null)
|
||||
.andWhere((qb) => {
|
||||
if (name) {
|
||||
qb.andWhere("name", "like", `%${name}%`);
|
||||
|
||||
@ -13,7 +13,7 @@ export default router.post(
|
||||
}),
|
||||
async (req, res) => {
|
||||
const { projectId } = req.body;
|
||||
const parentAssetsData = await u.db("o_assets").where("projectId", projectId).whereNotNull("assetId");
|
||||
const parentAssetsData = await u.db("o_assets").where("projectId", projectId).whereNotNull("assetsId");
|
||||
const parentIds = parentAssetsData.map((i) => i.id);
|
||||
const sonAssetsData = await u.db("o_assets").whereIn("assetsId", parentIds);
|
||||
const sonAssetsMap: Record<number, o_assets[]> = {};
|
||||
|
||||
@ -33,7 +33,7 @@ export default router.post(
|
||||
.leftJoin("o_image", "o_assets.imageId", "o_image.id")
|
||||
.select("o_assets.*", "o_image.filePath")
|
||||
.where("o_assets.projectId", projectId)
|
||||
.whereNotNull("o_assets.assetId");
|
||||
.whereNotNull("o_assets.assetsId");
|
||||
|
||||
if (!sqlData) {
|
||||
const flowData: FlowData = {
|
||||
@ -47,7 +47,7 @@ export default router.post(
|
||||
src: item.filePath && (await u.oss.getFileUrl(item.filePath!)),
|
||||
derive: await Promise.all(
|
||||
childAssetsData
|
||||
.filter((child) => child.assetId === item.id)
|
||||
.filter((child) => child.assetsId === item.id)
|
||||
.map(async (child) => ({
|
||||
id: child.id,
|
||||
assetsId: item.id,
|
||||
|
||||
@ -28,7 +28,6 @@ export default router.post(
|
||||
data.map((i) => i.id),
|
||||
)
|
||||
.select("o_assets.id", "o_assets.name", "o_scriptAssets.scriptId");
|
||||
console.log("%c Line:23 🍷 assetsData", "background:#ffdd4d", assetsData);
|
||||
const scriptAssetsMap: Record<number, { id: number; name: string }[]> = {};
|
||||
assetsData.forEach((i) => {
|
||||
if (scriptAssetsMap[i.scriptId]) {
|
||||
|
||||
58
src/types/database.d.ts
vendored
58
src/types/database.d.ts
vendored
@ -1,6 +1,45 @@
|
||||
// @db-hash f6a9a8164252ce954394431079615459
|
||||
// @db-hash 25c88b2cb37f9deac8b2bb8354113537
|
||||
//该文件由脚本自动生成,请勿手动修改
|
||||
|
||||
export interface _o_assets_old_20260324 {
|
||||
'describe'?: string | null;
|
||||
'id'?: number;
|
||||
'imageId'?: number | null;
|
||||
'name'?: string | null;
|
||||
'projectId'?: number | null;
|
||||
'prompt'?: string | null;
|
||||
'remark'?: string | null;
|
||||
'scriptId'?: number | null;
|
||||
'sonId'?: number | null;
|
||||
'startTime'?: number | null;
|
||||
'state'?: string | null;
|
||||
'type'?: string | null;
|
||||
}
|
||||
export interface _o_assets_old_20260324_1 {
|
||||
'assetId'?: number | null;
|
||||
'describe'?: string | null;
|
||||
'id'?: number;
|
||||
'imageId'?: number | null;
|
||||
'name'?: string | null;
|
||||
'projectId'?: number | null;
|
||||
'prompt'?: string | null;
|
||||
'remark'?: string | null;
|
||||
'scriptId'?: number | null;
|
||||
'startTime'?: number | null;
|
||||
'state'?: string | null;
|
||||
'type'?: string | null;
|
||||
}
|
||||
export interface _o_novel_old_20260323 {
|
||||
'chapter'?: string | null;
|
||||
'chapterData'?: string | null;
|
||||
'chapterIndex'?: number | null;
|
||||
'createTime'?: number | null;
|
||||
'event'?: string | null;
|
||||
'eventState'?: number | null;
|
||||
'id'?: number;
|
||||
'projectId'?: number | null;
|
||||
'reel'?: string | null;
|
||||
}
|
||||
export interface memories {
|
||||
'content': string;
|
||||
'createTime': number;
|
||||
@ -25,7 +64,7 @@ export interface o_agentDeploy {
|
||||
export interface o_agentWorkData {
|
||||
'createTime'?: number | null;
|
||||
'data'?: string | null;
|
||||
'episodesId'?: number | null;
|
||||
'espisodeId'?: number | null;
|
||||
'id'?: number;
|
||||
'key'?: string | null;
|
||||
'projectId'?: number | null;
|
||||
@ -37,6 +76,7 @@ export interface o_artStyle {
|
||||
'styles'?: string | null;
|
||||
}
|
||||
export interface o_assets {
|
||||
'assetsId'?: number | null;
|
||||
'describe'?: string | null;
|
||||
'id'?: number;
|
||||
'imageId'?: number | null;
|
||||
@ -45,7 +85,6 @@ export interface o_assets {
|
||||
'prompt'?: string | null;
|
||||
'remark'?: string | null;
|
||||
'scriptId'?: number | null;
|
||||
'sonId'?: number | null;
|
||||
'startTime'?: number | null;
|
||||
'state'?: string | null;
|
||||
'type'?: string | null;
|
||||
@ -65,6 +104,15 @@ export interface o_eventChapter {
|
||||
'id'?: number;
|
||||
'novelId'?: number | null;
|
||||
}
|
||||
export interface o_flowData {
|
||||
'createTime'?: number | null;
|
||||
'data'?: string | null;
|
||||
'espisodeId'?: number | null;
|
||||
'id'?: number;
|
||||
'key'?: string | null;
|
||||
'projectId'?: number | null;
|
||||
'updateTime'?: number | null;
|
||||
}
|
||||
export interface o_image {
|
||||
'assetsId'?: number | null;
|
||||
'filePath'?: string | null;
|
||||
@ -196,6 +244,9 @@ export interface o_videoConfig {
|
||||
}
|
||||
|
||||
export interface DB {
|
||||
"_o_assets_old_20260324": _o_assets_old_20260324;
|
||||
"_o_assets_old_20260324_1": _o_assets_old_20260324_1;
|
||||
"_o_novel_old_20260323": _o_novel_old_20260323;
|
||||
"memories": memories;
|
||||
"o_agentDeploy": o_agentDeploy;
|
||||
"o_agentWorkData": o_agentWorkData;
|
||||
@ -204,6 +255,7 @@ export interface DB {
|
||||
"o_assets2Storyboard": o_assets2Storyboard;
|
||||
"o_event": o_event;
|
||||
"o_eventChapter": o_eventChapter;
|
||||
"o_flowData": o_flowData;
|
||||
"o_image": o_image;
|
||||
"o_novel": o_novel;
|
||||
"o_outline": o_outline;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user