-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated docs port [skip_publish] [deploy_docs]
- Loading branch information
Showing
3 changed files
with
41 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
|
||
const User = require('./models/User'); | ||
module.exports = { | ||
Query: { | ||
async getUsers() { | ||
return await User.find(); | ||
}, | ||
async getUser(_, { id }) { | ||
return await User.findById({_id : id}); | ||
} | ||
const User = require("./models/User"); | ||
module.exports = { | ||
Query: { | ||
async getUsers() { | ||
return await User.find(); | ||
}, | ||
Mutation: { | ||
async createUser(_, { input }) { | ||
const newUser = new User(input); | ||
return await newUser.save(); | ||
}, | ||
async updateUser(_, { id, input }) { | ||
return await User.findByIdAndUpdate(id, input, { new: true }); | ||
}, | ||
async deleteUser(_, { id }) { | ||
return await User.findByIdAndDelete({_id :id}); | ||
} | ||
} | ||
async getUser(_, { id }) { | ||
return await User.findById({ _id: id }); | ||
}, | ||
}, | ||
Mutation: { | ||
async createUser(_, { input }) { | ||
const newUser = new User(input); | ||
return await newUser.save(); | ||
}, | ||
async updateUser(_, { id, input }) { | ||
return await User.findByIdAndUpdate(id, input, { new: true }); | ||
}, | ||
async deleteUser(_, { id }) { | ||
return await User.findByIdAndDelete({ _id: id }); | ||
}, | ||
}, | ||
}; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
|
||
type User { | ||
name: String | ||
email: String | ||
password: String | ||
} | ||
input UserInput { | ||
name: String | ||
email: String | ||
password: String | ||
} | ||
type Query { | ||
getUsers: [User] | ||
getUser(_id : ID): User | ||
|
||
} | ||
type Mutation { | ||
createUser(input: UserInput): User | ||
updateUser(_id: ID, input: UserInput): User | ||
deleteUser(_id: ID): User | ||
} | ||
|
||
|
||
type User { | ||
name: String | ||
email: String | ||
password: String | ||
} | ||
input UserInput { | ||
name: String | ||
email: String | ||
password: String | ||
} | ||
type Query { | ||
getUsers: [User] | ||
getUser(_id: ID): User | ||
} | ||
type Mutation { | ||
createUser(input: UserInput): User | ||
updateUser(_id: ID, input: UserInput): User | ||
deleteUser(_id: ID): User | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start" | ||
"start": "next start -p 3033" | ||
}, | ||
"author": "Sikka Software <[email protected]>", | ||
"license": "MIT", | ||
|