11import express from 'express' ;
2- import AdminForth from 'adminforth' ;
2+ import AdminForth , { Filters } from '../ adminforth/index.js ' ;
33import usersResource from "./resources/adminuser.js" ;
44import { fileURLToPath } from 'url' ;
55import path from 'path' ;
6- import { Filters } from 'adminforth ' ;
6+ import { Decimal } from 'decimal.js ' ;
77import { initApi } from './api.js' ;
88import cars_SQLITE_resource from './resources/cars_SL.js' ;
99import cars_MyS_resource from './resources/cars_MyS.js' ;
@@ -202,12 +202,12 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
202202 await admin . resource ( 'cars_sl' ) . create ( {
203203 id : `${ i } ` ,
204204 model : `${ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] } ${ FICTIONAL_CAR_MODELS_BY_BRAND [ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] ] [ Math . floor ( Math . random ( ) * 4 ) ] } ` ,
205- price : ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
205+ price : Decimal ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
206206 engine_type : engine_type ,
207207 engine_power : engine_type === 'electric' ? null : Math . floor ( Math . random ( ) * 400 ) + 100 ,
208208 production_year : Math . floor ( Math . random ( ) * 31 ) + 1990 ,
209209 listed : i % 2 == 0 ,
210- mileage : ` ${ Math . floor ( Math . random ( ) * 200000 ) } ` ,
210+ mileage : Math . floor ( Math . random ( ) * 200000 ) ,
211211 body_type : BODY_TYPES [ Math . floor ( Math . random ( ) * BODY_TYPES . length ) ] . value ,
212212 } ) ;
213213 } ;
@@ -218,12 +218,12 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
218218 await admin . resource ( 'cars_mongo' ) . create ( {
219219 _id : `${ i } ` ,
220220 model : `${ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] } ${ FICTIONAL_CAR_MODELS_BY_BRAND [ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] ] [ Math . floor ( Math . random ( ) * 4 ) ] } ` ,
221- price : ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
221+ price : Decimal ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
222222 engine_type : engine_type ,
223223 engine_power : engine_type === 'electric' ? null : Math . floor ( Math . random ( ) * 400 ) + 100 ,
224224 production_year : Math . floor ( Math . random ( ) * 31 ) + 1990 ,
225225 listed : i % 2 == 0 ,
226- mileage : ` ${ Math . floor ( Math . random ( ) * 200000 ) } ` ,
226+ mileage : Math . floor ( Math . random ( ) * 200000 ) ,
227227 body_type : BODY_TYPES [ Math . floor ( Math . random ( ) * BODY_TYPES . length ) ] . value ,
228228 } ) ;
229229 } ;
@@ -235,12 +235,12 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
235235 await admin . resource ( 'cars_mysql' ) . create ( {
236236 id : `${ i } ` ,
237237 model : `${ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] } ${ FICTIONAL_CAR_MODELS_BY_BRAND [ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] ] [ Math . floor ( Math . random ( ) * 4 ) ] } ` ,
238- price : ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
238+ price : Decimal ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
239239 engine_type : engine_type ,
240240 engine_power : engine_type === 'electric' ? null : Math . floor ( Math . random ( ) * 400 ) + 100 ,
241241 production_year : Math . floor ( Math . random ( ) * 31 ) + 1990 ,
242242 listed : i % 2 == 0 ,
243- mileage : ` ${ Math . floor ( Math . random ( ) * 200000 ) } ` ,
243+ mileage : Math . floor ( Math . random ( ) * 200000 ) ,
244244 body_type : BODY_TYPES [ Math . floor ( Math . random ( ) * BODY_TYPES . length ) ] . value ,
245245 } ) ;
246246 } ;
@@ -252,12 +252,12 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
252252 await admin . resource ( 'cars_pg' ) . create ( {
253253 id : `${ i } ` ,
254254 model : `${ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] } ${ FICTIONAL_CAR_MODELS_BY_BRAND [ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] ] [ Math . floor ( Math . random ( ) * 4 ) ] } ` ,
255- price : ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
255+ price : Decimal ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
256256 engine_type : engine_type ,
257257 engine_power : engine_type === 'electric' ? null : Math . floor ( Math . random ( ) * 400 ) + 100 ,
258258 production_year : Math . floor ( Math . random ( ) * 31 ) + 1990 ,
259259 listed : i % 2 == 0 ,
260- mileage : ` ${ Math . floor ( Math . random ( ) * 200000 ) } ` ,
260+ mileage : Math . floor ( Math . random ( ) * 200000 ) ,
261261 body_type : BODY_TYPES [ Math . floor ( Math . random ( ) * BODY_TYPES . length ) ] . value ,
262262 } ) ;
263263 } ;
@@ -269,12 +269,12 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
269269 await admin . resource ( 'cars_ch' ) . create ( {
270270 id : `${ i } ` ,
271271 model : `${ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] } ${ FICTIONAL_CAR_MODELS_BY_BRAND [ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] ] [ Math . floor ( Math . random ( ) * 4 ) ] } ` ,
272- price : ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
272+ price : Decimal ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
273273 engine_type : engine_type ,
274274 engine_power : engine_type === 'electric' ? null : Math . floor ( Math . random ( ) * 400 ) + 100 ,
275275 production_year : Math . floor ( Math . random ( ) * 31 ) + 1990 ,
276276 listed : i % 2 == 0 ,
277- mileage : ` ${ Math . floor ( Math . random ( ) * 200000 ) } ` ,
277+ mileage : Math . floor ( Math . random ( ) * 200000 ) ,
278278 body_type : BODY_TYPES [ Math . floor ( Math . random ( ) * BODY_TYPES . length ) ] . value ,
279279 } ) ;
280280 } ;
0 commit comments