services

package
v0.0.0-...-6584b5e Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password string, hash []byte) error

func ConvertToDuration

func ConvertToDuration(pgi pgtype.Interval) (time.Duration, error)

func ConvertToTime

func ConvertToTime(pgt pgtype.Time) (time.Time, error)

func GetTimeSlotCount

func GetTimeSlotCount(openingTime, closingTime pgtype.Time, haircutInterval pgtype.Interval) (int, error)

func HashPassword

func HashPassword(password string) ([]byte, error)

func IsTodayBeforeTime

func IsTodayBeforeTime(date, timeslot time.Time) (bool, error)

Types

type Appointment

type Appointment struct {
	Id              int
	ClientName      string    `json:"client_name" db:"client_name"`
	ClientPhone     string    `json:"client_phone" db:"client_phone"`
	ClientEmail     string    `json:"client_email" db:"client_email"`
	AppointmentTime time.Time `json:"appointment_time" db:"appointment_time"`
	EmployeeId      int       `json:"employee_id" db:"employee_id"`
	CreateAt        time.Time `json:"create_at" db:"create_at"`
	IsOpen          bool      `json:"is_open" db:"is_open"`
}

type AppointmentService

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

func NewAppointmentService

func NewAppointmentService(db *pgxpool.Pool, appointment *models.Appointment) *AppointmentService

func (*AppointmentService) CancelAppointmentsById

func (s *AppointmentService) CancelAppointmentsById(appointmentID, employeeID int, date string, timeslot string) error

func (*AppointmentService) CloseAppointmentsById

func (s *AppointmentService) CloseAppointmentsById(appointmentID int) error

func (*AppointmentService) GenerationsTimeSlots

func (s *AppointmentService) GenerationsTimeSlots(open, close pgtype.Time, haircut pgtype.Interval, timeSlot time.Time) ([]time.Time, error)

func (*AppointmentService) GetAppointmentsById

func (s *AppointmentService) GetAppointmentsById(employeeID int, isOpen bool) ([]Appointment, error)

func (*AppointmentService) RecordAppointment

func (s *AppointmentService) RecordAppointment(open, close pgtype.Time, haircut pgtype.Interval, timeSlot time.Time) error

type CalendarService

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

func NewCalendarService

func NewCalendarService(db *pgxpool.Pool, calendar *models.Calendar) *CalendarService

func (*CalendarService) GetCalendar

func (s *CalendarService) GetCalendar(startDate, endDate time.Time, weekends []int) ([]*models.Calendar, error)

func (*CalendarService) GetTimeSlot

func (s *CalendarService) GetTimeSlot(userId int, date pgtype.Date, open, close pgtype.Time, haircut pgtype.Interval) (*TimeSlot, error)

type ClientData

type ClientData struct {
	ClientName  string
	ClientPhone string
	ClientEmail string
	Date        string
	Time        string
}

type CropperData

type CropperData struct {
	Width  int `json:"width"`
	Height int `json:"height"`
	X      int `json:"x"`
	Y      int `json:"y"`
}

type Employee

type Employee struct {
	Login    string `json:"user_login"`
	Password string `json:"user_password"`
	Name     string `json:"user_name"`
	Phone    string `json:"user_phone"`
	Email    string `json:"user_email"`
	About    string `json:"user_about"`
	RoleId   int    `json:"user_role"`
}

type EmployeeService

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

func NewEmployeeService

func NewEmployeeService(db *pgxpool.Pool, employee *models.Employee) *EmployeeService

func (*EmployeeService) CreateEmployee

func (s *EmployeeService) CreateEmployee(ctx context.Context, employee Employee, creator int) error

func (*EmployeeService) EmailValidator

func (s *EmployeeService) EmailValidator(email string) bool

func (*EmployeeService) EmployeeImageCropper

func (s *EmployeeService) EmployeeImageCropper(img image.Image, data CropperData) (image.Image, error)

func (*EmployeeService) FriedEmployeeById

func (s *EmployeeService) FriedEmployeeById(ctx context.Context, id int) error

func (*EmployeeService) GetAll

func (s *EmployeeService) GetAll(ctx context.Context) ([]*models.Employee, error)

func (*EmployeeService) GetAllEmployee

func (s *EmployeeService) GetAllEmployee(ctx context.Context) ([]*models.Employee, error)

func (*EmployeeService) GetEmployeeById

func (s *EmployeeService) GetEmployeeById(ctx context.Context, id int) (*models.Employee, error)

func (*EmployeeService) GetEmployeeByLogin

func (s *EmployeeService) GetEmployeeByLogin(ctx context.Context, login string) (*models.Employee, error)

func (*EmployeeService) NewPassValidator

func (s *EmployeeService) NewPassValidator(pass string) bool

func (*EmployeeService) PhoneValidator

func (s *EmployeeService) PhoneValidator(phone string) bool

func (*EmployeeService) RevertEmployeeById

func (s *EmployeeService) RevertEmployeeById(ctx context.Context, id int) error

func (*EmployeeService) UpdateEmployeeAvatar

func (s *EmployeeService) UpdateEmployeeAvatar(ctx context.Context, id int, url string) error

func (*EmployeeService) UpdateEmployeeById

func (s *EmployeeService) UpdateEmployeeById(ctx context.Context, id int) (int, error)

func (*EmployeeService) UpdateEmployeeData

func (s *EmployeeService) UpdateEmployeeData(ctx context.Context, id int, name, phone, email, pass *string) (*models.Employee, error)

type GalleryService

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

func NewGalleryService

func NewGalleryService(db *pgxpool.Pool) *GalleryService

func (*GalleryService) AddPhotosGallery

func (s *GalleryService) AddPhotosGallery(ctx context.Context, photos []models.Photo) (int, error)

func (*GalleryService) GetGallery

func (s *GalleryService) GetGallery(ctx context.Context) ([]models.Photo, error)

func (*GalleryService) GetGalleryByID

func (s *GalleryService) GetGalleryByID(ctx context.Context, id int) ([]models.Photo, error)

func (*GalleryService) RemovePhoto

func (s *GalleryService) RemovePhoto(ctx context.Context, id int) (string, error)

type Mailer

type Mailer struct {
	SmtpUsername string
	SmtpPassword string
	SmtpHost     string
	SmtpPort     int
	From         string
	To           string
	Body         string
	Message      string
	// contains filtered or unexported fields
}

func NewMailer

func NewMailer(smtpUsername, smtpPass, smtpHost string, port int, from, to string, clientData ClientData) *Mailer

func (*Mailer) Send

func (m *Mailer) Send() error

type TimeSlot

type TimeSlot struct {
	TimeSlots []time.Time `db:"time_slots"`
}

type WorkSchedule

type WorkSchedule struct {
	Open            *string `json:"open,omitempty"`
	Close           *string `json:"close,omitempty"`
	HaircutInterval *string `json:"haircut_interval,omitempty"`
	WeekendDays     *[]int  `json:"weekend_days,omitempty"`
}

type WorkScheduleService

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

func NewWorkScheduleService

func NewWorkScheduleService(db *pgxpool.Pool, schedule *models.WorkSchedule) *WorkScheduleService

func (*WorkScheduleService) GetWorkSchedule

func (s *WorkScheduleService) GetWorkSchedule(id int) (*models.WorkSchedule, error)

func (*WorkScheduleService) UpdateWorkSchedule

func (s *WorkScheduleService) UpdateWorkSchedule(ctx context.Context, workSchedule *WorkSchedule, id int) (*models.WorkSchedule, error)

Jump to

Keyboard shortcuts

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