mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-02 04:53:41 +00:00
chore: remove dead code.
This commit is contained in:
@@ -40,9 +40,6 @@ type queries struct {
|
||||
InsertBusinessHours *sqlx.Stmt `query:"insert-business-hours"`
|
||||
DeleteBusinessHours *sqlx.Stmt `query:"delete-business-hours"`
|
||||
UpdateBusinessHours *sqlx.Stmt `query:"update-business-hours"`
|
||||
InsertHoliday *sqlx.Stmt `query:"insert-holiday"`
|
||||
DeleteHoliday *sqlx.Stmt `query:"delete-holiday"`
|
||||
GetAllHolidays *sqlx.Stmt `query:"get-all-holidays"`
|
||||
}
|
||||
|
||||
// New creates and returns a new instance of the Manager.
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package businesshours
|
||||
|
||||
import (
|
||||
"github.com/abhinavxd/libredesk/internal/business_hours/models"
|
||||
"github.com/abhinavxd/libredesk/internal/envelope"
|
||||
)
|
||||
|
||||
// GetAllHolidays retrieves all holidays.
|
||||
func (m *Manager) GetAllHolidays() ([]models.Holiday, error) {
|
||||
var holidays []models.Holiday
|
||||
if err := m.q.GetAllHolidays.Select(&holidays); err != nil {
|
||||
m.lo.Error("error getting holidays", "error", err)
|
||||
return nil, envelope.NewError(envelope.GeneralError, "Error getting holidays", nil)
|
||||
}
|
||||
return holidays, nil
|
||||
}
|
||||
|
||||
// AddHoliday adds a new holiday.
|
||||
func (m *Manager) AddHoliday(name string, date string) error {
|
||||
if _, err := m.q.InsertHoliday.Exec(name, date); err != nil {
|
||||
m.lo.Error("error inserting holiday", "error", err)
|
||||
return envelope.NewError(envelope.GeneralError, "Error adding holiday", nil)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveHoliday removes a holiday by name.
|
||||
func (m *Manager) RemoveHoliday(name string) error {
|
||||
if _, err := m.q.DeleteHoliday.Exec(name); err != nil {
|
||||
m.lo.Error("error deleting holiday", "error", err)
|
||||
return envelope.NewError(envelope.GeneralError, "Error removing holiday", nil)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -41,20 +41,4 @@ SET "name" = $2,
|
||||
hours = $5,
|
||||
holidays = $6,
|
||||
updated_at = NOW()
|
||||
WHERE id = $1;
|
||||
|
||||
-- name: insert-holiday
|
||||
INSERT INTO holidays (
|
||||
"name",
|
||||
date
|
||||
)
|
||||
VALUES ($1, $2);
|
||||
|
||||
-- name: delete-holiday
|
||||
DELETE FROM holidays
|
||||
WHERE "name" = $1;
|
||||
|
||||
-- name: get-all-holidays
|
||||
SELECT "name",
|
||||
date
|
||||
FROM holidays;
|
||||
WHERE id = $1;
|
||||
Reference in New Issue
Block a user