Merge branch '108' of https://github.com/HBAI-Ltd/Toonflow-app into 108
This commit is contained in:
commit
812feaff9c
@ -1 +0,0 @@
|
||||
1212水电费水电费萨芬的水电费
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -1 +0,0 @@
|
||||
1212
|
||||
@ -31,7 +31,6 @@ export default router.post(
|
||||
imageId: assets!.imageId ?? null,
|
||||
tempAssets,
|
||||
};
|
||||
console.log("%c Line:30 🥤 data", "background:#465975", data);
|
||||
res.status(200).send(success(data));
|
||||
},
|
||||
);
|
||||
|
||||
@ -6,28 +6,38 @@ import { validateFields } from "@/middleware/middleware";
|
||||
const router = express.Router();
|
||||
|
||||
export default router.post(
|
||||
"/",
|
||||
validateFields({
|
||||
projectId: z.number(),
|
||||
type: z.array(z.string()).optional(),
|
||||
}),
|
||||
async (req, res) => {
|
||||
const { projectId, type, } = req.body;
|
||||
const data = await u
|
||||
.db("o_assets")
|
||||
.leftJoin("o_image", "o_assets.imageId", "o_image.id")
|
||||
.select("o_assets.*", "o_image.filePath", "o_image.state", "o_image.model", "o_image.resolution")
|
||||
.where("o_assets.projectId", projectId)
|
||||
.andWhere("o_assets.type", "<>", "clip")
|
||||
.modify((qb) => {
|
||||
if (type && type.length > 0) qb.whereIn("o_assets.type", type);
|
||||
});
|
||||
const result = await Promise.all(
|
||||
data.map(async (parent: any) => ({
|
||||
...parent,
|
||||
filePath: parent.filePath && (await u.oss.getFileUrl(parent.filePath!)),
|
||||
})),
|
||||
"/",
|
||||
validateFields({
|
||||
projectId: z.number(),
|
||||
type: z.array(z.string()).optional(),
|
||||
}),
|
||||
async (req, res) => {
|
||||
const { projectId, type } = req.body;
|
||||
const data = await u
|
||||
.db("o_assets")
|
||||
.leftJoin("o_image", "o_assets.imageId", "o_image.id")
|
||||
.select("o_assets.*", "o_image.filePath", "o_image.state", "o_image.model", "o_image.resolution")
|
||||
.where("o_assets.projectId", projectId)
|
||||
.andWhere("o_assets.type", "<>", "clip")
|
||||
.modify((qb) => {
|
||||
if (type && type.length > 0) qb.whereIn("o_assets.type", type);
|
||||
});
|
||||
const result = await Promise.all(
|
||||
data.map(async (parent: any) => {
|
||||
const historyImages = await u.db("o_image").where("assetsId", parent.id).andWhere("state", "已完成").select("id", "filePath");
|
||||
const historyImagesWithUrl = await Promise.all(
|
||||
historyImages.map(async (img: any) => ({
|
||||
id: img.id,
|
||||
filePath: img.filePath && (await u.oss.getFileUrl(img.filePath)),
|
||||
})),
|
||||
);
|
||||
res.status(200).send(success(result));
|
||||
},
|
||||
return {
|
||||
...parent,
|
||||
filePath: parent.filePath && (await u.oss.getFileUrl(parent.filePath!)),
|
||||
historyImages: historyImagesWithUrl,
|
||||
};
|
||||
}),
|
||||
);
|
||||
res.status(200).send(success(result));
|
||||
},
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user