diff --git a/internal/driver/calendar/service.go b/internal/driver/calendar/service.go index ea35f26..9a24c0f 100644 --- a/internal/driver/calendar/service.go +++ b/internal/driver/calendar/service.go @@ -16,10 +16,6 @@ import ( "google.golang.org/api/option" ) -type Client interface { - Create(calendarId, name, description string, from, to time.Time) error -} - type GoogleClient struct { calIds map[string]struct{} *calendar.Service diff --git a/internal/driver/pdf/service.go b/internal/driver/pdf/service.go index bf7163e..b24a230 100644 --- a/internal/driver/pdf/service.go +++ b/internal/driver/pdf/service.go @@ -11,11 +11,6 @@ import ( "github.com/labstack/gommon/log" ) -type Client interface { - BuildInvoice(context map[string]any) error - BuildReport(context map[string]any, period string, month, year int) error -} - type PdfClient struct { path string invoiceId string diff --git a/internal/service/booking/service.go b/internal/service/booking/service.go index de41534..3fafdc2 100644 --- a/internal/service/booking/service.go +++ b/internal/service/booking/service.go @@ -5,8 +5,6 @@ import ( "time" "github.com/rjNemo/rentease/internal/config" - "github.com/rjNemo/rentease/internal/driver/calendar" - "github.com/rjNemo/rentease/internal/driver/pdf" ) type Store interface { @@ -26,6 +24,15 @@ type Store interface { UpdateItem(id int, item string, paymentMethod string, paymentStatus string, qty int, price float64) (*Item, error) } +type PdfClient interface { + BuildInvoice(context map[string]any) error + BuildReport(context map[string]any, period string, month, year int) error +} + +type CalendarClient interface { + Create(calendarId, name, description string, from, to time.Time) error +} + type parserClient interface { Parse(rawContent string) (*Booking, error) } @@ -33,11 +40,11 @@ type parserClient interface { type Service struct { store Store parser parserClient - calendar calendar.Client - pdf pdf.Client + calendar CalendarClient + pdf PdfClient } -func NewService(store Store, parser parserClient, calendar calendar.Client, pdf pdf.Client) (*Service, error) { +func NewService(store Store, parser parserClient, calendar CalendarClient, pdf PdfClient) (*Service, error) { return &Service{ store: store, parser: parser,