Compare commits
No commits in common. 'main' and 'v1.0.0' have entirely different histories.
File diff suppressed because it is too large
Load Diff
@ -1,26 +0,0 @@
|
||||
const { Schema, model } = require('mongoose')
|
||||
|
||||
const brackets = new Schema({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
name_arabic: {
|
||||
type: String,
|
||||
},
|
||||
name_jpn: {
|
||||
type: String,
|
||||
},
|
||||
event: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Event',
|
||||
},
|
||||
matches: [{
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Matches',
|
||||
}],
|
||||
})
|
||||
|
||||
const Bracket = model('Brackets', brackets)
|
||||
|
||||
module.exports = Bracket
|
@ -1,67 +0,0 @@
|
||||
const { Schema, model } = require('mongoose')
|
||||
|
||||
const stats = new Schema({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
name_arabic: {
|
||||
type: String,
|
||||
},
|
||||
name_jpn: {
|
||||
type: String,
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
image_full: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true,
|
||||
},
|
||||
win_name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
win: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
goals_name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
goals: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
shots_name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
shots: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
saves_name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
saves: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
assists_name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
assists: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const Stat = model('Stats', stats)
|
||||
|
||||
module.exports = Stat
|
@ -1,56 +0,0 @@
|
||||
const { v4 } = require('uuid')
|
||||
const crud = require('./crud')
|
||||
|
||||
const connections = {}
|
||||
|
||||
const subscribe = (ws, tid, type) => {
|
||||
const id = v4()
|
||||
connections[id] = {
|
||||
connection: ws,
|
||||
tid,
|
||||
type,
|
||||
}
|
||||
|
||||
ws.send(JSON.stringify({
|
||||
event: 'info',
|
||||
data: 'Welcome to APL Nuke v1.1.0!',
|
||||
}))
|
||||
|
||||
sendInitial(id)
|
||||
|
||||
ws.on('close', () => {
|
||||
delete connections[id]
|
||||
})
|
||||
}
|
||||
|
||||
const recvUpdate = async (channel, data) => {
|
||||
Object.keys(connections).forEach((k) => {
|
||||
sendInitial(k)
|
||||
})
|
||||
}
|
||||
|
||||
const sendInitial = async (id) => {
|
||||
try {
|
||||
const c = connections[id]
|
||||
if (c.type === 'stream') {
|
||||
const stream = await crud['streams'].getById(c.tid)
|
||||
c.connection.send(JSON.stringify({
|
||||
event: 'streams:read',
|
||||
data: stream,
|
||||
}))
|
||||
} else if (c.type === 'bracket') {
|
||||
const bracket = await crud['brackets'].getById(c.tid)
|
||||
c.connection.send(JSON.stringify({
|
||||
event: 'brackets:read',
|
||||
data: bracket,
|
||||
}))
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
subscribe,
|
||||
recvUpdate,
|
||||
}
|
Loading…
Reference in New Issue