32 lines
601 B
Go
32 lines
601 B
Go
package data
|
|
|
|
import (
|
|
"context"
|
|
"git.usbharu.dev/usbharu/unos/illust"
|
|
)
|
|
|
|
type IllustDataServiceImpl struct {
|
|
UnimplementedIllustDataServiceServer
|
|
IllustDataRepository
|
|
}
|
|
|
|
func NewIllustDataServiceImpl(repository IllustDataRepository) *IllustDataServiceImpl {
|
|
return &IllustDataServiceImpl{
|
|
IllustDataRepository: repository,
|
|
}
|
|
}
|
|
|
|
func (s *IllustDataServiceImpl) Save(ctx context.Context, req *illust.Illust) (*illust.Illust, error) {
|
|
|
|
err := req.Validate()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
err = s.IllustDataRepository.Save(req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return req, nil
|
|
}
|