Skip to content

dhruvangg/design.email-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

Retrieves templates based on the specified query conditions.

getTemplate(id)Promise.<Object>

Retrieves a specific template by its ID.

deleteTemplate(id)Promise.<Object>

Deletes a specific template by its ID.

deleteTemplates(ids)Promise.<Object>

Deletes multiple templates based on their IDs.

updateTemplate(condition, data)Promise.<Object>

Updates a template based on the given condition.

updateTemplateById(condition, data)Promise.<Object>

Updates a specific template by its ID.

updateManyTemplates(condition, updateData)Promise.<Object>

Updates multiple templates based on the given condition.

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.
Param Type Default Description
[page] number 1 The page number of the templates to retrieve.
[limit] number 10 The 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.
Param Type Default Description
condition Object The query conditions to filter the templates.
[select] Object | null Specific fields to select in the returned documents.
[limit] number | null Limit 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.

Param Type Description
id string The 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.

Param Type Description
id string The 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.

Param Type Description
ids Array.<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.
Param Type Description
condition Object The conditions to find the template to update.
data Object The 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.
Param Type Description
condition Object The condition to find the template (usually the ID).
data Object The 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.
Param Type Description
condition Object The conditions to find the templates to update.
updateData Object The data to be updated in the templates.

Releases

No releases published

Packages

No packages published