Created
December 22, 2016 17:58
-
-
Save agutoli/d2e719deed0089fb4af5d5249fddf95b to your computer and use it in GitHub Desktop.
Simple example of entity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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