Open
Description
So according to https://github.com/hoodiehq/hoodie-account-server-api#apiaccountsadd calling api.accounts.add()
like this:
api.accounts.add({
username: 'pat',
password: 'dontstopbelievin'
})
should create a user document with the properties signedUpAt
and createdAt
set to, well, the timestamp the doc was created. However, if you do it, they are not set.
The code just takes it from the passed properties and in the smoke test both properties are passed to the call, so that works.
So this is either:
- A legit bug and we should have default values for this, kinda like this (omitting tests for this):
diff --git a/lib/accounts/add.js b/lib/accounts/add.js
index 7fd89b4..a12720d 100644
--- a/lib/accounts/add.js
+++ b/lib/accounts/add.js
@@ -22,8 +22,8 @@ function addAccount (state, properties, options) {
type: 'user',
name: properties.username,
password: properties.password,
- createdAt: properties.createdAt,
- signedUpAt: properties.signedUpAt,
+ createdAt: properties.createdAt || new Date(),
+ signedUpAt: properties.signedUpAt || new Date(),
roles: [
'id:' + accountId
].concat(properties.roles || [])
- A documentation issue where we might wanna extend the documentation with the other passable properties and explain what happens if you don't set them.
Metadata
Metadata
Assignees
Labels
No labels