0.2.7 • Published 9 years ago

epha-model v0.2.7

Weekly downloads
60
License
-
Repository
github
Last release
9 years ago

epha-Model

Build Status Dependency Status devDependency Status

Overview

API

All the following examples assume that you got a client for a specific endpoint:

var model = require("epha-model")("local"); 

Optionally you can overwrite certain functions:

//replace SEPARATOR
model.SEPARATOR = "#"; //defaults to ":"

//set your own saltedHash method
model.saltedHash = crypto.saltedHash;

//set your own uid generator
model.uid = crypto.uid; 

Unless otherwise stated, all methods return ES6 Promises. See MDN for details.

  1. identity
  1. domain
  1. subject
  1. subjectResource
  1. resource
  1. subResource

client.identity.create(data)

Create a new identity. Adds an id calling client.uid().

model.identity.create({
  birthDate: "1980-01-01",
  gender: "male",
  state: "Zürich",
  email: "marco.egbring@epha.ch",
  password: "pass",
  firstName: "Marco",
  lastName: "Egbring"
});

client.identity.findByEmail(email)

Finds an identity by email.

model.identity.findByEmail("marco.egbring@epah.ch");

Rejects with an error (err.code = not-found) if no identity exists.

client.identity.findById(id)

Finds an identity by id.

model.identity.findById("xyz");

Rejects with an error (err.code = not-found) if no identity exists.

0.2.7

9 years ago

0.2.6

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago