0.0.3 • Published 8 years ago

redink-schema v0.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

redink-schema

Simple class for building Redink schemas.

import schema, { hasMany, hasOne, belongsTo } from 'redink-schema';

const user = schema('user', {
  attributes: {
    name: true,
    email: true,
  },
  relationships: {
    blogs: hasMany('blog', 'author'),
  },
});

const blog = schema('blog', {
  attributes: {
    title: true,
    content: true,
    createdOn: true,
  },
  relationships: {
    author: belongsTo('user', 'blogs'),
  },
});