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-05-01 13:22:56 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6220cbbbce91c8f2d8c7abc9b7b5da4a5daf394e
6220cbbb
1 parent
6aa2fe46
update createRoom
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
back/src/api/Room/createRoom/createRoom.graphql
back/src/api/Room/createRoom/createRoom.js
back/src/api/Room/createRoom/createRoom.graphql
0 → 100644
View file @
6220cbb
type Mutation {
createRoom(participantsId: [Int], categories: [Int]): Room!
}
back/src/api/Room/createRoom/createRoom.js
0 → 100644
View file @
6220cbb
import
{
prisma
}
from
"../../../utils"
;
export
default
{
Mutation
:
{
createRoom
:
async
(
_
,
args
)
=>
{
const
{
participantsId
,
categories
}
=
args
;
let
newRoom
,
participantId
;
if
(
participantsId
!==
undefined
)
{
newRoom
=
await
prisma
.
room
.
create
({
data
:
{
participants
:
{
connect
:
{
id
:
(
participantId
=
participantsId
.
forEach
(
(
cur
,
_
,
__
)
=>
cur
)),
},
},
},
});
}
if
(
categories
!==
undefined
)
{
newRoom
=
await
prisma
.
room
.
create
({
data
:
{
categories
:
{
connect
:
{
id
:
(
category
=
categories
.
forEach
((
cur
,
_
,
__
)
=>
cur
)),
},
},
},
});
}
return
newRoom
;
},
},
};
Please
register
or
login
to post a comment