service

package
v0.0.0-...-ad482e7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Donor

type Donor struct {
	ID          int64      `json:"id,omitempty"`
	BloodTypeID int        `json:"blood_type_id"`
	Name        string     `json:"name"`
	Cell        string     `json:"cell"`
	Email       NullString `json:"email"`
	CityID      NullInt64  `json:"city_id"`
	Public      bool       `json:"public"`
	Verified    bool       `json:"verified"`
	Donations   string     `json:"quantity_donations"`
	Answer      bool       `json:"answer,omitempty"`
	Comment     string     `json:"comment,omitempty"`
	CreatedAt   NullTime   `json:"created_at"`
	UpdatedAt   NullTime   `json:"updated_at"`
	DeletedAt   NullTime   `json:"deleted_at"`
}

Donor structure for donors

type NullBool

type NullBool struct {
	sql.NullBool
}

NullBool is an alias for sql.NullBool data type

func (*NullBool) MarshalJSON

func (nb *NullBool) MarshalJSON() ([]byte, error)

MarshalJSON for NullBool

func (*NullBool) UnmarshalJSON

func (nb *NullBool) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullBool

type NullFloat64

type NullFloat64 struct {
	sql.NullFloat64
}

NullFloat64 is an alias for sql.NullFloat64 data type

func (*NullFloat64) MarshalJSON

func (nf *NullFloat64) MarshalJSON() ([]byte, error)

MarshalJSON for NullFloat64

func (*NullFloat64) UnmarshalJSON

func (nf *NullFloat64) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullFloat64

type NullInt64

type NullInt64 struct {
	sql.NullInt64
}

NullInt64 is an alias for sql.NullInt64 data type

func (*NullInt64) MarshalJSON

func (ni *NullInt64) MarshalJSON() ([]byte, error)

MarshalJSON for NullInt64

func (*NullInt64) UnmarshalJSON

func (ni *NullInt64) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullInt64

type NullString

type NullString struct {
	sql.NullString
}

NullString is an alias for sql.NullString data type

func (*NullString) MarshalJSON

func (ns *NullString) MarshalJSON() ([]byte, error)

MarshalJSON for NullString

func (*NullString) UnmarshalJSON

func (ns *NullString) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullString

type NullTime

type NullTime struct {
	mysql.NullTime
}

NullTime is an alias for mysql.NullTime data type

func (*NullTime) MarshalJSON

func (nt *NullTime) MarshalJSON() ([]byte, error)

MarshalJSON for NullTime

func (*NullTime) UnmarshalJSON

func (nt *NullTime) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullTime

type Recipient

type Recipient struct {
	ID          int64      `json:"id,omitempty"`
	BloodTypeID int        `json:"blood_type_id"`
	Name        string     `json:"name"`
	CellPhones  string     `json:"cell_phones"`
	Email       NullString `json:"email"`
	PhotoPath   NullString `json:"photo_path"`
	CityID      NullInt64  `json:"city_id"`
	Public      bool       `json:"public"`
	Verified    bool       `json:"verified"`
	Answer      bool       `json:"answer,omitempty"`
	Comment     string     `json:"comment,omitempty"`
	CreatedAt   NullTime   `json:"created_at"`
	UpdatedAt   NullTime   `json:"updated_at"`
	DeletedAt   NullTime   `json:"deleted_at"`
}

Recipient struct for recipients

type Repository

type Repository interface {
	CreateRecipient(ctx context.Context, recipient Recipient) (int64, error)
	GetRecipientList(ctx context.Context, publicOnly bool) ([]Recipient, error)
	UpdateRecipient(ctx context.Context, recipient Recipient) (Recipient, error)
	VerifyRecipient(ctx context.Context, recipientID int64, verified bool) error
	PublicRecipient(ctx context.Context, recipientID int64, public bool) error
	DeleteRecipient(ctx context.Context, recipientID int64, answer *bool, comment *string) error
	ActivateRecipient(ctx context.Context, recipientID int64) error

	CreateDonor(ctx context.Context, donor Donor) (int64, error)
	GetDonorList(ctx context.Context, publicOnly bool, q string, page int64, perPage int64) ([]Donor, int64, error)
	UpdateDonor(ctx context.Context, donor Donor) (Donor, error)
	VerifyDonor(ctx context.Context, donorID int64, verified bool) error
	PublicDonor(ctx context.Context, donorID int64, public bool) error
	DeleteDonor(ctx context.Context, donorID int64, answer *bool, comment *string) error
	ActivateDonor(ctx context.Context, donorID int64) error
}

Repository interface

func NewRepository

func NewRepository(db *sql.DB, logger log.Logger) Repository

NewRepository creates a new repository instance

type Service

type Service interface {
	CreateRecipient(ctx context.Context, recipient Recipient) (int64, error)
	GetRecipientList(ctx context.Context, publicOnly bool) ([]Recipient, error)
	UpdateRecipient(ctx context.Context, recipient Recipient) (Recipient, error)
	VerifyRecipient(ctx context.Context, recipientID int64, verified bool) error
	PublicRecipient(ctx context.Context, recipientID int64, public bool) error
	DeleteRecipient(ctx context.Context, recipientID int64, answer *bool, comment *string) error
	ActivateRecipient(ctx context.Context, recipientID int64) error
	SendComment(ctx context.Context, email string, comment string, isRecluter bool) error

	CreateDonor(ctx context.Context, donor Donor) (int64, error)
	GetDonorList(ctx context.Context, publicOnly bool, q string, page int64, perPage int64) ([]Donor, int64, error)
	UpdateDonor(ctx context.Context, donor Donor) (Donor, error)
	VerifyDonor(ctx context.Context, donorID int64, verified bool) error
	PublicDonor(ctx context.Context, donorID int64, public bool) error
	DeleteDonor(ctx context.Context, donorID int64, answer *bool, comment *string) error
	ActivateDonor(ctx context.Context, donorID int64) error
}

Service definition

func NewService

func NewService(rep Repository, logger log.Logger) Service

NewService create new service instance

Jump to

Keyboard shortcuts

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