Skip to content

Make provided helpers easier to understand - #18

Merged
calvin-www merged 2 commits into
mainfrom
refactor/clearer-helper-names
Oct 9, 2026
Merged

calvin-www merged 2 commits into
mainfrom
refactor/clearer-helper-names

Conversation

@calvin-www

@calvin-www calvin-www commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Students need to use contact privacy without deciding whether to expose someone’s email and phone themselves. Add getVisibleProfile(ctx, tx, currentUser, record): it returns a profile with contacts only for self or shared-ride peers, using the supplied transaction. Guests receive no contacts, and a failed permission lookup returns an error and no profile. Keep the copying helper internal so ride results retain one permission lookup for all owners and riders.

Rename Actor to CurrentUser, use requireSignedInUser for identity extraction, and give conversion and error helpers clearer verbs. Update comments and existing tests. Student operation stubs remain intact.

Add HELPERS.md and link it from the README, matching the revised Google Doc. The guide explains request identity, stored records, prepared results, and automatic contact permissions with concrete examples. It omits the general tutorials on types, structs, transactions, and sqlc.

Validation: go test -race -count=1 ./..., go vet ./..., go build ./..., formatting, and git diff --check passed. New helper tests cover self, shared-ride peers, unrelated profiles, guests, and permission-query failures. Unfinished student operations retain their existing test skips.

Companion reference implementation: https://github.com/chu-andrew/carpool4/pull/3

@calvin-www
calvin-www merged commit ed2e575 into main Oct 9, 2026
6 checks passed
@calvin-www
calvin-www deleted the refactor/clearer-helper-names branch October 9, 2026 03:57
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.

1 participant