-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from lluisd/logging_mongodb
stream title log
- Loading branch information
Showing
7 changed files
with
54 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const mongoose = require('mongoose') | ||
const Schema = mongoose.Schema | ||
const db = require("../db.openai")(); | ||
|
||
/* Log Schema */ | ||
const TitleLogSchema = new Schema({ | ||
roomId: { | ||
type: Number, | ||
required: true | ||
}, | ||
title: { | ||
type: String, | ||
required: true | ||
}, | ||
}) | ||
|
||
const twitchDB = db.useDb('twitch'); | ||
module.exports = twitchDB.model('titleLog', TitleLogSchema, 'titleLog') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
const dbManager = require('../helpers/dbmanager') | ||
const moment = require('moment') | ||
|
||
async function logMessage(roomId, username, text) { | ||
async function logChatMessage(roomId, username, text) { | ||
let result = null | ||
result = await dbManager.addLogLine(roomId, username, text, moment()) | ||
result = await dbManager.addChatLogLine(roomId, username, text, moment()) | ||
return result | ||
} | ||
|
||
async function logStreamTitle(roomId, title) { | ||
let result = null | ||
result = await dbManager.addTitleLogLine(roomId, title, moment()) | ||
return result | ||
} | ||
|
||
|
||
module.exports = { | ||
logMessage | ||
logChatMessage, | ||
logStreamTitle | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters