Skip to content

Refactor: update officers to use new huh logic#166

Merged
GaballaGit merged 32 commits intomainfrom
feat/officers-cli
Mar 10, 2026
Merged

Refactor: update officers to use new huh logic#166
GaballaGit merged 32 commits intomainfrom
feat/officers-cli

Conversation

@TheJolman
Copy link
Collaborator

@TheJolman TheJolman commented Feb 28, 2026

Created a reusable function in a client package and also applied it to announcements stuff since I noticed the code was nearly the exact same.

Related to #160

Note: The reason this modifies the dbmodels package is because sqlc didn't get rerun when the queries were last modified.

@github-actions
Copy link

github-actions bot commented Feb 28, 2026

godoc reference preview ready ✨
Go Documentation

@TheJolman TheJolman marked this pull request as ready for review March 1, 2026 00:42
@TheJolman TheJolman requested a review from GaballaGit as a code owner March 1, 2026 00:42
@TheJolman TheJolman requested review from Copilot and removed request for GaballaGit March 6, 2026 10:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the CLI’s officers commands to follow the newer “huh-based form + shared HTTP client helper” approach (from #160), and applies the same request helper to announcements to reduce duplicated request/response handling.

Changes:

  • Added a reusable client.SendRequestAndReadResponse helper for CLI HTTP calls (optionally with OAuth).
  • Refactored officers get/post/put/delete to use the shared client helper and simplified command structure.
  • Updated announcements commands to use the shared client helper; regenerated/updated API docs + dbmodels for CreatePositionParams, and added server-side logging on announcement create failures.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
internal/cli/client/client.go New shared helper to send HTTP requests and read responses (with optional OAuth).
internal/cli/officers/root.go New officers command root wiring subcommands.
internal/cli/officers/get.go Uses shared client helper for GET (pretty-prints JSON).
internal/cli/officers/post.go Uses huh form + shared client helper for POST.
internal/cli/officers/put.go Fetches existing officer then uses huh form + shared client helper for PUT.
internal/cli/officers/delete.go Uses shared client helper for DELETE.
internal/cli/officers/officers.go Removes old interactive menu/flags implementation.
internal/cli/announcements/get.go Uses shared client helper for GET.
internal/cli/announcements/post.go Uses shared client helper for POST.
internal/cli/announcements/put.go Uses shared client helper for GET+PUT update flow.
internal/cli/announcements/delete.go Uses shared client helper for DELETE.
internal/cli/oauth/request_with_auth.go Adds a clarifying doc comment.
internal/api/handlers/announcement.go Adds server-side logging when create fails.
internal/api/dbmodels/board.sql.go Regenerates/updates CreatePosition insert + params (adds full_name/title/team).
internal/api/docs/swagger.yaml Updates API docs for CreatePositionParams fields.
internal/api/docs/swagger.json Updates generated swagger JSON accordingly.
internal/api/docs/docs.go Updates embedded swagger template accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TheJolman TheJolman force-pushed the feat/officers-cli branch 2 times, most recently from f6df77d to d6165a3 Compare March 9, 2026 15:33
@TheJolman
Copy link
Collaborator Author

@GaballaGit just resolved all the issues copilot found. This PR is ready now

@TheJolman TheJolman force-pushed the feat/officers-cli branch from d6165a3 to 1c3c3d3 Compare March 9, 2026 18:09
@GaballaGit GaballaGit self-requested a review March 10, 2026 03:14
Copy link
Member

@GaballaGit GaballaGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheJolman When using ./acmcsuf-cli officers post:

Input: All fields have been inputted with strings

Output: Error: failed to marshal JSON: <nil>

@TheJolman
Copy link
Collaborator Author

@TheJolman When using ./acmcsuf-cli officers post:

Input: All fields have been inputted with strings

Output: Error: failed to marshal JSON: <nil>

good catch, I was misusing cobra's error handling function. Fixed

@TheJolman TheJolman requested a review from GaballaGit March 10, 2026 03:46
Copy link
Member

@GaballaGit GaballaGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaamazing!

@GaballaGit GaballaGit merged commit bc112ea into main Mar 10, 2026
2 checks passed
@GaballaGit GaballaGit deleted the feat/officers-cli branch March 10, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants