2024-01-16 16:13:06 +00:00
|
|
|
package benefactoraddressservice
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-07-24 23:45:04 +00:00
|
|
|
|
2024-01-16 16:13:06 +00:00
|
|
|
"git.gocasts.ir/ebhomengo/niki/entity"
|
2024-08-01 10:20:18 +00:00
|
|
|
validator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/address"
|
2024-01-16 16:13:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Repository interface {
|
|
|
|
CreateBenefactorAddress(ctx context.Context, address entity.Address) (entity.Address, error)
|
2024-08-01 10:20:18 +00:00
|
|
|
GetAddressByID(ctx context.Context, id uint) (entity.Address, error)
|
2024-01-17 20:17:06 +00:00
|
|
|
GetAllProvinces(ctx context.Context) ([]entity.Province, error)
|
2024-01-18 10:16:36 +00:00
|
|
|
GetAllCities(ctx context.Context) ([]entity.City, error)
|
2024-06-06 17:54:56 +00:00
|
|
|
UpdateAddress(ctx context.Context, address entity.Address) error
|
2024-06-01 00:29:11 +00:00
|
|
|
GetAddress(ctx context.Context, addressID uint, benefactorID uint) (entity.Address, error)
|
2024-06-01 18:01:00 +00:00
|
|
|
GetAddresses(ctx context.Context, benefactorID uint) ([]entity.Address, error)
|
2024-06-08 14:25:24 +00:00
|
|
|
DeleteBenefactorAddress(ctx context.Context, addressID uint, benefactorID uint) error
|
2024-01-16 16:13:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Service struct {
|
|
|
|
repo Repository
|
2024-08-01 10:20:18 +00:00
|
|
|
vld validator.Validator
|
2024-01-16 16:13:06 +00:00
|
|
|
}
|
|
|
|
|
2024-08-01 10:20:18 +00:00
|
|
|
func New(repo Repository, vld validator.Validator) Service {
|
|
|
|
return Service{repo: repo, vld: vld}
|
2024-01-16 16:13:06 +00:00
|
|
|
}
|