Skip to content

Commit 0392fe7

Browse files
committed
Merge branch 'next', commit '0b3212db42b97a1f9c3575a4272f2533b2e4d77f' of github.com:devforth/adminforth into next
2 parents 0b3212d + 7f7d204 commit 0392fe7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

adminforth/dataConnectors/mongo.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import dayjs from 'dayjs';
22
import { MongoClient } from 'mongodb';
3+
import { Decimal128 } from 'bson';
34
import { IAdminForthDataSourceConnector, IAdminForthSingleFilter, IAdminForthAndOrFilter, AdminForthResource } from '../types/Back.js';
45
import AdminForthBaseConnector from './baseConnector.js';
56

@@ -108,6 +109,8 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
108109
}
109110
} else if (field.type == AdminForthDataTypes.BOOLEAN) {
110111
return value ? true : false;
112+
} else if (field.type == AdminForthDataTypes.DECIMAL) {
113+
return Decimal128.fromString(value?.toString());
111114
}
112115
return value;
113116
}
@@ -138,6 +141,7 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
138141
// const columns = resource.dataSourceColumns.filter(c=> !c.virtual).map((col) => col.name).join(', ');
139142
const tableName = resource.table;
140143

144+
141145
const collection = this.client.db().collection(tableName);
142146
const query = filters.subFilters.length ? this.getFilterQuery(resource, filters) : {};
143147

adminforth/documentation/docs/tutorial/03-Customization/07-alert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import adminforth from '@/adminforth';
3434
const isConfirmed = await adminforth.confirm({message: 'Are you sure?', yes: 'Yes', no: 'No'})
3535
```
3636

37-
## Ussage example
37+
## Usage example
3838

3939
Create a Vue component in the custom directory of your project, e.g. `Alerts.vue`:
4040

adminforth/documentation/docs/tutorial/03-Customization/11-dataApi.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ const schools = await admin.resource('schools').list(
108108
);
109109
```
110110

111-
Get all users that have gmail address OR the ones created not in 2024
111+
Get all users that have gmail address AND the ones created not in 2024
112112

113113
```ts
114114
const users = await admin.resource('adminuser').list(
115-
Filters.OR([
115+
Filters.AND([
116116
Filters.LIKE('email', '@gmail.com'),
117-
Filters.AND([
117+
Filters.OR([
118118
Filters.LT('createdAt', '2024-01-01T00:00:00.000Z'),
119119
Filters.GTE('createdAt', '2025-01-01T00:00:00.000Z'),
120120
]),

0 commit comments

Comments
 (0)