Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
"github": "everyone",
"rank": "everyone",
"leaderboard": "everyone",
"profile": "everyone"
"profile": "everyone",
"showcase": "everyone"
}
},
"help": {
Expand All @@ -165,6 +166,9 @@
"poll": {
"enabled": false
},
"showcase": {
"enabled": false
},
"github": {
"feed": {
"enabled": false,
Expand Down
45 changes: 45 additions & 0 deletions migrations/009_showcases.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Add showcases and showcase_votes tables for /showcase project showcase system.
*
* @see https://github.com/VolvoxLLC/volvox-bot/issues/50
*/

/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
exports.up = (pgm) => {
pgm.sql(`
CREATE TABLE IF NOT EXISTS showcases (
id SERIAL PRIMARY KEY,
guild_id TEXT NOT NULL,
author_id TEXT NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL,
tech_stack TEXT[] DEFAULT '{}',
repo_url TEXT,
live_url TEXT,
message_id TEXT,
channel_id TEXT,
upvotes INTEGER NOT NULL DEFAULT 0,
Comment thread
BillChirico marked this conversation as resolved.
created_at TIMESTAMPTZ DEFAULT NOW()
)
`);

pgm.sql('CREATE INDEX IF NOT EXISTS idx_showcases_guild ON showcases(guild_id)');
pgm.sql(
'CREATE INDEX IF NOT EXISTS idx_showcases_author ON showcases(guild_id, author_id)',
);
Comment thread
BillChirico marked this conversation as resolved.

pgm.sql(`
CREATE TABLE IF NOT EXISTS showcase_votes (
guild_id TEXT NOT NULL,
showcase_id INTEGER NOT NULL REFERENCES showcases(id) ON DELETE CASCADE,
user_id TEXT NOT NULL,
PRIMARY KEY (guild_id, showcase_id, user_id)
)
`);
Comment thread
BillChirico marked this conversation as resolved.
Comment thread
BillChirico marked this conversation as resolved.
Comment thread
BillChirico marked this conversation as resolved.
};
Comment thread
BillChirico marked this conversation as resolved.

/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
exports.down = (pgm) => {
pgm.sql('DROP TABLE IF EXISTS showcase_votes CASCADE');
pgm.sql('DROP TABLE IF EXISTS showcases CASCADE');
};
Comment thread
BillChirico marked this conversation as resolved.
Comment thread
BillChirico marked this conversation as resolved.
Comment thread
BillChirico marked this conversation as resolved.
1 change: 1 addition & 0 deletions src/api/utils/configAllowlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const SAFE_CONFIG_KEYS = new Set([
'announce',
'snippet',
'poll',
'showcase',
'tldr',
'afk',
'reputation',
Expand Down
Loading
Loading