Skip to content

Commit 68a4469

Browse files
Wojciech KrysiakWojciech Krysiak
authored andcommitted
test: add jsonb to example-app
1 parent dda200c commit 68a4469

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

example-app/src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import AdminBro from 'admin-bro'
99
import { buildRouter } from '@admin-bro/express'
1010
import AdminBroSequelize from '@admin-bro/sequelize'
1111

12+
import userAdmin from './users/user.admin'
13+
1214
import connect from './connect'
1315

1416
const PORT = 3000
@@ -19,9 +21,10 @@ const run = async () => {
1921
const app = express()
2022
const admin = new AdminBro({
2123
databases: [sequelize],
22-
resources: [
23-
24-
],
24+
resources: [{
25+
resource: sequelize.models.User,
26+
options: userAdmin,
27+
}],
2528
})
2629

2730
admin.watch()

example-app/src/users/user.admin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ResourceOptions } from 'admin-bro'
2+
3+
const options: ResourceOptions = {
4+
properties: {
5+
json: {
6+
type: 'mixed',
7+
},
8+
},
9+
} as ResourceOptions
10+
11+
export default options

example-app/src/users/user.entity.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ const build = (sequelize: Sequelize) => {
1515
type: DataTypes.STRING,
1616
// allowNull defaults to true
1717
},
18+
json: {
19+
type: DataTypes.JSONB,
20+
defaultValue: { '.': '.' },
21+
},
1822
}, {
1923
// Other model options go here
2024
})

0 commit comments

Comments
 (0)