pkg/service/service.go   A
last analyzed

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
cc 1
eloc 19
dl 0
loc 28
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A service.NewService 0 4 1
1
package service
2
3
import (
4
	"github.com/architectv/estate-task/pkg/model"
5
	"github.com/architectv/estate-task/pkg/repository"
6
)
7
8
type Room interface {
9
	Create(room *model.Room) (int, error)
10
	Delete(id int) error
11
	GetAll(sortField string) ([]*model.Room, error)
12
}
13
14
type Booking interface {
15
	Create(booking *model.Booking) (int, error)
16
	Delete(id int) error
17
	GetByRoomId(roomId int) ([]*model.Booking, error)
18
}
19
20
type Service struct {
21
	Room
22
	Booking
23
}
24
25
func NewService(repos *repository.Repository) *Service {
26
	return &Service{
27
		Room:    NewRoomService(repos.Room),
28
		Booking: NewBookingService(repos.Booking, repos.Room),
29
	}
30
}
31