Create settings for slack/email

This commit is contained in:
2017-03-04 18:35:27 +00:00
parent e3fd086792
commit 98ed3a970f
11 changed files with 168 additions and 23 deletions

View File

@@ -0,0 +1,23 @@
import DataType from 'sequelize';
import Model from '../sequelize';
const Settings = Model.define('Settings', {
key: {
type: DataType.UUID,
defaultValue: DataType.UUIDV1,
primaryKey: true,
},
slack: {
type: DataType.BOOLEAN,
defaultValue: false,
},
email: {
type: DataType.BOOLEAN,
defaultValue: false,
},
});
export default Settings;

View File

@@ -0,0 +1,12 @@
import { GraphQLList as List } from 'graphql';
import SettingsItemType from '../types/SettingsItemType';
import Settings from '../models/Settings';
const settings = {
type: new List(SettingsItemType),
resolve() {
return Settings.findAll();
},
};
export default settings;

View File

@@ -7,6 +7,7 @@ import me from './queries/me';
import getAllPersons from './queries/getAllPersons';
import getPersonByKey from './queries/getPersonByKey';
import getPersonsByPassword from './queries/getPersonsByPassword';
import settings from './queries/settings';
const schema = new Schema({
query: new ObjectType({
@@ -16,6 +17,7 @@ const schema = new Schema({
getAllPersons,
getPersonByKey,
getPersonsByPassword,
settings,
},
}),
});

View File

@@ -0,0 +1,17 @@
import {
GraphQLObjectType as ObjectType,
GraphQLID as ID,
GraphQLBoolean as BooleanType,
GraphQLNonNull as NonNull,
} from 'graphql';
const SettingsItemType = new ObjectType({
name: 'SettingsItem',
fields: {
key: { type: new NonNull(ID) },
slack: { type: BooleanType },
email: { type: BooleanType },
},
});
export default SettingsItemType;