Paul Pan
26a81652b3
1. add consumer 2. add createVersion 3. add upload 4. fix runner 5. add rejudge Co-authored-by: cxy004 <cxy004@qq.com> Co-authored-by: wzt <w.zhongtao@qq.com>
30 lines
621 B
Go
30 lines
621 B
Go
package status
|
|
|
|
import (
|
|
"github.com/WHUPRJ/woj-server/internal/e"
|
|
"github.com/WHUPRJ/woj-server/internal/global"
|
|
"github.com/WHUPRJ/woj-server/internal/model"
|
|
"go.uber.org/zap"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var _ Service = (*service)(nil)
|
|
|
|
type Service interface {
|
|
Create(data *CreateData) (*model.Status, e.Status)
|
|
Query(sid uint, associations bool) (*model.Status, e.Status)
|
|
QueryByVersion(pvid uint, offset int, limit int) ([]*model.Status, e.Status)
|
|
}
|
|
|
|
type service struct {
|
|
log *zap.Logger
|
|
db *gorm.DB
|
|
}
|
|
|
|
func NewService(g *global.Global) Service {
|
|
return &service{
|
|
log: g.Log,
|
|
db: g.Db.Get().(*gorm.DB),
|
|
}
|
|
}
|