44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
// import { db } from "./src/db/index";
|
|
// import { IUnit } from "./src/types/IUnit";
|
|
// import { unitsTable } from "./src/db/schema/units";
|
|
// import got from "got";
|
|
|
|
// const { units } = await got
|
|
// .get(
|
|
// "https://irth-test-ii-16348121.dev.odoo.com/3d-fields/1?token=f82a4708-9a4d-491a-9424-1580b7173ba6"
|
|
// )
|
|
// .json<{ units: IUnit[] }>();
|
|
|
|
// for (const {
|
|
// no_of_bathrooms,
|
|
// floor,
|
|
// no_of_parking_space,
|
|
// project,
|
|
// sales_price,
|
|
// square_ft,
|
|
// state,
|
|
// suits_area,
|
|
// unit_no,
|
|
// unit_type,
|
|
// unit_view,
|
|
// } of units) {
|
|
// type Unit = typeof unitsTable.$inferInsert;
|
|
|
|
// const unit: Unit = {
|
|
// unitNo: unit_no,
|
|
// number: +unit_no.slice(2),
|
|
// project,
|
|
// floor: +floor,
|
|
// noOfBathrooms: no_of_bathrooms,
|
|
// noOfParkingSpace: no_of_parking_space,
|
|
// salesPrice: sales_price,
|
|
// state: state as Unit["state"],
|
|
// unitType: unit_type as Unit["unitType"],
|
|
// unitView: unit_view as Unit["unitView"],
|
|
// suitsArea: suits_area.toString(),
|
|
// squareFt: square_ft.toString(),
|
|
// };
|
|
|
|
// await db.insert(unitsTable).values(unit);
|
|
// }
|