Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-06-16 20:22:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0e5fb44a58f4baf30011f041514fc9b3a7def522
0e5fb44a
1 parent
1e8a5243
update addCategory
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
back/src/api/Category/addCategory/addCategory.js
back/src/api/Category/addCategory/addCategory.js
View file @
0e5fb44
import
{
prisma
}
from
"../../../utils"
;
import
{
prisma
,
isAuthenticated
}
from
"../../../utils"
;
import
{
NEW_CATEGORY
}
from
"../../../topics"
;
export
default
{
Mutation
:
{
addCategory
:
async
(
_
,
args
)
=>
{
addCategory
:
async
(
_
,
args
,
{
request
,
pubsub
})
=>
{
isAuthenticated
(
request
);
const
{
name
}
=
args
;
const
newCategory
=
await
prisma
.
category
.
create
({
data
:
{
name
,
},
});
if
(
newCategory
!==
undefined
)
{
pubsub
.
publish
(
NEW_CATEGORY
,
{
subCategory
:
newCategory
});
}
return
newCategory
;
},
},
...
...
Please
register
or
login
to post a comment