fix: swagger documentation

This commit is contained in:
Paul Pan 2023-07-16 16:27:12 +08:00
parent 42b9e98408
commit 7660069c34
5 changed files with 8 additions and 4 deletions

View File

@ -31,6 +31,7 @@ func (h *handler) Build(_ context.Context, t *asynq.Task) error {
}
for i := range config.Languages {
// do not store in db
config.Languages[i].Type = ""
config.Languages[i].Script = ""
config.Languages[i].Cmp = ""

View File

@ -18,6 +18,8 @@ type queryRequest struct {
// @Response 200 {object} e.Response "model.status"
// @Router /v1/status/query [post]
func (h *handler) Query(c *gin.Context) {
// TODO: add permission check
req := new(queryRequest)
if err := c.ShouldBind(req); err != nil {

View File

@ -21,9 +21,9 @@ type queryByVersionRequest struct {
// @Param offset formData int false "start position"
// @Param limit formData int true "limit number of records"
// @Response 200 {object} e.Response "[]*model.status"
// @Security Authentication
// @Router /v1/status/query/problem_version [post]
func (h *handler) QueryByProblemVersion(c *gin.Context) {
claim, exist := c.Get("claim")
if !exist {
e.Pong(c, e.UserUnauthenticated, nil)

View File

@ -61,6 +61,7 @@ func (h *handler) Query(c *gin.Context) {
Point: currentPoint,
}
// TODO: only show code when user is admin or the code is submitted by the user
newResponse.Submission.Code = ""
response = append(response, newResponse)

View File

@ -16,9 +16,9 @@ type Config struct {
} `json:"Runtime"`
Languages []struct {
Lang string `json:"Lang"`
Type string `json:"Type"`
Script string `json:"Script"`
Cmp string `json:"Cmp"`
Type string `json:"Type,omitempty"`
Script string `json:"Script,omitempty"`
Cmp string `json:"Cmp,omitempty"`
} `json:"Languages"`
Tasks []struct {
Id int `json:"Id"`