1.0.6 • Published 4 months ago

design.email-db v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

Functions

getTemplates(page, limit) ⇒ Promise.<Object>

Retrieves a paginated list of templates from the database.

This function connects to the database and fetches a specific page of templates, excluding their HTML content. It also returns the total count of templates available for pagination purposes. If there's an error during the database operation, the function throws an error with the relevant message.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to an object containing the pagination data and a list of templates. The returned object has the structure { page, limit, count, templates }.
Throws:

  • Error If there is an issue during the database operation, an error is thrown with the specific error message.
ParamTypeDefaultDescription
pagenumber1The page number of the templates to retrieve.
limitnumber10The maximum number of templates to retrieve per page.

getTemplatesByQuery(condition, select, limit) ⇒ Promise.<Array>

Retrieves templates based on the specified query conditions.

Kind: global function
Returns: Promise.<Array> - A promise that resolves to an array of templates matching the conditions.
Throws:

  • Error If there is an error during database operation.
ParamTypeDefaultDescription
conditionObjectThe query conditions to filter the templates.
selectObject | nullSpecific fields to select in the returned documents.
limitnumber | nullLimit on the number of templates to retrieve.

getTemplate(id) ⇒ Promise.<Object>

Retrieves a specific template by its ID.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to an object containing the template data. Returns success status and data, or failure status and error message.

ParamTypeDescription
idstringThe unique identifier of the template.

deleteTemplate(id) ⇒ Promise.<Object>

Deletes a specific template by its ID.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the deletion result. Returns the deleted data or an error message if failed.

ParamTypeDescription
idstringThe unique identifier of the template to delete.

deleteTemplates(ids) ⇒ Promise.<Object>

Deletes multiple templates based on their IDs.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the result of the deletion operation. Indicates success or failure and includes data or error message.

ParamTypeDescription
idsArray.<string>An array of template IDs to delete.

updateTemplate(condition, data) ⇒ Promise.<Object>

Updates a template based on the given condition.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the updated template document.
Throws:

  • Error If there is an error during the update operation.
ParamTypeDescription
conditionObjectThe conditions to find the template to update.
dataObjectThe data to be updated in the template.

updateTemplateById(condition, data) ⇒ Promise.<Object>

Updates a specific template by its ID.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the updated template document.
Throws:

  • Error If there is an error during the update operation.
ParamTypeDescription
conditionObjectThe condition to find the template (usually the ID).
dataObjectThe data to update in the template.

updateManyTemplates(condition, updateData) ⇒ Promise.<Object>

Updates multiple templates based on the given condition.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the result of the update operation.
Throws:

  • Error If there is an error during the update operation.
ParamTypeDescription
conditionObjectThe conditions to find the templates to update.
updateDataObjectThe data to be updated in the templates.
1.0.6

4 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago