luckyframework / luckyframework/website

Document how to use UUID with Auth better

Open
#299 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

guides:update
Dominant language
Crystal
Stars
39
Forks
62
PR merge metrics
No merged PRs in 30d

Description

If you generate Auth in your API app, you'll get an UserToken class that assumes you have a User model that uses Int64 for your primary key. If you decide to use UUID, you'll need to make a few changes.

  • Update migration to set primary key to UUID
  • Add default_columns macro to base_model with UUID primary key
  • Change return type on decode_user_id method in UserToken class to UUID
  • Change the return value from payload["user_id"].to_s.to_i64 to UUID.new(payload["user_id"].to_s)

I think this is all you need to do, but we should have a section somewhere on the site that documents this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the website's existing Auth or API-app documentation and the UserToken section. Review how decode_user_id and UUID-based models are currently described, then add a dedicated section covering the migration, default_columns, and UUID return-value changes. Done means a newcomer can follow the section to configure Auth with UUID primary keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
authentication, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.