Skip to main content

user

import "github.com/Ask-Atlas/AskAtlas/api/internal/user"

Package user encapsulates domain logic and data access for the User entity.

Index

Variables

ErrUserNotFound is returned when an expected user cannot be found in the system.

var ErrUserNotFound = errors.New("user not found")

func ToUpsertClerkUserParams

func ToUpsertClerkUserParams(payload UpsertUserPayload) (db.UpsertClerkUserParams, error)

ToUpsertClerkUserParams converts the domain payload into db-specific parameters.

type Repository

Repository defines the required data-access behaviors for managing users.

type Repository interface {
UpsertClerkUser(ctx context.Context, arg db.UpsertClerkUserParams) (db.User, error)
SoftDeleteUserByClerkID(ctx context.Context, clerkID string) error
GetUserIDByClerkID(ctx context.Context, clerkID string) (uuid.UUID, error)
}

type UpsertUserPayload

UpsertUserPayload contains the requested data to insert or update a user.

type UpsertUserPayload struct {
ClerkID string `json:"clerk_id"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
MiddleName *string `json:"middle_name"`
Metadata map[string]interface{} `json:"metadata"`
}

type User

User represents an internal system user mapped from an external authentication provider.

type User struct {
ID uuid.UUID
ClerkID string
Email string
FirstName string
LastName string
MiddleName *string
Metadata map[string]interface{}
}

func ToUser

func ToUser(dbUser db.User) (User, error)

ToUser converts a db User entity into the generic domain User model.

Generated by gomarkdoc