/api/backupProduct

This commit is contained in:
joseph le 2023-09-28 15:59:33 +07:00
parent 059af5b0dd
commit be6240d0d5
2 changed files with 10 additions and 2 deletions

View File

@ -18,7 +18,7 @@ export default class Product extends BaseModel {
public line: string
@column()
public fileName: string
public file: string
@column()
public warehouse: string

View File

@ -384,7 +384,15 @@ Route.post("/api/backupProduct", async ({ request, response }) => {
);
res.data.map((obj, index)=>{
res.data[index].line = res.data[index].line.join(",")
res.data[index] = {
PID:res.data[index].PID,
SN:res.data[index].SN,
VID:res.data[index].VID,
line:res.data[index].line.join(","),
file:res.data[index].fileName,
warehouse:res.data[index].warehouse,
created_at: Date.now()
}
})
const addProduct = await Product.createMany(res.data)