@coko/server
Version:
Reusable server for use by Coko's projects
46 lines • 1.42 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const base_model_1 = __importDefault(require("../base.model"));
const chatMessage_model_1 = __importDefault(require("../chatMessage/chatMessage.model"));
const types_1 = require("../_helpers/types");
class ChatChannel extends base_model_1.default {
chatType;
relatedObjectId;
messages;
constructor() {
super();
this.type = 'chatChannel';
}
static get tableName() {
return 'chatChannels';
}
static get schema() {
return {
type: 'object',
required: ['chatType', 'relatedObjectId'],
properties: {
chatType: {
type: 'string',
},
relatedObjectId: types_1.id,
},
};
}
static get relationMappings() {
return {
messages: {
relation: base_model_1.default.HasManyRelation,
modelClass: chatMessage_model_1.default,
join: {
from: 'chatMessages.chatChannelId',
to: 'chatChannels.id',
},
},
};
}
}
exports.default = ChatChannel;
//# sourceMappingURL=chatChannel.model.js.map