// Define the Feathers schema for service `users`. (Can be re-generated.) // !code: imports // !end // !code: init // !end // Define the model using JSON-schema let schema = { // ! code: schema_header title: 'Users', description: 'Users database.', // !end // !code: schema_definitions // !end // Required fields. required: [ // !code: schema_required 'email', 'firstName', 'lastName', 'roleId' // !end ], // Fields with unique values. uniqueItemProperties: [ // !code: schema_unique // !end ], // Fields in the model. properties: { // !code: schema_properties id: { type: 'ID' }, email: { minLength: 8, maxLength: 40, faker: 'internet.email' }, firstName: { minLength: 2, maxLength: 15, faker: 'name.firstName' }, lastName: { minLength: 2, maxLength: 30, faker: 'name.lastName' }, password: { chance: { hash: { length: 60 } } }, roleId: { type: 'ID', faker: { fk: 'roles:random' } }, // !end }, // !code: schema_more // !end }; // Define optional, non-JSON-schema extensions. let extensions = { // GraphQL generation. graphql: { // !code: graphql_header name: 'User', service: { sort: { lastName: 1, firstName: 1 }, }, // sql: { // sqlTable: 'Users', // uniqueKey: '_id', // sqlColumn: { // __authorId__: '__author_id__', // }, // }, // !end discard: [ // !code: graphql_discard // !end ], add: { // !code: graphql_add fullName: { type: 'String!', args: false }, role: { type: 'Role', args: true, relation: { ourTable: 'roleId', otherTable: '_id' } }, teams: { type: '[Team!]', args: true, relation: { ourTable: '_id', otherTable: 'memberIds' }, sort: { name: 1 } }, // !end }, // !code: graphql_more // !end }, }; // !code: more // !end let moduleExports = { schema, extensions, // !code: moduleExports // !end }; // !code: exports // !end export default moduleExports; // !code: funcs // !end // !code: end // !end