Skip to content

Instantly share code, notes, and snippets.

@agutoli
Created December 22, 2016 17:58
Show Gist options
  • Save agutoli/d2e719deed0089fb4af5d5249fddf95b to your computer and use it in GitHub Desktop.
Save agutoli/d2e719deed0089fb4af5d5249fddf95b to your computer and use it in GitHub Desktop.
Simple example of entity
import Speck from 'speck-entity';
import PropTypes from 'prop-types';
export class UserEntity extends Speck {
static SCHEMA = {
id: PropTypes.string.isRequired,
email: PropTypes.string.isRequired,
lastName: PropTypes.string.isRequired,
firstName: PropTypes.string.isRequired,
profileImageUrl: PropTypes.string.isRequired,
universalProfileId: PropTypes.string.isRequired
};
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
}
export class UserEntityCollection extends Speck.Collection {
static TYPE = UserEntity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment