UNPKG

actionhero

Version:

The reusable, scalable, and quick node.js API server for stateless and stateful applications

24 lines (23 loc) 747 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateChatRoom = void 0; const index_1 = require("./../index"); class CreateChatRoom extends index_1.Action { constructor() { super(...arguments); this.name = "createChatRoom"; this.description = "I will create a chatroom with the given name"; this.inputs = { name: { required: true }, }; } async run({ params }) { let didCreate = false; if (!(await index_1.chatRoom.exists(params.name))) { await index_1.chatRoom.add(params.name); didCreate = true; } return { name: params.name, didCreate }; } } exports.CreateChatRoom = CreateChatRoom;