Skip to content

Commit d2e31cd

Browse files
committed
Adding attributes
1 parent e5d6d84 commit d2e31cd

File tree

7 files changed

+20
-2
lines changed

7 files changed

+20
-2
lines changed

sequelize/migrations/01-create-demo-user.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ module.exports = {
3232
phone: {
3333
type: Sequelize.STRING
3434
},
35+
attributes: {
36+
type: Sequelize.JSON,
37+
},
3538
createdAt: {
3639
allowNull: false,
3740
type: Sequelize.DATE

sequelize/migrations/03-create-demo-contact.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = {
1818
email: {
1919
type: Sequelize.JSON,
2020
},
21+
attributes: {
22+
type: Sequelize.JSON,
23+
},
2124
createdAt: {
2225
allowNull: false,
2326
type: Sequelize.DATE

sequelize/migrations/04-create-demo-entity.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ module.exports = {
3030
checkIn: {
3131
type: Sequelize.JSON,
3232
},
33+
attributes: {
34+
type: Sequelize.JSON,
35+
},
3336
createdAt: {
3437
allowNull: false,
3538
type: Sequelize.DATE

src/models/contact.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const contact = (sequelize, DataTypes) => {
3333
},
3434
email: {
3535
type: DataTypes.JSON,
36+
},
37+
attributes: {
38+
type: DataTypes.JSON,
3639
}
3740
},
3841
{

src/models/entity.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const entity = (sequelize, DataTypes) => {
3030
},
3131
description: {
3232
type: DataTypes.STRING
33+
},
34+
attributes: {
35+
type: DataTypes.JSON,
3336
}
3437
},
3538
{

src/models/user.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ const user = (sequelize, DataTypes) => {
3232
},
3333
phone: {
3434
type: DataTypes.STRING
35-
}
35+
},
36+
attributes: {
37+
type: DataTypes.JSON,
38+
}
3639
},
3740
{
3841
schema: process.env.DATABASE_SCHEMA

src/routes/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ router.get('/', utils.authMiddleware, async (req, res) => {
7171
let message;
7272
try {
7373
const users = await req.context.models.User.findAll({
74-
attributes: ['id', 'email', 'roles', 'displayName', 'phone', 'createdAt', 'updatedAt']
74+
attributes: ['id', 'email', 'roles', 'displayName', 'phone', 'attributes', 'createdAt', 'updatedAt']
7575
});
7676

7777
for (const user of users) {

0 commit comments

Comments
 (0)