app for refbot stuff
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

import models from refbot directly instead of duplicating

+6 -165
-20
api/models/Chart.js
··· 1 - import { Schema, model } from 'mongoose' 2 - 3 - const chartSchema = new Schema({ 4 - songId: { type: Number, required: true, unique: true }, 5 - title: String, 6 - artist: String, 7 - charter: String, 8 - cover: String, 9 - thumbnailUrl: String, 10 - difficulty: Number, 11 - tags: [String], 12 - maxScore: Number, 13 - fetchedAt: { type: Date, default: Date.now }, 14 - }) 15 - 16 - chartSchema.virtual('displayName').get(function() { 17 - return `${this.title} - ${this.charter}` 18 - }) 19 - 20 - export default model('Chart', chartSchema)
-10
api/models/Event.js
··· 1 - import { Schema, model } from 'mongoose' 2 - 3 - const eventSchema = new Schema({ 4 - name: { type: String, required: true, unique: true }, 5 - createdAt: { type: Date, default: Date.now }, 6 - active: { type: Boolean, default: false }, 7 - tournamentSlug: { type: String, default: null }, 8 - }) 9 - 10 - export default model('Event', eventSchema)
-109
api/models/Match.js
··· 1 - import { Schema, model } from 'mongoose' 2 - 3 - const feedEventSchema = new Schema({ 4 - type: { type: String, required: true }, 5 - timestamp: { type: Date, default: Date.now }, 6 - message: { type: String, default: null }, 7 - data: { type: Schema.Types.Mixed, default: {} }, 8 - }, { _id: false }) 9 - 10 - const chartResultSchema = new Schema({ 11 - score1: { type: Number, default: null }, 12 - score2: { type: Number, default: null }, 13 - fc1: { type: Boolean, default: false }, 14 - fc2: { type: Boolean, default: false }, 15 - pfc1: { type: Boolean, default: false }, 16 - pfc2: { type: Boolean, default: false }, 17 - winnerDiscordId: { type: String, default: null }, 18 - winnerSlot: { type: Number, default: null }, 19 - rank1: { type: String, default: null }, 20 - rank2: { type: String, default: null }, 21 - pct1: { type: Number, default: null }, 22 - pct2: { type: Number, default: null }, 23 - }, { _id: false }) 24 - 25 - const chartStatusSchema = new Schema({ 26 - banned: { type: Boolean, default: false }, 27 - bannedByDiscordId: { type: String, default: null }, 28 - bannedAt: { type: Date, default: null }, 29 - played: { type: Boolean, default: false }, 30 - playedAt: { type: Date, default: null }, 31 - inCurrentPool: { type: Boolean, default: true }, 32 - isBeingPlayed: { type: Boolean, default: false }, 33 - }, { _id: false }) 34 - 35 - const mappoolEntrySchema = new Schema({ 36 - songId: { type: Number, default: null }, 37 - title: { type: String, default: null }, 38 - artist: { type: String, default: null }, 39 - charter: { type: String, default: null }, 40 - cover: { type: String, default: null }, 41 - thumbnailUrl: { type: String, default: null }, 42 - difficulty: { type: Number, default: null }, 43 - tags: { type: [String], default: [] }, 44 - displayName: { type: String, default: null }, 45 - status: { type: chartStatusSchema, default: () => ({}) }, 46 - result: { type: chartResultSchema, default: null }, 47 - isTiebreaker: { type: Boolean, default: false }, 48 - }, { _id: false }) 49 - 50 - const playerSchema = new Schema({ 51 - slot: { type: Number, required: true }, 52 - displayName: { type: String, default: null }, 53 - discordId: { type: String, default: null }, 54 - discordUsername: { type: String, default: null }, 55 - discordDisplayName: { type: String, default: null }, 56 - serverNickname: { type: String, default: null }, 57 - avatarUrl: { type: String, default: null }, 58 - points: { type: Number, default: 0 }, 59 - ready: { type: Boolean, default: false }, 60 - winner: { type: Boolean, default: false }, 61 - spinshareId: { type: Number, default: null }, 62 - spinshareUsername: { type: String, default: null }, 63 - spinshareAvatarUrl: { type: String, default: null }, 64 - pronouns: { type: String, default: null }, 65 - }, { _id: false }) 66 - 67 - const banPhaseSchema = new Schema({ 68 - banOrder: { type: [String], default: [] }, 69 - currentBannerDiscordId: { type: String, default: null }, 70 - bansCompleted: { type: Number, default: 0 }, 71 - totalBans: { type: Number, default: 0 }, 72 - }, { _id: false }) 73 - 74 - const matchSchema = new Schema({ 75 - matchId: { type: String, index: true, default: null }, 76 - progressLevel: { 77 - type: String, 78 - enum: ['check-in', 'ban-phase', 'ready-check', 'playing', 'picking-post-result', 'finished'], 79 - default: 'check-in', 80 - }, 81 - meta: { 82 - name: { type: String, default: null }, 83 - round: { type: String, default: null }, 84 - matchNumber: { type: Number, default: null }, 85 - bestOf: { type: Number, default: null }, 86 - winsNeeded: { type: Number, default: null }, 87 - tier: { type: Number, default: null }, 88 - channelId: { type: String, required: true }, 89 - eventId: { type: Schema.Types.ObjectId, ref: 'Event', required: true }, 90 - startedAt: { type: Date, default: Date.now }, 91 - completedAt: { type: Date, default: null }, 92 - startggSetId: { type: String, default: null }, 93 - type: { type: String, enum: ['tournament', 'friendly'], default: 'tournament' }, 94 - }, 95 - players: { type: [playerSchema], default: [] }, 96 - mappool: { type: [mappoolEntrySchema], default: [] }, 97 - banPhase: { type: banPhaseSchema, default: () => ({}) }, 98 - currentPickerDiscordId: { type: String, default: null }, 99 - currentChart: { type: Number, default: null }, 100 - refereeDiscordId: { type: String, default: null }, 101 - feed: { type: [feedEventSchema], default: [] }, 102 - status: { 103 - type: String, 104 - enum: ['in_progress', 'completed', 'restarted', 'abandoned'], 105 - default: 'in_progress', 106 - }, 107 - }) 108 - 109 - export default model('Match', matchSchema)
-20
api/models/Player.js
··· 1 - import { Schema, model } from 'mongoose' 2 - 3 - const playerSchema = new Schema({ 4 - discordId: { type: String, required: true, unique: true }, 5 - startggParticipantId: { type: Number, default: null }, 6 - gamerTag: { type: String, default: null }, 7 - csvPronouns: { type: String, default: null }, 8 - spinshareId: { type: Number, required: true }, 9 - spinshareUsername: { type: String, default: null }, 10 - spinshareAvatarUrl: { type: String, default: null }, 11 - spinsharePronouns: { type: String, default: null }, 12 - spinshareProfileFetchedAt: { type: Date, default: null }, 13 - events: [{ type: Schema.Types.ObjectId, ref: 'Event' }], 14 - }) 15 - 16 - playerSchema.virtual('pronouns').get(function() { 17 - return this.spinsharePronouns || this.csvPronouns || null 18 - }) 19 - 20 - export default model('Player', playerSchema)
+1 -1
api/routes/charts.js
··· 1 1 import { Router } from 'express' 2 - import Chart from '../models/Chart.js' 2 + import Chart from '../../refbot/models/Chart.js' 3 3 4 4 const router = Router() 5 5
+3 -3
api/routes/events.js
··· 1 1 import { Router } from 'express' 2 - import Event from '../models/Event.js' 3 - import Match from '../models/Match.js' 4 - import Player from '../models/Player.js' 2 + import Event from '../../refbot/models/Event.js' 3 + import Match from '../../refbot/models/Match.js' 4 + import Player from '../../refbot/models/Player.js' 5 5 6 6 const router = Router() 7 7
+1 -1
api/routes/matches.js
··· 1 1 import { Router } from 'express' 2 - import Match from '../models/Match.js' 2 + import Match from '../../refbot/models/Match.js' 3 3 4 4 const router = Router() 5 5
+1 -1
api/routes/players.js
··· 1 1 import { Router } from 'express' 2 - import Player from '../models/Player.js' 2 + import Player from '../../refbot/models/Player.js' 3 3 4 4 const router = Router() 5 5