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-25 00:02:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b444e714ac437e32272f8f527cbdaeb75b826794
b444e714
1 parent
7b1bc86c
create wholeMessage resolver
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
back/src/api/Chat/wholeMessage/wholeMessage.js
back/src/api/Chat/wholeMessage/wholeMessage.js
0 → 100644
View file @
b444e71
import
{
prisma
,
isAuthenticated
}
from
"../../../utils"
;
export
default
()
=>
{
Mutation
:
{
wholeMessage
:
async
(
_
,
args
,
{
request
})
=>
{
isAuthenticated
(
request
);
const
{
user
}
=
request
;
const
{
message
,
roomId
}
=
args
;
let
room
=
await
prisma
.
room
.
findOne
({
where
:
{
id
:
roomId
,
},
});
let
messageObj
=
await
prisma
.
message
.
create
({
data
:
{
text
:
message
,
sender
:
{
connect
:
{
id
:
user
.
id
,
},
},
},
});
if
(
room
!==
undefined
||
room
!==
null
)
{
// 방이 존재하는 경우
room
=
await
prisma
.
room
.
update
({
where
:
{
id
:
roomId
,
},
data
:
{
messages
:
{
connect
:
{
id
:
messageObj
.
id
,
},
},
},
});
}
return
messageObj
;
};
}
};
Please
register
or
login
to post a comment