@@ -30,7 +30,14 @@ router.post('/', async (req, res) => {
})
await ban.setUser(user)
- res.json(ban.toJSON())
+ let ret = await ban.reload({
+ include: [{
+ model: User,
+ attributes: ['username', 'description', 'color', 'createdAt']
+ }]
+ })
+
+ res.json(ret.toJSON())
} catch (e) {
if(e instanceof Sequelize.ValidationError) {
res.status(400)
@@ -95,6 +95,7 @@ describe('Ban', () => {
res.should.be.json
res.should.have.status(200)
+ res.body.should.have.deep.property('User.username', 'useraccount')
let ban = await Ban.findById(1)
ban.should.have.property('canCreatePosts', false)