Fixes #7
This commit is contained in:
1 parent
9275e0fd34
commit
0317b0cd06
5 files changed
+45
-52
No files matched your search
@@ -108,7 +108,6 @@ class ProfileSheet extends Component {
|
||||
e.preventDefault()
|
||||
this.props.updateUserMutation({
|
||||
variables: {
|
||||
id: this.state.id,
|
||||
firstName: this.state.firstName,
|
||||
middleName: this.state.middleName,
|
||||
lastName: this.state.lastName,
|
||||
|
||||
@@ -60,7 +60,6 @@ class YourReferrer extends Component {
|
||||
|
||||
this.props.updateReferrerMutation({
|
||||
variables: {
|
||||
id: this.state.id,
|
||||
referrerId: referrerUser.id
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
const { createLogger, format, transports } = require('winston')
|
||||
const { combine, timestamp, simple } = format
|
||||
|
||||
const options = {
|
||||
file: {
|
||||
level: 'info',
|
||||
filename: '../logs/app.log',
|
||||
handleExceptions: true,
|
||||
json: true,
|
||||
maxsize: 5242880, // 5MB
|
||||
maxFiles: 5,
|
||||
colorize: false,
|
||||
timestamp: true
|
||||
},
|
||||
console: {
|
||||
level: 'debug',
|
||||
handleExceptions: true,
|
||||
json: false,
|
||||
colorize: true,
|
||||
timestamp: true
|
||||
}
|
||||
}
|
||||
|
||||
const logger = createLogger({
|
||||
level: 'info',
|
||||
format: combine(
|
||||
timestamp({
|
||||
format: 'YYYY-MM-DD HH:mm:ss'
|
||||
}),
|
||||
simple()
|
||||
),
|
||||
transports: [
|
||||
new transports.File(options.file),
|
||||
new transports.Console(options.console)
|
||||
],
|
||||
exitOnError: false // do not exit on handled exceptions
|
||||
})
|
||||
|
||||
module.exports = logger
|
||||
@@ -112,7 +112,6 @@ const getRolesQuery = gql`
|
||||
`
|
||||
const updateUserMutation = gql`
|
||||
mutation(
|
||||
$id: ID!,
|
||||
$firstName:String,
|
||||
$middleName:String,
|
||||
$lastName:String,
|
||||
@@ -124,7 +123,6 @@ mutation(
|
||||
)
|
||||
{
|
||||
users_UpdateUser (
|
||||
id: $id,
|
||||
firstName:$firstName,
|
||||
middleName: $middleName,
|
||||
lastName: $lastName,
|
||||
@@ -142,12 +140,10 @@ mutation(
|
||||
`
|
||||
const updateReferrerMutation = gql`
|
||||
mutation(
|
||||
$id: ID!,
|
||||
$referrerId:String!
|
||||
)
|
||||
{
|
||||
users_UpdateUserReferrer (
|
||||
id: $id,
|
||||
referrerId:$referrerId
|
||||
)
|
||||
{
|
||||
@@ -156,24 +152,7 @@ mutation(
|
||||
}
|
||||
}
|
||||
`
|
||||
const updateUserImagesMutation = gql`
|
||||
mutation(
|
||||
$id: ID!,
|
||||
$avatarHandle:String,
|
||||
$avatarChangeDate:String
|
||||
)
|
||||
{
|
||||
users_UpdateUserImages (
|
||||
id: $id,
|
||||
avatarHandle:$avatarHandle,
|
||||
avatarChangeDate: $avatarChangeDate
|
||||
)
|
||||
{
|
||||
id
|
||||
alias
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export {
|
||||
getUsersQuery,
|
||||
getUserByAuthIdQuery,
|
||||
@@ -182,6 +161,5 @@ export {
|
||||
getUsersBySearchFields,
|
||||
getDescendentsQuery,
|
||||
updateUserMutation,
|
||||
updateReferrerMutation,
|
||||
updateUserImagesMutation
|
||||
updateReferrerMutation
|
||||
}
|
||||
+4
-26
@@ -218,7 +218,6 @@ const Mutation = new GraphQLObjectType({
|
||||
updateUser: {
|
||||
type: UserType,
|
||||
args: {
|
||||
id: {type: new GraphQLNonNull(GraphQLID)},
|
||||
firstName: {type: GraphQLString},
|
||||
middleName: {type: GraphQLString},
|
||||
lastName: {type: GraphQLString},
|
||||
@@ -228,9 +227,9 @@ const Mutation = new GraphQLObjectType({
|
||||
isDataAnalyst: {type: GraphQLInt},
|
||||
roleId: {type: new GraphQLNonNull(GraphQLString)}
|
||||
},
|
||||
resolve (parent, args) {
|
||||
resolve (parent, args, context) {
|
||||
let key = {
|
||||
_id: args.id
|
||||
_id: context.userId
|
||||
}
|
||||
|
||||
let updatedUser = {
|
||||
@@ -247,35 +246,14 @@ const Mutation = new GraphQLObjectType({
|
||||
return User.update(key, updatedUser)
|
||||
}
|
||||
},
|
||||
updateUserImages: {
|
||||
type: UserType,
|
||||
args: {
|
||||
id: {type: new GraphQLNonNull(GraphQLID)},
|
||||
avatarHandle: {type: GraphQLString},
|
||||
avatarChangeDate: {type: GraphQLString}
|
||||
},
|
||||
resolve (parent, args) {
|
||||
let key = {
|
||||
_id: args.id
|
||||
}
|
||||
|
||||
let updatedUser = {
|
||||
avatarHandle: args.avatarHandle,
|
||||
avatarChangeDate: args.avatarChangeDate
|
||||
}
|
||||
|
||||
return User.update(key, updatedUser)
|
||||
}
|
||||
},
|
||||
updateUserReferrer: {
|
||||
type: UserType,
|
||||
args: {
|
||||
id: {type: new GraphQLNonNull(GraphQLID)},
|
||||
referrerId: {type: GraphQLString}
|
||||
},
|
||||
resolve (parent, args) {
|
||||
resolve (parent, args, context) {
|
||||
let key = {
|
||||
_id: args.id,
|
||||
_id: context.userId,
|
||||
referrerId: null
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user