11import { StatusCodes } from "http-status-codes" ;
22import { ChatroomService } from "../service/chatroom.service.js" ;
33import { CreateChatroomDto } from "../dto/chatroom.dto.js" ;
4- import { ShowChatroomDto } from "../dto/chatroom.dto.js" ;
4+ import { GetChatroomDto } from "../dto/chatroom.dto.js" ;
55import { DeleteChatroomDto } from "../dto/chatroom.dto.js" ;
66import { parseWithBigInt , stringifyWithBigInt } from "../../bigintJson.js" ;
77
88export const createChatroom = async ( req , res , next ) => {
99 try {
10+ const consumerId = BigInt ( req . user . userId ) ;
11+
1012 const dto = new CreateChatroomDto ( {
11- consumerId : BigInt ( req . body . consumerId ) ,
13+ consumerId : consumerId ,
1214 artistId : BigInt ( req . body . artistId ) ,
1315 requestId : BigInt ( req . body . requestId ) ,
1416 } ) ;
@@ -22,10 +24,10 @@ export const createChatroom = async (req, res, next) => {
2224 }
2325} ;
2426
25- export const showChatroom = async ( req , res , next ) => {
27+ export const getChatroom = async ( req , res , next ) => {
2628 try {
27- const dto = new ShowChatroomDto ( {
28- consumerId : BigInt ( req . params . consumerId )
29+ const dto = new GetChatroomDto ( {
30+ consumerId : BigInt ( req . user . userId )
2931 } ) ;
3032
3133 const chatrooms = await ChatroomService . getChatroomsByUserId ( dto ) ;
@@ -39,9 +41,12 @@ export const showChatroom = async (req, res, next) => {
3941
4042export const deleteChatrooms = async ( req , res , next ) => {
4143 try {
44+ const userId = BigInt ( req . user . userId ) ;
45+
4246 const dto = new DeleteChatroomDto ( {
4347 chatroomIds : req . body . chatroomIds ,
4448 userType : req . body . userType ,
49+ userId : userId ,
4550 } ) ;
4651
4752 const chatrooms = await ChatroomService . softDeleteChatroomsByUser ( dto ) ;
0 commit comments