contact

package
v0.0.0-...-984c388 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = exception.ResourceNotFound{Resource: "contact"}

Functions

This section is empty.

Types

type Contact

type Contact struct {
	ID          string
	User        user.User  // FK ->  users, req (created by)
	LinkedTo    *user.User // FK ->  users (nullable)
	DisplayName string     // req
	ImageURL    string
	customtype.Auditable
}

Contact organization or individual a User interacts with. Might be a User of the system.

type CreateCommand

type CreateCommand struct {
	ID          string `json:"id" validate:"required"`
	DisplayName string `json:"display_name" validate:"required,lte=96"`
	UserID      string `json:"user_id" validate:"required"`
	LinkedToID  string `json:"linked_to_user"`
	ImageURL    string `json:"image_url" validate:"omitempty,url"`
}

type Repository

type Repository interface {
	storage.Repository[Contact]
	GetUserContacts(ctx context.Context, criteria storage.Criteria, userID string) ([]Contact, storage.PageToken, error)
}

type Service

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

func NewService

func NewService(r Repository) Service

func (Service) Create

func (s Service) Create(ctx context.Context, args any) error

func (Service) Delete

func (s Service) Delete(ctx context.Context, id string) error

func (Service) GetByID

func (s Service) GetByID(ctx context.Context, id string) (View, error)

func (Service) List

func (Service) ListUserContacts

func (s Service) ListUserContacts(ctx context.Context, cr storage.Criteria, userID string) ([]View,
	storage.PageToken, error)

func (Service) Update

func (s Service) Update(ctx context.Context, args any) error

type UpdateCommand

type UpdateCommand struct {
	ID          string `json:"id" validate:"required"`
	DisplayName string `json:"display_name" validate:"required,lte=96"`
	LinkedToID  string `json:"linked_to_user"`
	ImageURL    string `json:"image_url" validate:"omitempty,url"`
}

type View

type View struct {
	ID          string     `json:"id"`
	DisplayName string     `json:"display_name"`
	User        *user.View `json:"user,omitempty"`
	LinkedTo    *user.View `json:"linked_to"`
	ImageURL    *string    `json:"image_url"`
	customtype.Auditable
}

func NewView

func NewView(ctc Contact) View

Jump to

Keyboard shortcuts

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