Module: faq

Methods

(async, inner) fetchAll()

Fetch all FAQ objects and return them sorted ascending by id. If FAQs are cached, fetch from cache, otherwise fetch from the database and cache them for future use.
Source:

(async, inner) fetchByKeyword(keyword) → {Array}

Fetch FAQs based on input keyword and matching questions. If FAQs are cached, return from cache, otherwise, fetch from database.
Parameters:
Name Type Description
keyword String
Source:
Returns:
matching FAQ objects
Type
Array

(async, inner) findById(id) → {Object}

Get an FAQ object record directly from the database. Skips cache check, designed to be used for admin functionality.
Parameters:
Name Type Description
id Number
Source:
Returns:
faq object
Type
Object

(async, inner) insert(question, answer) → {Object}

Insert a new faq into the database. Flushes the faqs from the cache upon a successful insertion.
Parameters:
Name Type Description
question String
answer String
Source:
Returns:
new faq record
Type
Object

(async, inner) remove(id)

Delete an faq object from the database. Flushes the faqs from the cache upon a successful deletion.
Parameters:
Name Type Description
id Number of faq object
Source:

(async, inner) update(faq) → {Object}

Update an faq object in the database. Flushes the faqs from cache upon a successful update.
Parameters:
Name Type Description
faq Object valid faq object
Source:
Returns:
updated faq object
Type
Object