Skip to content

Commit 5f97832

Browse files
committed
chore: update dev demo
1 parent b43133a commit 5f97832

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

dev-demo/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
216216
for (let i = 0; i < 100; i++) {
217217
const engine_type = ENGINE_TYPES[Math.floor(Math.random() * ENGINE_TYPES.length)].value;
218218
await admin.resource('cars_mongo').create({
219-
_id: `${i}`,
219+
_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)]}`,
221221
price: Decimal(Math.random() * 10000).toFixed(2),
222222
engine_type: engine_type,

dev-demo/resources/carsResourseTemplate.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
5959
inputSuffix: 'USD',
6060
allowMinMaxQuery: true,
6161
editingNote: 'Price is in USD',
62-
type: AdminForthDataTypes.FLOAT,
62+
type: AdminForthDataTypes.DECIMAL,
6363
required: true,
6464
},
6565
{
@@ -73,12 +73,10 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
7373
name: 'engine_type',
7474
type: AdminForthDataTypes.STRING,
7575
label: 'Engine Type',
76-
allowMinMaxQuery: true,
7776
enum: ENGINE_TYPES,
7877
},
7978
{
8079
name: 'engine_power',
81-
allowMinMaxQuery: true,
8280
type: AdminForthDataTypes.INTEGER,
8381
inputSuffix: 'HP',
8482
showIf: { engine_type: { $not: 'electric' } },
@@ -87,6 +85,7 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
8785
{
8886
name: 'production_year',
8987
type: AdminForthDataTypes.INTEGER,
88+
allowMinMaxQuery: true,
9089
minValue: 1900,
9190
maxValue: new Date().getFullYear(),
9291
},
@@ -341,7 +340,7 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
341340
{
342341
name: 'Approve Listing',
343342
icon: 'flowbite:check-outline',
344-
action: async ({ recordId, adminUser, adminforth, extra }) => {
343+
action: async ({ recordId, adminUser, adminforth, extra, response }) => {
345344
//@ts-ignore
346345
const verificationResult = extra?.verificationResult
347346
if (!verificationResult) {
@@ -351,7 +350,9 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
351350
const result = await t2fa.verify(verificationResult, {
352351
adminUser: adminUser,
353352
userPk: adminUser.pk as string,
354-
cookies: extra.cookies
353+
cookies: extra.cookies,
354+
response: response,
355+
extra: extra,
355356
});
356357

357358

0 commit comments

Comments
 (0)