Model for reviews, including the full text.
- Source:
Methods
(async, static) create(reviewObj, optionsopt) → {Review}
Create and save a review and the associated Thing and Teams. If there is no Thing record, this function creates and saves one via Review.findOrCreateThing.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
reviewObj |
Object | object containing the data to associate with this review, as defined in Review schema. |
||||||||||
options |
Object |
<optional> |
options for the created revision Properties
|
- Source:
Returns:
the saved review
- Type
- Review
(async, static) findOrCreateThing(reviewObj) → {Thing}
Locate the review subject (Thing) for a new review, or create and save a new Thing based on the provided URL. This will also perform adapter lookups for external metadata (e.g., from Wikidata).
This function is called from Review.create.
Parameters:
Name | Type | Description |
---|---|---|
reviewObj |
Object | the data associated with the review we're locating or creating a Thing record for |
- Source:
Returns:
the located or created Thing
- Type
- Thing
(async, static) getFeed(optionsopt) → {Array.<Review>}
Get an ordered array of reviews, optionally filtered by user, date, review subject, and other criteria.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Feed selection criteria Properties
|
- Source:
Returns:
the reviews matching the provided criteria
- Type
- Array.<Review>
(async, static) getWithData(id) → {Review}
Get a review by ID, including commonly joined data: the review subject
(thing), the user who created the review, and the teams with which it was
associated. WARNING: since the password is filtered out, any future calls
to saveAll()
must be explicitly parametrized to not include the user, or
the save will throw an error.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | the unique ID to look up |
- Source:
Returns:
the review and associated data
- Type
- Review
(static) validateSocialImage(optionsopt)
Ensure that the social media image specified for this review is associated already with the review subject, or in the list of newly uploaded files. Throws a ReviewError if not.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Validation data Properties
|
- Source:
deleteAllRevisionsWithThing(user) → {Promise}
Delete all revisions of a review including the associated review subject (thing).
Parameters:
Name | Type | Description |
---|---|---|
user |
User | user initiating the action |
- Source:
Returns:
promise that resolves when all content has been deleted
- Type
- Promise
populateUserInfo(user)
Populate virtual fields with permissions for a given user
Parameters:
Name | Type | Description |
---|---|---|
user |
User | the user whose permissions to check |
- Source: