Created
July 9, 2019 13:22
-
-
Save shipcake/cd2fc59486fd6e7f15d6a59072928a0b to your computer and use it in GitHub Desktop.
apollo schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { gql} = require('apollo-server-express') | |
const account = gql` | |
type token { | |
token:String, | |
date:String, | |
country:String, | |
city:String, | |
ip:String, | |
} | |
type member { | |
uid:String, | |
username:String, | |
password:String, | |
name:String, | |
lastname:String, | |
address:String, | |
phone:String, | |
mobile:String, | |
usertype:String, | |
create:String, | |
modifieddate:String, | |
token:[token] | |
} | |
type Account { | |
storeuid:String, | |
domain:String, | |
name:String, | |
lastname:String, | |
member:[member] | |
} | |
extend type Query { | |
show_token:[token] | |
} | |
` | |
module.exports = account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { account } = require('../../../../mongo/model') //import categories mongo model | |
const show_token = async (_,req, ctx) => { | |
let Find = await account.findOne({ "_id": ctx.token.storeuid }).exec((err,doc)=> { | |
let Filter = doc.member.filter(e=>e.uid == ctx.token.uid) | |
let Get = Filter.map(e=>e.token) | |
console.log(Get) | |
return Get | |
}) | |
return Find | |
} | |
module.exports = { show_token} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment