0.2.7 • Published 10 years ago
epha-model v0.2.7
epha-Model
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.
- identity
- domain
- subject
- model.subject.create()
- model.subject.findById()
- model.subject.findByIdentity()
- model.subject.findByDomain()
- subjectResource
- model.subjectResource.findByType()
- model.subjectResource.findByTypeAndDateRange()
- model.subjectResource.findAll()
- resource
- subResource
- model.subResource.create()
- model.subResource.findByParentResource()
- model.subResource.fetchByParentResource()
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