Skip to content

Commit

Permalink
add Clash test
Browse files Browse the repository at this point in the history
  • Loading branch information
pengchujin committed Feb 24, 2019
1 parent 9be9cad commit fc2bf3f
Show file tree
Hide file tree
Showing 5 changed files with 672 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/api.graphql
Expand Up @@ -111,6 +111,7 @@ type Mutation {
modifySubscribe(id: String, name: String, nodes: [Int]): Message!
getSubscribe(urlKey: String!, client: String): String!
getAllNodes(urlKey: String!, client: String, type: nodeType): String!
getClashX(urlKey: String!): [NodeList]
# cPassword(username: String!, oPassword: String!, nPassword: String ): Modify
# dUser(username: String!): Modify!
}
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -16,6 +16,8 @@
"graphql": "^14.0.2",
"graphql-playground-html": "^1.6.4",
"js-md5": "^0.7.3",
"js-yaml": "^3.12.1",
"json2yaml": "^1.1.0",
"jsonwebtoken": "^8.3.0",
"koa": "^2.6.1",
"koa-graphql": "^0.7.5",
Expand Down
10 changes: 10 additions & 0 deletions src/resolvers/mutation.ts
Expand Up @@ -198,3 +198,13 @@ export async function getAllNodes(_obj, { urlKey, client, type },ctx){
}
return generateBase64(nodes, client)
}

export async function getClashX(_obj, { urlKey },ctx) {
const repository = ctx.db.getRepository(Node)
const userRepository = ctx.db.getRepository(User)
let user = await userRepository.findOne({id: urlKey})
let nodes = await repository.find({where: {user: user}, order: {
id: "DESC"
}})
return nodes
}

0 comments on commit fc2bf3f

Please sign in to comment.