service.NewService   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 1
dl 0
loc 4
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
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