Skip to content

Commit

Permalink
create user
Browse files Browse the repository at this point in the history
  • Loading branch information
tacyarg committed Oct 6, 2019
1 parent abe90ae commit 89b2b4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions libs/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ module.exports = ({
assert(token, 'token required')
const { userid } = await tokens.get(token)

const { type } = await users.get(providerid)
const provider = await users.get(providerid)
assert(provider.userid !== userid, 'You cannot subscribe to this provider.')
assert(
type === 'provider',
provider.type === 'provider',
'You may only subscribe to provider accounts.'
)

Expand Down
2 changes: 1 addition & 1 deletion models/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = async con => {
.coerceTo('array')
return table.run(q)
},
async create(username, type, meta = {}) {
async create(username, type = 'user', meta = {}) {
assert(username, 'username required')
username = username.toLowerCase()
const u = await table.hasBy('username', username)
Expand Down

0 comments on commit 89b2b4a

Please sign in to comment.