fixed date format

This commit is contained in:
Grzegorz Leoniec 2018-11-15 12:44:41 +01:00
parent 8b0be5fb89
commit 59e9b9df1d
2 changed files with 8 additions and 16 deletions

View File

@ -3,40 +3,28 @@ import format from 'date-fns/format'
export default {
Mutation: {
CreateUser: async (resolve, root, args, context, info) => {
try {
args.createdAt = format(new Date())
} catch (err) {}
args.createdAt = (new Date()).toISOString()
args.disabled = false
args.deleted = false
const result = await resolve(root, args, context, info)
return result
},
CreatePost: async (resolve, root, args, context, info) => {
try {
args.createdAt = format(new Date())
} catch (err) {}
args.createdAt = (new Date()).toISOString()
args.disabled = false
args.deleted = false
const result = await resolve(root, args, context, info)
return result
},
CreateComment: async (resolve, root, args, context, info) => {
try {
args.createdAt = format(new Date())
} catch (err) {}
args.createdAt = (new Date()).toISOString()
args.disabled = false
args.deleted = false
const result = await resolve(root, args, context, info)
return result
},
CreateOrganization: async (resolve, root, args, context, info) => {
try {
args.createdAt = format(new Date())
} catch (err) {}
args.createdAt = (new Date()).toISOString()
args.disabled = false
args.deleted = false
const result = await resolve(root, args, context, info)

View File

@ -1,6 +1,7 @@
import { rule, shield, and, or, not, allow } from 'graphql-shield'
const isAuthenticated = rule()(async (parent, args, ctx, info) => {
// TODO: how to get this working while seeding?
console.log('isSeeding', process.env.IS_SEEDING)
if (process.env.IS_SEEDING === true) {
return true
@ -8,6 +9,7 @@ const isAuthenticated = rule()(async (parent, args, ctx, info) => {
return ctx.user !== null
})
const isOwner = rule()(async (parent, args, ctx, info) => {
// TODO: how to get this working while seeding?
console.log('isSeeding', process.env.IS_SEEDING)
if (process.env.IS_SEEDING === true) {
return true
@ -16,6 +18,7 @@ const isOwner = rule()(async (parent, args, ctx, info) => {
return ctx.user.id === parent.id
})
const isAdmin = rule()(async (parent, args, ctx, info) => {
// TODO: how to get this working while seeding?
console.log('isSeeding', process.env.IS_SEEDING)
if (process.env.IS_SEEDING === true) {
return true
@ -23,6 +26,7 @@ const isAdmin = rule()(async (parent, args, ctx, info) => {
return ctx.user.role === 'ADMIN'
})
const isModerator = rule()(async (parent, args, ctx, info) => {
// TODO: how to get this working while seeding?
console.log('isSeeding', process.env.IS_SEEDING)
if (process.env.IS_SEEDING === true) {
return true