0.2.7 • Published 10 years ago

epha-model v0.2.7

Weekly downloads
60
License
-
Repository
github
Last release
10 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

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago