user

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
) common.CrudAPI

Types

type AggregationResult

type AggregationResult struct {
	Data       []User `bson:"data" json:"data"`
	TotalCount int64  `bson:"total_count" json:"total_count"`
}

func (*AggregationResult) GetData

func (r *AggregationResult) GetData() interface{}

func (*AggregationResult) GetTotal

func (r *AggregationResult) GetTotal() int64

type EditRequest

type EditRequest struct {
	ID                     string          `json:"-"`
	Password               string          `json:"password"`
	Name                   string          `json:"name" binding:"required,max=255"`
	Firstname              string          `json:"firstname" binding:"max=255"`
	Lastname               string          `json:"lastname" binding:"max=255"`
	Email                  string          `json:"email" binding:"required,email"`
	Role                   string          `json:"role" binding:"required"`
	UILanguage             string          `json:"ui_language"`
	UIGroupsNavigationType string          `json:"ui_groups_navigation_type"`
	IsEnabled              *bool           `json:"enable" binding:"required"`
	DefaultView            string          `json:"defaultview"`
	UITours                map[string]bool `json:"ui_tours"`
}

type ListRequest

type ListRequest struct {
	pagination.FilteredQuery
	SortBy string `form:"sort_by" binding:"oneoforempty=_id name role enable"`
}

type Role

type Role struct {
	ID   string `bson:"_id" json:"_id"`
	Name string `bson:"name" json:"name"`
}

type Store

type Store interface {
	Find(ListRequest) (*AggregationResult, error)
	GetOneBy(string) (*User, error)
	Insert(EditRequest) (*User, error)
	Update(EditRequest) (*User, error)
	Delete(string) (bool, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient, passwordEncoder password.Encoder) Store

type User

type User struct {
	ID                     string          `bson:"_id" json:"_id"`
	Name                   string          `bson:"name" json:"name"`
	Lastname               string          `bson:"lastname" json:"lastname"`
	Firstname              string          `bson:"firstname" json:"firstname"`
	Email                  string          `bson:"email" json:"email"`
	Role                   Role            `bson:"role" json:"role"`
	UILanguage             string          `bson:"ui_language" json:"ui_language"`
	UITours                map[string]bool `bson:"ui_tours" json:"ui_tours"`
	UIGroupsNavigationType string          `bson:"ui_groups_navigation_type" json:"ui_groups_navigation_type"`
	IsEnabled              bool            `bson:"enable" json:"enable"`
	DefaultView            *View           `bson:"defaultview" json:"defaultview"`
	ExternalID             string          `bson:"external_id" json:"external_id"`
	Source                 string          `bson:"source" json:"source"`
	AuthApiKey             string          `bson:"authkey" json:"authkey"`
}

type Validator

type Validator interface {
	ValidateEditRequest(ctx context.Context, sl validator.StructLevel)
}

func NewValidator

func NewValidator(dbClient mongo.DbClient) Validator

type View

type View struct {
	ID    string `bson:"_id" json:"_id"`
	Title string `bson:"title" json:"title"`
}

Jump to

Keyboard shortcuts

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