Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Management 1.0 #1

Open
4 tasks
zZHorizonZz opened this issue Sep 9, 2024 · 0 comments
Open
4 tasks

User Management 1.0 #1

zZHorizonZz opened this issue Sep 9, 2024 · 0 comments
Assignees

Comments

@zZHorizonZz
Copy link
Contributor

zZHorizonZz commented Sep 9, 2024

User Management - First Iteration

  • The user management should allow creating users through an endpoint. The user structure should look similar to this:
ID uuid.UUID `json:"id" db:"id"`

Aud  string `json:"aud" db:"aud"`
Role string `json:"role" db:"role"`

Username *string `json:"username" db:"username"` # One of the following must be set if not anonymous
Email        *string `json:"email" db:"email"`
Phone      *string `json:"phone" db:"phone"`

Image *string `json"image" db:"image"`

EncryptedPassword *string `json:"-" db:"encrypted_password"`

LastSignInAt *time.Time `json:"last_sign_in_at" db:"last_sign_in_at"`

AppMetaData  JSON `json:"app_metadata" db:"raw_app_meta_data"`
UserMetaData JSON `json:"user_metadata" db:"raw_user_meta_data"`

CreatedAt  time.Time  `json:"created_at" db:"created_at"`
UpdatedAt time.Time  `json:"updated_at" db:"updated_at"`
DeletedAt  *time.Time `json:"deleted_at" db:"deleted_at"`

IsAnonymous bool `json:"is_anonymous" db:"is_anonymous"`

Normal API Endpoints:

  • GET /api/users/me
    • Retrieves the currently logged-in user's information

Admin API Endpoints:

  • POST /api/admin/users

    • Creates a new user.
    • Requires at least one of the following: username, email, or phone (unless is_anonymous is true).
    • encrypted_password is required if is_anonymous is false.
    • Returns the newly created user object upon success.
  • POST /api/admin/users

    • Creates a new user with any specified role.
    • Requires the same fields as the normal user creation endpoint, but also allows setting the role field explicitly.
    • Returns the newly created user object upon success.
  • User Management Endpoints for listing, retrieving, updating, and deleting users. (e.g., GET /api/admin/users, GET /api/admin/users/:id, PUT /api/admin/users/:id, DELETE /api/admin/users/:id)

@zZHorizonZz zZHorizonZz self-assigned this Sep 9, 2024
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

No branches or pull requests

1 participant