Skip to main content

user.go

user.go - Overview

Defines the data structures for users, groups, invites, and password reset requests, including their database schema using bun.

Detailed Documentation

Invite

  • Purpose: Represents a user invite.
  • Fields:
    • bun.BaseModel: Embedded struct for Bun ORM base model.
    • Identifiable: Embedded struct (purpose unclear from the code).
    • TimeAuditable: Embedded struct (purpose unclear from the code).
    • OrgID: Organization ID.
      • Type: string
      • Description: Organization identifier, not null.
    • Name: Name of the invitee.
      • Type: string
      • Description: Invitee's name, not null.
    • Email: Email address of the invitee.
      • Type: string
      • Description: Invitee's email, not null and unique.
    • Token: Invite token.
      • Type: string
      • Description: Unique token for the invite, not null.
    • Role: Role to be assigned to the invitee.
      • Type: string
      • Description: Role of the invitee, not null.

Group

  • Purpose: Represents a user group.
  • Fields:
    • bun.BaseModel: Embedded struct for Bun ORM base model.
    • TimeAuditable: Embedded struct (purpose unclear from the code).
    • OrgID: Organization ID.
      • Type: string
      • Description: Organization identifier.
    • ID: Group ID.
      • Type: string
      • Description: Unique group identifier, primary key.
    • Name: Group name.
      • Type: string
      • Description: Group name, not null and unique.

GettableUser

  • Purpose: Represents a user with additional information like role and organization.
  • Fields:
    • User: Embedded User struct.
    • Role: User's role.
      • Type: string
      • Description: User's role within the organization.
    • Organization: User's organization.
      • Type: string
      • Description: User's organization.

User

  • Purpose: Represents a user.
  • Fields:
    • bun.BaseModel: Embedded struct for Bun ORM base model.
    • TimeAuditable: Embedded struct (purpose unclear from the code).
    • ID: User ID.
      • Type: string
      • Description: Unique user identifier, primary key.
    • Name: User's name.
      • Type: string
      • Description: User's name, not null.
    • Email: User's email address.
      • Type: string
      • Description: User's email, not null and unique.
    • Password: User's password.
      • Type: string
      • Description: User's password, not null, and excluded from JSON serialization.
    • ProfilePictureURL: URL of the user's profile picture.
      • Type: string
      • Description: URL for profile picture.
    • GroupID: Group ID.
      • Type: string
      • Description: Group identifier, not null.
    • OrgID: Organization ID.
      • Type: string
      • Description: Organization identifier, not null.

ResetPasswordRequest

  • Purpose: Represents a reset password request.
  • Fields:
    • bun.BaseModel: Embedded struct for Bun ORM base model.
    • Identifiable: Embedded struct (purpose unclear from the code).
    • Token: Reset password token.
      • Type: string
      • Description: Unique token for password reset, not null.
    • UserID: User ID.
      • Type: string
      • Description: User identifier for whom the reset is requested, not null.

Code Examples

N/A

Include in Getting Started: NO