orgusers

package
v0.72.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CSVContentType = "text/csv"

Variables

View Source
var ErrNoContent = errors.New("no content")

Functions

This section is empty.

Types

type AggregatedUser

type AggregatedUser struct {
	ID          string     `rql:"name=id,type=string"`
	Name        string     `rql:"name=name,type=string"`
	Title       string     `rql:"name=title,type=string"`
	Avatar      string     `rql:"name=avatar,type=string"`
	Email       string     `rql:"name=email,type=string"`
	State       user.State `rql:"name=state,type=string"`
	RoleNames   []string   `rql:"name=role_names,type=string"`
	RoleTitles  []string   `rql:"name=role_titles,type=string"`
	RoleIDs     []string   `rql:"name=role_ids,type=string"`
	OrgID       string     `rql:"name=org_id,type=string"`
	OrgJoinedAt time.Time  `rql:"name=org_joined_at,type=datetime"`
}

type CSVExport

type CSVExport struct {
	UserID      string `csv:"User ID"`
	Name        string `csv:"Name"`
	Title       string `csv:"Title"`
	Email       string `csv:"Email"`
	State       string `csv:"State"`
	RoleNames   string `csv:"Role Names"`
	RoleTitles  string `csv:"Role Titles"`
	OrgJoinedAt string `csv:"Organization Joined At"`
}

CSVExport represents the structure for CSV export of organization users

func NewCSVExport

func NewCSVExport(user AggregatedUser) CSVExport

NewCSVExport converts AggregatedUser to CSVExport

func (CSVExport) GetHeaders

func (c CSVExport) GetHeaders() []string

GetHeaders returns the CSV headers based on struct tags

func (CSVExport) ToRow

func (c CSVExport) ToRow() []string

ToRow converts the struct to a string slice for CSV writing

type Group

type Group struct {
	Name string      `json:"name"`
	Data []GroupData `json:"data"`
}

type GroupData

type GroupData struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type OrgUsers

type OrgUsers struct {
	Users      []AggregatedUser `json:"users"`
	Group      Group            `json:"group"`
	Pagination Page             `json:"pagination"`
}

type Page

type Page struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
}

type Repository

type Repository interface {
	Search(ctx context.Context, orgID string, query *rql.Query) (OrgUsers, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repository Repository) *Service

func (Service) Export

func (s Service) Export(ctx context.Context, orgID string) ([]byte, string, error)

Export generates a CSV file containing organization users data

func (Service) Search

func (s Service) Search(ctx context.Context, orgID string, query *rql.Query) (OrgUsers, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL