import {where, scope} from "./baseFields"; import {ModelType} from "sequelize"; import {GraphQLFieldConfigArgumentMap} from "graphql"; import attributeFields from "./attributeFields"; export default function (model: ModelType) { const result: GraphQLFieldConfigArgumentMap = {} , keys = model.primaryKeyAttributes; if (keys) { const fields = attributeFields(model, {isInput: true, allowNull: true}); keys.forEach(key => { const attribute = fields[key]; if (attribute) { result[key] = attribute; } }); } // add where and scope Object.assign(result, {scope, where}); return result; }