JSDoc documentation for models
Classes
- VolatileArticle
Article, with no persistence support
- Article ⇐
VolatileArticle
Article with persistence capability via the perseest package
- VolatileFeedback
User feedback, with no persistence support
- Feedback ⇐
VolatileFeedback
Feedback with persistence capability via the perseest package
- VolatileNewspaper
Newspaper, with no persistence support
- Newspaper ⇐
VolatileNewspaper
Newspaper with persistence capability via the perseest package
- VolatileOAuthFeedback
User feedback, with no persistence support
- OAuthFeedback ⇐
VolatileOAuthFeedback
OAuthFeedback with persistence capability via the perseest package
- VolatileOAuthUser
OAuth user entity, with no support for persistence
- OAuthUser ⇐
VolatileOAuthUser
OAuthUser with persistence capability via the perseest package
- VolatileUser
User entity, with no support for persistence
- User ⇐
VolatileUser
User with persistence capability via the perseest package
VolatileArticle
Article, with no persistence support
Kind: global class
new VolatileArticle(opt)
Instantiate a new Article
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.id | integer |
Article univocal ID |
opt.source | integer |
Article newspaper |
opt.title | string |
Article title |
opt.preview | string |
Article short description |
opt.origin | string |
Reference URL to the full article |
opt.topics | Array.<string> |
Treated topics |
opt.created | Date |
Article creation date and time |
volatileArticle.constraints : object
Constraints on Article instance properties
Kind: instance constant of VolatileArticle
Article ⇐ VolatileArticle
Article with persistence capability via the perseest package
Kind: global class
Extends: VolatileArticle
- Article ⇐
VolatileArticle
- new Article()
- instance
- .db
- .constraints :
object
- static
new Article()
Create a new persistent article
article.db
Database configuration for perseest
Kind: instance property of Article
article.constraints : object
Constraints on Article instance properties
Kind: instance constant of Article
Overrides: constraints
Article.multiplex(opt) ⇒ Array.<Article>
Multiplex articles, with a single country
Kind: static method of Article
Returns: Array.<Article>
- An ordered collection of articles
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.uid | number |
Reference user ID |
opt.topic | string |
Topic to multiplex |
opt.countries | Array.<string> |
Countries to multiplex |
opt.oauth | boolean |
Multiplex for OAuth users? |
VolatileFeedback
User feedback, with no persistence support
Kind: global class
new VolatileFeedback(opt)
Create a new feedback
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.account | number |
Related user id |
opt.npaper | number |
Related newspaper ID |
opt.score | number |
Newspaper score |
volatileFeedback.constraints : object
Constraints on Feedback instance properties
Kind: instance constant of VolatileFeedback
Feedback ⇐ VolatileFeedback
Feedback with persistence capability via the perseest package
Kind: global class
Extends: VolatileFeedback
- Feedback ⇐
VolatileFeedback
- new Feedback()
- instance
- .db
- .constraints :
object
- static
new Feedback()
Create a new persistent article
feedback.db
Database configuration for perseest
Kind: instance property of Feedback
feedback.constraints : object
Constraints on Feedback instance properties
Kind: instance constant of Feedback
Overrides: constraints
Feedback.retrieve(account, npaper) ⇒ Promise.<Feedback>
Retrieve a feedback by user/newspaper tuple
Kind: static method of Feedback
Returns: Promise.<Feedback>
- The requested feedback, with a score of 0 if
it does not exist
Param | Type | Description |
---|---|---|
account | number |
User ID |
npaper | number |
Newspaper ID |
VolatileNewspaper
Newspaper, with no persistence support
Kind: global class
- VolatileNewspaper
- new VolatileNewspaper(opt, sourceType, country, info)
- .constraints :
object
- .language() ⇒
string
new VolatileNewspaper(opt, sourceType, country, info)
Instantiate a new Newspaper
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.id | integer |
Newspaper univocal ID |
sourceType | string |
Newspaper type (e.g. RSS, Website…) |
country | string |
Newspaper origin country |
info | object |
Additional metadata for the newspaper |
volatileNewspaper.constraints : object
Constraints on Newspaper instance properties
Kind: instance constant of VolatileNewspaper
volatileNewspaper.language() ⇒ string
Get the language of the newspaper origin country
Kind: instance method of VolatileNewspaper
Returns: string
- The language code for the newspaper
Newspaper ⇐ VolatileNewspaper
Newspaper with persistence capability via the perseest package
Kind: global class
Extends: VolatileNewspaper
- Newspaper ⇐
VolatileNewspaper
- new Newspaper()
- .db
- .constraints :
object
- .language() ⇒
string
new Newspaper()
Create a new persistent newspaper
newspaper.db
Database configuration for perseest
Kind: instance property of Newspaper
newspaper.constraints : object
Constraints on Newspaper instance properties
Kind: instance constant of Newspaper
Overrides: constraints
newspaper.language() ⇒ string
Get the language of the newspaper origin country
Kind: instance method of Newspaper
Overrides: language
Returns: string
- The language code for the newspaper
VolatileOAuthFeedback
User feedback, with no persistence support
Kind: global class
- VolatileOAuthFeedback
- new VolatileOAuthFeedback(opt)
- .oauth ⇒
boolean
- .constraints :
object
new VolatileOAuthFeedback(opt)
Create a new feedback
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.account | number |
Related OAuth user id |
opt.npaper | number |
Related newspaper ID |
opt.score | number |
Newspaper score |
volatileOAuthFeedback.oauth ⇒ boolean
Does the feedback belong to an oauth user? (always true)
Kind: instance property of VolatileOAuthFeedback
volatileOAuthFeedback.constraints : object
Constraints on OAuthFeedback instance properties
Kind: instance constant of VolatileOAuthFeedback
OAuthFeedback ⇐ VolatileOAuthFeedback
OAuthFeedback with persistence capability via the perseest package
Kind: global class
Extends: VolatileOAuthFeedback
- OAuthFeedback ⇐
VolatileOAuthFeedback
- new OAuthFeedback()
- instance
- .db
- .oauth ⇒
boolean
- .constraints :
object
- static
new OAuthFeedback()
Create a new persistent article
oAuthFeedback.db
Database configuration for perseest
Kind: instance property of OAuthFeedback
oAuthFeedback.oauth ⇒ boolean
Does the feedback belong to an oauth user? (always true)
Kind: instance property of OAuthFeedback
Overrides: oauth
oAuthFeedback.constraints : object
Constraints on OAuthFeedback instance properties
Kind: instance constant of OAuthFeedback
Overrides: constraints
OAuthFeedback.retrieve(account, npaper) ⇒ Promise.<OAuthFeedback>
Retrieve a feedback by user/newspaper tuple
Kind: static method of OAuthFeedback
Returns: Promise.<OAuthFeedback>
- The requested feedback, with a score of 0 if
it does not exist
Param | Type | Description |
---|---|---|
account | number |
User ID |
npaper | number |
Newspaper ID |
VolatileOAuthUser
OAuth user entity, with no support for persistence
Kind: global class
- VolatileOAuthUser
- new VolatileOAuthUser(opt)
- .oauth ⇒
boolean
- .constraints :
object
- .toString()
- .export() ⇒
object
new VolatileOAuthUser(opt)
Instantiate a new OAuthUser
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.id | number |
User univocal ID, given by Google |
opt.name | string |
User name, given by Google |
opt.created | Date |
User creation timestamp |
opt.countries | Array.<String> |
Countries in the user preferences |
opt.topics | Array.<String> |
Countries in the user preferences |
volatileOAuthUser.oauth ⇒ boolean
Is the user a OAuth user? (always returns true)
Kind: instance property of VolatileOAuthUser
volatileOAuthUser.constraints : object
Constraints on OAuthUser instance properties
Kind: instance constant of VolatileOAuthUser
volatileOAuthUser.toString()
Return a string representation of the user
Kind: instance method of VolatileOAuthUser
volatileOAuthUser.export() ⇒ object
Kind: instance method of VolatileOAuthUser
Returns: object
- A sharing-safe representation of this user
OAuthUser ⇐ VolatileOAuthUser
OAuthUser with persistence capability via the perseest package
Kind: global class
Extends: VolatileOAuthUser
- OAuthUser ⇐
VolatileOAuthUser
- new OAuthUser()
- .db
- .oauth ⇒
boolean
- .constraints :
object
- .toString()
- .export() ⇒
object
new OAuthUser()
Create a new persistent user
oAuthUser.db
Database configuration for perseest
Kind: instance property of OAuthUser
oAuthUser.oauth ⇒ boolean
Is the user a OAuth user? (always returns true)
Kind: instance property of OAuthUser
Overrides: oauth
oAuthUser.constraints : object
Constraints on OAuthUser instance properties
Kind: instance constant of OAuthUser
Overrides: constraints
oAuthUser.toString()
Return a string representation of the user
Kind: instance method of OAuthUser
Overrides: toString
oAuthUser.export() ⇒ object
Kind: instance method of OAuthUser
Overrides: export
Returns: object
- A sharing-safe representation of this user
VolatileUser
User entity, with no support for persistence
Kind: global class
- VolatileUser
- new VolatileUser(opt)
- instance
- .constraints :
object
- .BCRYPT_SALT_ROUNDS :
number
- .toString()
- .export() ⇒
object
- .setPassword(pass) ⇒
undefined
- .authenticate(pass) ⇒
Promise.<boolean>
- .constraints :
- static
new VolatileUser(opt)
Instantiate a new User
Param | Type | Description |
---|---|---|
opt | object |
Constructor parameters |
opt.id | number |
User univocal ID |
opt.name | string |
Username |
opt.email | string |
User e-mail |
opt.pass | string |
User plaintext password |
opt.hash | string |
User hashed password |
opt.created | Date |
User creation timestamp |
opt.countries | Array.<String> |
Countries in the user preferences |
opt.topics | Array.<String> |
Countries in the user preferences |
volatileUser.constraints : object
Constraints on User instance properties
Kind: instance constant of VolatileUser
volatileUser.BCRYPT_SALT_ROUNDS : number
BCrypt hash cost
Kind: instance constant of VolatileUser
volatileUser.toString()
Return a string representation of the user
Kind: instance method of VolatileUser
volatileUser.export() ⇒ object
Kind: instance method of VolatileUser
Returns: object
- A sharing-safe representation of this user
volatileUser.setPassword(pass) ⇒ undefined
Set user password
Kind: instance method of VolatileUser
Throws:
- Password must be valid
Param | Type | Description |
---|---|---|
pass | string |
Plaintext password |
volatileUser.authenticate(pass) ⇒ Promise.<boolean>
Authenticate a user with a password
Kind: instance method of VolatileUser
Returns: Promise.<boolean>
- true if given password matches, false otherwise
Param | Type | Description |
---|---|---|
pass | string |
User password |
VolatileUser.create(opt) ⇒ VolatileUser
Create a user, hashing its plaintext password if given
Kind: static method of VolatileUser
Returns: VolatileUser
- A new class instance
Param | Type | Description |
---|---|---|
opt | object |
Creation parameters, as for the User constructor |
User ⇐ VolatileUser
User with persistence capability via the perseest package
Kind: global class
Extends: VolatileUser
- User ⇐
VolatileUser
- new User()
- .db
- .constraints :
object
- .BCRYPT_SALT_ROUNDS :
number
- .toString()
- .export() ⇒
object
- .setPassword(pass) ⇒
undefined
- .authenticate(pass) ⇒
Promise.<boolean>
new User()
Create a new persistent user
user.db
Database configuration for perseest
Kind: instance property of User
user.constraints : object
Constraints on User instance properties
Kind: instance constant of User
Overrides: constraints
user.BCRYPT_SALT_ROUNDS : number
BCrypt hash cost
Kind: instance constant of User
Overrides: BCRYPT\_SALT\_ROUNDS
user.toString()
Return a string representation of the user
Kind: instance method of User
Overrides: toString
user.export() ⇒ object
Kind: instance method of User
Overrides: export
Returns: object
- A sharing-safe representation of this user
user.setPassword(pass) ⇒ undefined
Set user password
Kind: instance method of User
Overrides: setPassword
Throws:
- Password must be valid
Param | Type | Description |
---|---|---|
pass | string |
Plaintext password |
user.authenticate(pass) ⇒ Promise.<boolean>
Authenticate a user with a password
Kind: instance method of User
Overrides: authenticate
Returns: Promise.<boolean>
- true if given password matches, false otherwise
Param | Type | Description |
---|---|---|
pass | string |
User password |