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-20 17:47:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d41db0fc4b07cc2e6cb8c05745eed45782c613ca
d41db0fc
1 parent
6ae64571
update createRoom resolver and typedef
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
22 deletions
back/src/api/Room/createRoom/createRoom.graphql
back/src/api/Room/createRoom/createRoom.js
back/src/api/Room/createRoom/createRoom.graphql
View file @
d41db0f
type Mutation {
createRoom(
participantsId: [Int], categories: [Int],
name: String!): Room!
createRoom(name: String!): Room!
}
...
...
back/src/api/Room/createRoom/createRoom.js
View file @
d41db0f
import
{
prisma
}
from
"../../../utils"
;
import
{
prisma
,
isAuthenticated
}
from
"../../../utils"
;
export
default
{
Mutation
:
{
createRoom
:
async
(
_
,
args
)
=>
{
const
{
participantsId
,
categories
,
name
}
=
args
;
let
newRoom
,
participantId
;
if
(
participantsId
!==
undefined
)
{
createRoom
:
async
(
_
,
args
,
{
request
})
=>
{
isAuthenticated
(
request
);
const
{
name
}
=
args
;
const
{
user
}
=
request
;
let
newRoom
;
if
(
name
!==
undefined
)
{
newRoom
=
await
prisma
.
room
.
create
({
data
:
{
participants
:
{
connect
:
{
id
:
(
participantId
=
participantsId
.
forEach
(
(
cur
,
_
,
__
)
=>
cur
)),
},
},
name
,
},
});
}
if
(
categories
!==
undefined
)
{
newRoom
=
await
prisma
.
room
.
create
({
data
:
{
categories
:
{
participants
:
{
connect
:
{
id
:
(
category
=
categories
.
forEach
((
cur
,
_
,
__
)
=>
cur
))
,
id
:
user
.
id
,
},
},
name
,
},
});
}
...
...
Please
register
or
login
to post a comment