Skip to content

Add Division-Specific Discord Roles, Announcement Channels, and Division Update API#65

Merged
yulmwu merged 2 commits into
mainfrom
feat/division-discord
Jul 4, 2026
Merged

Add Division-Specific Discord Roles, Announcement Channels, and Division Update API#65
yulmwu merged 2 commits into
mainfrom
feat/division-discord

Conversation

@yulmwu

@yulmwu yulmwu commented Jul 4, 2026

Copy link
Copy Markdown
Member

Previously, the Discord role assigned during account linking and the channel used for challenge solve announcements were both hardcoded.

This PR introduces support for configuring both the assigned Discord role and the solve announcement channel on a per-Division basis.

These values can now be specified when creating a Division. If either value is omitted, no action is taken for that setting. To support modifying these values after creation, a new Division update API has also been added.

As part of this change, the previously hardcoded environment variables for the Discord role ID and announcement channel ID have been removed.

For more details, please refer to the updated API documentation and the changes included in this PR.

List Divisions

GET /api/divisions

Response 200

[
    {
        "id": 2,
        "name": "고등부",
        "discord_role_id": "1522163303982563458",
        "discord_announce_channel_id": "1522218332806447225",
        "created_at": "2026-01-26T12:00:00Z"
    }
]

Notes:

  • Division identifiers are numeric id values (slugs are not supported).
  • discord_role_id and discord_announce_channel_id are the per-division Discord
    role and announcement channel. They are omitted when unset and are managed by
    admins via Create / Update Division. See Admin and Discord.

Create Division (Admin)

POST /api/admin/divisions

Request

{
    "name": "고등부",
    "discord_role_id": "1522163303982563458",
    "discord_announce_channel_id": "1522218332806447225"
}

discord_role_id and discord_announce_channel_id are optional. discord_role_id
is the guild role granted to this division's members when they link Discord;
discord_announce_channel_id is the channel that receives this division's solve /
first-blood announcements. Both are omitted from the response when unset.

Response 201

{
    "id": 2,
    "name": "고등부",
    "discord_role_id": "1522163303982563458",
    "discord_announce_channel_id": "1522218332806447225",
    "created_at": "2026-01-26T12:00:00Z"
}

Errors:

  • 400 invalid input
  • 401 invalid token or missing access_token cookie
  • 403 forbidden

Validation notes:

  • name must be at most 10 characters (counted by Unicode code point).
  • discord_role_id / discord_announce_channel_id, when present, must be numeric
    Discord IDs (snowflakes). An empty string clears the value.

Update Division (Admin)

PUT /api/admin/divisions/:id

Updates a division's name and per-division Discord configuration. Divisions cannot
be deleted.

Request

{
    "name": "고등부",
    "discord_role_id": "1522163303982563458",
    "discord_announce_channel_id": "1522218332806447225"
}

Omitting (or sending an empty string for) discord_role_id /
discord_announce_channel_id clears that setting.

Response 200

{
    "id": 2,
    "name": "고등부",
    "discord_role_id": "1522163303982563458",
    "discord_announce_channel_id": "1522218332806447225",
    "created_at": "2026-01-26T12:00:00Z"
}

Errors:

  • 400 invalid input
  • 401 invalid token or missing access_token cookie
  • 403 forbidden
  • 404 not found

Validation notes:

  • Same as Create Division.

@yulmwu yulmwu added the enhancement New feature or request label Jul 4, 2026
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Comment thread internal/models/division.go
Comment thread internal/service/discord_service.go Outdated
@yulmwu
yulmwu merged commit f66a68b into main Jul 4, 2026
2 of 4 checks passed
@yulmwu
yulmwu deleted the feat/division-discord branch July 4, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant