module.exports = [
"[project]/.next-internal/server/app/api/room/list/route/actions.js [app-rsc] (server actions loader, ecmascript)", ((__turbopack_context__, module, exports) => {

}),
"[externals]/next/dist/compiled/next-server/app-route-turbo.runtime.dev.js [external] (next/dist/compiled/next-server/app-route-turbo.runtime.dev.js, cjs)", ((__turbopack_context__, module, exports) => {

const mod = __turbopack_context__.x("next/dist/compiled/next-server/app-route-turbo.runtime.dev.js", () => require("next/dist/compiled/next-server/app-route-turbo.runtime.dev.js"));

module.exports = mod;
}),
"[externals]/next/dist/compiled/@opentelemetry/api [external] (next/dist/compiled/@opentelemetry/api, cjs)", ((__turbopack_context__, module, exports) => {

const mod = __turbopack_context__.x("next/dist/compiled/@opentelemetry/api", () => require("next/dist/compiled/@opentelemetry/api"));

module.exports = mod;
}),
"[externals]/next/dist/compiled/next-server/app-page-turbo.runtime.dev.js [external] (next/dist/compiled/next-server/app-page-turbo.runtime.dev.js, cjs)", ((__turbopack_context__, module, exports) => {

const mod = __turbopack_context__.x("next/dist/compiled/next-server/app-page-turbo.runtime.dev.js", () => require("next/dist/compiled/next-server/app-page-turbo.runtime.dev.js"));

module.exports = mod;
}),
"[externals]/next/dist/server/app-render/work-unit-async-storage.external.js [external] (next/dist/server/app-render/work-unit-async-storage.external.js, cjs)", ((__turbopack_context__, module, exports) => {

const mod = __turbopack_context__.x("next/dist/server/app-render/work-unit-async-storage.external.js", () => require("next/dist/server/app-render/work-unit-async-storage.external.js"));

module.exports = mod;
}),
"[externals]/next/dist/server/app-render/work-async-storage.external.js [external] (next/dist/server/app-render/work-async-storage.external.js, cjs)", ((__turbopack_context__, module, exports) => {

const mod = __turbopack_context__.x("next/dist/server/app-render/work-async-storage.external.js", () => require("next/dist/server/app-render/work-async-storage.external.js"));

module.exports = mod;
}),
"[externals]/next/dist/shared/lib/no-fallback-error.external.js [external] (next/dist/shared/lib/no-fallback-error.external.js, cjs)", ((__turbopack_context__, module, exports) => {

const mod = __turbopack_context__.x("next/dist/shared/lib/no-fallback-error.external.js", () => require("next/dist/shared/lib/no-fallback-error.external.js"));

module.exports = mod;
}),
"[project]/src/server/db/index.ts [app-route] (ecmascript)", ((__turbopack_context__) => {
"use strict";

__turbopack_context__.s([
    "addRoom",
    ()=>addRoom,
    "listRoom",
    ()=>listRoom
]);
let rooms = [];
let messages = {};
let nextRoomId = 1;
let nextMessageId = 1;
const addRoom = (roomName, user)=>{
    const roomId = nextRoomId++;
    const newRoom = {
        roomId,
        roomName,
        lastMessage: null,
        creater: user
    };
    rooms.push(newRoom);
    messages[roomId] = [];
    return newRoom.roomId;
};
const listRoom = ()=>{
    return rooms.map((room)=>{
        const roomMessages = messages[room.roomId] || [];
        const lastMessage = roomMessages.length > 0 ? roomMessages[roomMessages.length - 1] : null;
        return {
            roomId: room.roomId,
            roomName: room.roomName,
            lastMessage: lastMessage
        };
    });
};
}),
"[project]/src/app/api/room/list/route.ts [app-route] (ecmascript)", ((__turbopack_context__) => {
"use strict";

__turbopack_context__.s([
    "default",
    ()=>handler
]);
var __TURBOPACK__imported__module__$5b$project$5d2f$src$2f$server$2f$db$2f$index$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/src/server/db/index.ts [app-route] (ecmascript)");
;
function handler(req, res) {
    if (req.method !== 'GET') {
        return res.status(405).json({
            code: 1,
            message: 'Method not allowed'
        });
    }
    try {
        const RoomPreviewList = (0, __TURBOPACK__imported__module__$5b$project$5d2f$src$2f$server$2f$db$2f$index$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["listRoom"])();
        res.status(200).json({
            code: 0,
            data: {
                rooms: RoomPreviewList
            }
        });
    } catch (error) {
        res.status(500).json({
            code: 3,
            message: 'Internal server error'
        });
    }
}
}),
];

//# sourceMappingURL=%5Broot-of-the-server%5D__dd9c9e8e._.js.map