Added ban/unban endpoint #37

Closed
baaboe wants to merge 0 commits from wip/ban into main
Member
No description provided.
fix: Updated error message when banning owner
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
6999b4120e
Owner

this doesn't check the user's roles

i'm unsure how far along we are on the roles train, but i know they exist, ask radial

this doesn't check the user's roles i'm unsure how far along we are on the roles train, but i know they *exist*, ask radial
Twig 2025-07-22 23:10:26 +00:00
  • added the
    Kind/Feature
    label
  • requested review from radical
fix: baner :)
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
2bc702f8d2
Author
Member

@twig wrote in #37 (comment):

this doesn't check the user's roles

i'm unsure how far along we are on the roles train, but i know they exist, ask radial

But it does

@twig wrote in https://git.gorb.app/gorb/backend/pulls/37#issuecomment-850: > this doesn't check the user's roles > > i'm unsure how far along we are on the roles train, but i know they _exist_, ask radial But it does
baaboe self-assigned this 2025-07-22 23:20:22 +00:00
feat: ban permission
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
5fe5186142
fix: plural fix thing
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
ceaa37cbe2
feat: idiot(goin) proofing
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
cbdf6f79e2
style: formatting
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
bb8927840d
style: cargo clippy --fix && cargo fmt
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
26f528819e
baaboe changed title from Added ban endpoint to WIP: Added ban endpoint 2025-07-23 17:13:33 +00:00
@ -0,0 +3,4 @@
guild_uuid uuid NOT NULL REFERENCES guilds(uuid) ON DELETE CASCADE,
user_uuid uuid NOT NULL REFERENCES users(uuid),
reason VARCHAR(200) DEFAULT NULL,
ban_time TIMESTAMPTZ NOT NULL DEFAULT NOW(),
Owner

can you change ban_time to be called banned_since instead maybe?

can you change `ban_time` to be called `banned_since` instead maybe?
baaboe marked this conversation as resolved
style: renaming parameter, ban_time -> banned_since
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
c2b5f6568f
feat: added unband endpoint
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
0e0c590e4d
baaboe changed title from WIP: Added ban endpoint to Added ban endpoint 2025-07-24 00:15:21 +00:00
baaboe changed title from Added ban endpoint to Added ban/unban endpoint 2025-07-24 00:15:40 +00:00
radical requested changes 2025-07-24 21:49:54 +00:00
Dismissed
@ -171,1 +170,4 @@
let banned = GuildBan::fetch_one(&mut conn, guild_uuid, user_uuid).await;
match banned {
Ok(_) => Err(Error::Forbidden("User banned".to_string())),
Owner

This should return a 400 (bad request) on an already banned user, its a bad request as its not forbidden for the user to do it, its just not a possibility for someone to be banned twice

This should return a 400 (bad request) on an already banned user, its a bad request as its not forbidden for the user to do it, its just not a possibility for someone to be banned twice
baaboe marked this conversation as resolved
@ -189,3 +195,3 @@
pub async fn delete(self, conn: &mut Conn) -> Result<(), Error> {
delete(guild_members::table)
diesel::delete(guild_members::table)
Owner

please just import the delete statement instead of doing diesel::delete here so we have consistency in the codebase

please just import the delete statement instead of doing `diesel::delete` here so we have consistency in the codebase
baaboe marked this conversation as resolved
style: cargo clippy --fix && cargo fmt
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
ci/woodpecker/pull_request_closed/build-and-publish Pipeline was successful
4a2f98a180
radical approved these changes 2025-07-24 22:28:36 +00:00
Owner

merged manually

merged manually
radical closed this pull request 2025-07-24 22:40:54 +00:00
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
ci/woodpecker/pull_request_closed/build-and-publish Pipeline was successful

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: gorb/backend#37
No description provided.