unos/illust-data/illust/data/illust_data.service.go

32 lines
601 B
Go
Raw Normal View History

2024-03-17 05:38:14 +00:00
package data
import (
"context"
"git.usbharu.dev/usbharu/unos/illust"
)
type IllustDataServiceImpl struct {
UnimplementedIllustDataServiceServer
2024-03-17 06:58:19 +00:00
IllustDataRepository
2024-03-17 05:38:14 +00:00
}
2024-03-17 06:58:19 +00:00
func NewIllustDataServiceImpl(repository IllustDataRepository) *IllustDataServiceImpl {
return &IllustDataServiceImpl{
IllustDataRepository: repository,
}
2024-03-17 05:38:14 +00:00
}
func (s *IllustDataServiceImpl) Save(ctx context.Context, req *illust.Illust) (*illust.Illust, error) {
2024-03-17 06:58:19 +00:00
err := req.Validate()
if err != nil {
return nil, err
}
err = s.IllustDataRepository.Save(req)
if err != nil {
2024-03-17 05:38:14 +00:00
return nil, err
}
return req, nil
}