mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
User role must be set
This commit is contained in:
parent
99b6254303
commit
e77bf31470
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
coverImg: { type: 'string', allow: [null] },
|
coverImg: { type: 'string', allow: [null] },
|
||||||
deleted: { type: 'boolean', default: false },
|
deleted: { type: 'boolean', default: false },
|
||||||
disabled: { type: 'boolean', default: false },
|
disabled: { type: 'boolean', default: false },
|
||||||
role: 'string',
|
role: { type: 'string', required: true, default: 'user' },
|
||||||
publicKey: 'string',
|
publicKey: 'string',
|
||||||
privateKey: 'string',
|
privateKey: 'string',
|
||||||
wasInvited: 'boolean',
|
wasInvited: 'boolean',
|
||||||
|
|||||||
20
backend/src/models/spec/User.spec.js
Normal file
20
backend/src/models/spec/User.spec.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import Factory from '../../seed/factories'
|
||||||
|
import { neode } from '../../bootstrap/neo4j'
|
||||||
|
|
||||||
|
const factory = Factory()
|
||||||
|
const instance = neode()
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await factory.cleanDatabase()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('role', () => {
|
||||||
|
it('defaults to `user`', async () => {
|
||||||
|
const user = await instance.create('User', { name: 'John' })
|
||||||
|
await expect(user.toJson()).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
role: 'user',
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -9,7 +9,7 @@ type User {
|
|||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
disabledBy: User @relation(name: "DISABLED", direction: "IN")
|
disabledBy: User @relation(name: "DISABLED", direction: "IN")
|
||||||
role: UserGroup
|
role: UserGroup!
|
||||||
publicKey: String
|
publicKey: String
|
||||||
invitedBy: User @relation(name: "INVITED", direction: "IN")
|
invitedBy: User @relation(name: "INVITED", direction: "IN")
|
||||||
invited: [User] @relation(name: "INVITED", direction: "OUT")
|
invited: [User] @relation(name: "INVITED", direction: "OUT")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user