1.2.2 • Published 5 years ago

@janiscommerce/active-client v1.2.2

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

active-client

Build Status Coverage Status

ActiveClient is a simple module for getting an Active Client from a field and a value. The module only has one method and a Model for the get.

Installation

npm install @janiscommerce/active-client

Settings

This package uses the Settings package for handle settings. The setting key is clients and the available settings are the following

SettingDefault ValueDescription
databaseKey_defaultThe database key from DB configuration
tableclientsThe clients table name

API

  • getByField(field, value) ASYNCHRONOUS, Search the client by a field and value given.
  • field: type String, the field name. eg. 'name'.
  • value: type String|Integer, the field value. eg. 'foo'.

Returns a Object with the client found or false if client not found for field with that value.

Usage

const ActiveClient = require('@janiscommerce/active-client');

const client = await ActiveClient.getByField('name', 'client-name');

/**
	Expected output:
	{
		id: 1,
		name: 'client-name',
		status: 5
	}
 */
1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago