update logger

This commit is contained in:
Barry Low committed 2018-10-30 21:34:00 -07:00
1 parent 2449c642d2
commit 94c962cd44
12 files changed
+46 -29

No files matched your search

+12 -6
View File
@@ -4,7 +4,8 @@ import TEAMS_CONNECTIONS_FRAGMENT from '../../fragments/TeamsConnectionsFragment
import TEAMS_FRAGMENT from '../../fragments/TeamsFragment'
export const teams = async (parent, args, ctx, info) => {
logger.info('teams: ', ctx.request.res)
logger.info('teams')
console.log('teams')
return ctx.db.query.teamsConnection({}, TEAMS_CONNECTIONS_FRAGMENT)
}
@@ -20,15 +21,20 @@ export const teamWithRole = async (parent, { teamId, role }, ctx, info) => {
return ctx.db.query.teamsConnection({where: {AND: [{id: teamId},{members_some:{role: role}}]}, first:1}, info)
}
export const teamsByOwner = async (parent, { ownerId }, ctx, info) => {
export const teamsByOwner = async (parent, args, ctx, info) => {
logger.info('teamsByOwner')
logger.info(ctx.req.headers)
logger.info(ctx.req.token)
return ctx.db.query.teams({where: { owner: ownerId }, orderBy:'updatedAt_DESC'}, TEAMS_FRAGMENT)
const authId = ctx.request.headers.userid
if (!authId) {
throw new AuthenticationError()
}
return ctx.db.query.teams({where: { owner: authId }, orderBy:'updatedAt_DESC'}, TEAMS_FRAGMENT)
}
export const teamsByRole = async (parent, args, ctx, info) => {
const authId = ctx.request.userId
const authId = ctx.request.headers.userid
if (!authId) {
throw new AuthenticationError()
}
let teamAdmin
try {
teamAdmin= await ctx.db.query.teams({where: {members_some: {AND: [{member: {authId: authId}, role_not:'MEMBER'}]}}}, TEAMS_FRAGMENT)