Code Monkey home page Code Monkey logo

design.email-database's Introduction

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.

design.email-database's People

Contributors

dhruvangg avatar

Stargazers

 avatar Kunal SIngh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.