init push
This commit is contained in:
23
internal/domain/other_person/service.go
Normal file
23
internal/domain/other_person/service.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package otherperson
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Sentinel errors returned by the service so the transport layer can map them to the
|
||||
// right HTTP status without depending on GORM internals.
|
||||
var (
|
||||
ErrNameRequired = errors.New("name is required")
|
||||
ErrNotFound = errors.New("other person not found")
|
||||
ErrDuplicate = errors.New("another other person with the same name, mobile phone and email already exists")
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
Create(ctx context.Context, p *OtherPerson) error
|
||||
Update(ctx context.Context, p *OtherPerson) error
|
||||
Delete(ctx context.Context, id, actor []byte) error
|
||||
GetByID(ctx context.Context, id []byte) (*OtherPerson, error)
|
||||
Search(ctx context.Context, q string, limit, offset int) ([]OtherPerson, int64, error)
|
||||
Upsert(ctx context.Context, p *OtherPerson) error
|
||||
}
|
||||
Reference in New Issue
Block a user