-
Notifications
You must be signed in to change notification settings - Fork 3
feat: /showcase project showcase with upvotes (#50) #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
90de440
feat: /showcase project showcase with upvotes (#50)
BillChirico b74e73f
fix(showcase): atomic upvote, null guards, URL validation, safeSend
BillChirico 7c6a909
fix(showcase): getPool guard, URL protocol, modal error handler
BillChirico 9dfdba7
fix: wrap getPool() in try/catch — if (!pool) was dead code
BillChirico c3ad323
fix(showcase): guard upvotes when feature is disabled
BillChirico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,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, | ||
| 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)', | ||
| ); | ||
|
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) | ||
| ) | ||
| `); | ||
|
BillChirico marked this conversation as resolved.
BillChirico marked this conversation as resolved.
BillChirico marked this conversation as resolved.
|
||
| }; | ||
|
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'); | ||
| }; | ||
|
BillChirico marked this conversation as resolved.
BillChirico marked this conversation as resolved.
BillChirico marked this conversation as resolved.
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.