organization

package
v1.14.1-beta.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Line1   string  `json:"line1"`
	Line2   *string `json:"line2"`
	ZipCode string  `json:"zipCode"`
	City    string  `json:"city"`
	State   string  `json:"state"`
	Country string  `json:"country"` // According to ISO 3166-1 alpha-2
}

Address structure for marshaling/unmarshalling JSON.

func (Address) IsEmpty

func (a Address) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type CreateOrganizationInput

type CreateOrganizationInput struct {
	LegalName            string         `json:"legalName"`
	ParentOrganizationID *string        `json:"parentOrganizationId" validate:"omitempty,uuid"`
	DoingBusinessAs      *string        `json:"doingBusinessAs"`
	LegalDocument        string         `json:"legalDocument"`
	Address              Address        `json:"address"`
	Status               Status         `json:"status"`
	Metadata             map[string]any `json:"metadata"`
}

CreateOrganizationInput is a struct design to encapsulate request create payload data.

type Organization

type Organization struct {
	ID                   string         `json:"id"`
	ParentOrganizationID *string        `json:"parentOrganizationId"`
	LegalName            string         `json:"legalName"`
	DoingBusinessAs      *string        `json:"doingBusinessAs"`
	LegalDocument        string         `json:"legalDocument"`
	Address              Address        `json:"address"`
	Status               Status         `json:"status"`
	CreatedAt            time.Time      `json:"createdAt"`
	UpdatedAt            time.Time      `json:"updatedAt"`
	DeletedAt            *time.Time     `json:"deletedAt"`
	Metadata             map[string]any `json:"metadata"`
}

Organization is a struct designed to encapsulate response payload data.

type OrganizationPostgreSQLModel

type OrganizationPostgreSQLModel struct {
	ID                   string
	ParentOrganizationID *string
	LegalName            string
	DoingBusinessAs      *string
	LegalDocument        string
	Address              Address
	Status               string
	StatusDescription    *string
	CreatedAt            time.Time
	UpdatedAt            time.Time
	DeletedAt            sql.NullTime
	Metadata             map[string]any
}

OrganizationPostgreSQLModel represents the entity Organization into SQL context in Database

func (*OrganizationPostgreSQLModel) FromEntity

func (t *OrganizationPostgreSQLModel) FromEntity(organization *Organization)

FromEntity converts an entity.Organization to OrganizationPostgresModel

func (*OrganizationPostgreSQLModel) ToEntity

ToEntity converts an OrganizationPostgreSQLModel to entity.Organization

type Repository

type Repository interface {
	Create(ctx context.Context, organization *Organization) (*Organization, error)
	Update(ctx context.Context, id uuid.UUID, organization *Organization) (*Organization, error)
	Find(ctx context.Context, id uuid.UUID) (*Organization, error)
	FindAll(ctx context.Context, limit, page int) ([]*Organization, error)
	ListByIDs(ctx context.Context, ids []uuid.UUID) ([]*Organization, error)
	Delete(ctx context.Context, id uuid.UUID) error
}

Repository provides an interface for operations related to organization entities.

type Status

type Status struct {
	Code        string  `json:"code"`
	Description *string `json:"description"`
}

Status structure for marshaling/unmarshalling JSON.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateOrganizationInput

type UpdateOrganizationInput struct {
	LegalName            string         `json:"legalName"`
	ParentOrganizationID *string        `json:"parentOrganizationId" validate:"omitempty,uuid"`
	DoingBusinessAs      *string        `json:"doingBusinessAs"`
	Address              Address        `json:"address"`
	Status               Status         `json:"status"`
	Metadata             map[string]any `json:"metadata"`
}

UpdateOrganizationInput is a struct design to encapsulate request update payload data.

Jump to

Keyboard shortcuts

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