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>
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package submission
|
|
|
|
import (
|
|
"github.com/WHUPRJ/woj-server/internal/global"
|
|
"github.com/WHUPRJ/woj-server/internal/service/problem"
|
|
"github.com/WHUPRJ/woj-server/internal/service/status"
|
|
"github.com/WHUPRJ/woj-server/internal/service/submission"
|
|
"github.com/WHUPRJ/woj-server/internal/service/task"
|
|
"github.com/gin-gonic/gin"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var _ Handler = (*handler)(nil)
|
|
|
|
type Handler interface {
|
|
Create(c *gin.Context)
|
|
Query(c *gin.Context)
|
|
Rejudge(c *gin.Context)
|
|
}
|
|
|
|
type handler struct {
|
|
log *zap.Logger
|
|
jwtService global.JwtService
|
|
problemService problem.Service
|
|
statusService status.Service
|
|
submissionService submission.Service
|
|
taskService task.Service
|
|
}
|
|
|
|
func RouteRegister(g *global.Global, group *gin.RouterGroup) {
|
|
app := &handler{
|
|
log: g.Log,
|
|
jwtService: g.Jwt,
|
|
problemService: problem.NewService(g),
|
|
statusService: status.NewService(g),
|
|
submissionService: submission.NewService(g),
|
|
taskService: task.NewService(g),
|
|
}
|
|
|
|
group.POST("/create", app.jwtService.Handler(true), app.Create)
|
|
group.POST("/query", app.Query)
|
|
group.POST("/rejudge", app.jwtService.Handler(true), app.Rejudge)
|
|
}
|