2022-10-22 17:38:39 +08:00
|
|
|
package status
|
|
|
|
|
|
|
|
import (
|
2023-07-14 21:47:11 +08:00
|
|
|
"git.0x7f.app/WOJ/woj-server/internal/e"
|
2023-07-15 16:19:49 +08:00
|
|
|
"git.0x7f.app/WOJ/woj-server/internal/misc/log"
|
2023-07-14 21:47:11 +08:00
|
|
|
"git.0x7f.app/WOJ/woj-server/internal/model"
|
2023-07-15 16:19:49 +08:00
|
|
|
"git.0x7f.app/WOJ/woj-server/internal/repo/db"
|
|
|
|
"github.com/samber/do"
|
2022-10-22 17:38:39 +08:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ Service = (*service)(nil)
|
|
|
|
|
|
|
|
type Service interface {
|
2022-10-23 17:29:35 +08:00
|
|
|
Create(data *CreateData) (*model.Status, e.Status)
|
2022-10-22 17:38:39 +08:00
|
|
|
Query(sid uint, associations bool) (*model.Status, e.Status)
|
2023-12-23 15:36:42 +08:00
|
|
|
QueryByVersion(pvid uint, offset int, limit int, count *int64) ([]*model.Status, e.Status)
|
2023-07-15 16:19:49 +08:00
|
|
|
|
|
|
|
HealthCheck() error
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewService(i *do.Injector) (Service, error) {
|
|
|
|
return &service{
|
|
|
|
log: do.MustInvoke[log.Service](i).GetLogger("status"),
|
|
|
|
db: do.MustInvoke[db.Service](i),
|
|
|
|
}, nil
|
2022-10-22 17:38:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type service struct {
|
|
|
|
log *zap.Logger
|
2023-07-15 16:19:49 +08:00
|
|
|
db db.Service
|
2022-10-22 17:38:39 +08:00
|
|
|
}
|
|
|
|
|
2023-07-15 16:19:49 +08:00
|
|
|
func (s *service) HealthCheck() error {
|
|
|
|
return nil
|
2022-10-22 17:38:39 +08:00
|
|
|
}
|