/api/backupProduct
This commit is contained in:
parent
6e17757640
commit
8d43f2ce06
|
|
@ -373,13 +373,13 @@ Route.post("/api/gitea-webhook", ({ request, response }) => {
|
|||
});
|
||||
|
||||
Route.post("/api/backupProduct", async ({ request, response }) => {
|
||||
// try {
|
||||
try {
|
||||
const date = moment(Date.now()).format("YYYYMMDD");
|
||||
const token =
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c2VyIjoxLCJ1c2VybmFtZSI6ImVycHVzZXIiLCJjcmVhdGVkQXQiOiIyMDIzLTA4LTIzVDE1OjI4OjAxLjAwMCsxMDowMCIsInVwZGF0ZWRBdCI6IjIwMjMtMDgtMjNUMTU6Mjg6MDEuMDAwKzEwOjAwIiwiaWF0IjoxNjk1MjY0NTQwLCJleHAiOjE3MjY4MDA1NDB9.vBlZAc7TGKbOrsP7UjQzVY2hIoJCGXQDe3KUxYyv294";
|
||||
const res = await axios.post(
|
||||
"https://logs.danielvu.com/api/getIndexSerialNumber",
|
||||
{ from: "20230901", to: "20230927" },
|
||||
{ from: date, to: date },
|
||||
{ headers: { Authorization: token } }
|
||||
);
|
||||
|
||||
|
|
@ -395,9 +395,9 @@ Route.post("/api/backupProduct", async ({ request, response }) => {
|
|||
})
|
||||
|
||||
const addProduct = await Product.createMany(res.data)
|
||||
console.log(addProduct)
|
||||
// console.log(addProduct)
|
||||
response.status(200).send("Add "+res.data.length+" success!");
|
||||
// } catch (error) {
|
||||
// response.status(500).send(error);
|
||||
// }
|
||||
} catch (error) {
|
||||
response.status(500).send(error);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue