chore(api)!: added new fields to contract
This commit is contained in:
@@ -68,6 +68,7 @@ type TaskRequest struct {
|
||||
InCompetitionPosition int32 `json:"in_competition_position" validate:"required"`
|
||||
MaxPoints int32 `json:"max_points,omitempty"`
|
||||
MaxAttempts int32 `json:"max_attempts,omitempty"`
|
||||
AnswerURL string `json:"answer_url,omitempty"`
|
||||
Type string `json:"type" validate:"required,oneof=input checker review"`
|
||||
}
|
||||
|
||||
@@ -79,6 +80,7 @@ type TaskResponse struct {
|
||||
InCompetitionPosition int32 `json:"in_competition_position"`
|
||||
MaxPoints int32 `json:"max_points,omitempty"`
|
||||
MaxAttempts int32 `json:"max_attempts,omitempty"`
|
||||
AnswerURL string `json:"answer_url,omitempty"`
|
||||
Type string `json:"type"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
@@ -89,9 +91,10 @@ type ListTasksResponse struct {
|
||||
}
|
||||
|
||||
type TaskAttachmentResponse struct {
|
||||
ID string `json:"id"`
|
||||
FileURL string `json:"file_url"`
|
||||
IsPublic bool `json:"is_public"`
|
||||
ID string `json:"id"`
|
||||
FileURL string `json:"file_url"`
|
||||
Mountpoint string `json:"mountpoint,omitempty"`
|
||||
IsPublic bool `json:"is_public"`
|
||||
}
|
||||
|
||||
type SubmissionResponse struct {
|
||||
|
||||
@@ -49,12 +49,22 @@ func TaskProtoToHTTP(t *taskpb.Task) *domain.TaskResponse {
|
||||
InCompetitionPosition: t.InCompetitionPosition,
|
||||
MaxPoints: t.MaxPoints,
|
||||
MaxAttempts: t.MaxAttempts,
|
||||
AnswerURL: t.AnswerUrl,
|
||||
Type: TaskTypeToString(t.Type),
|
||||
CreatedAt: t.CreatedAt.AsTime(),
|
||||
UpdatedAt: t.UpdatedAt.AsTime(),
|
||||
}
|
||||
}
|
||||
|
||||
func TaskAttachmentProtoToHTTP(a *taskpb.TaskAttachment) *domain.TaskAttachmentResponse {
|
||||
return &domain.TaskAttachmentResponse{
|
||||
ID: a.Id,
|
||||
FileURL: a.FileUrl,
|
||||
Mountpoint: a.Mountpoint,
|
||||
IsPublic: a.IsPublic,
|
||||
}
|
||||
}
|
||||
|
||||
func SubmissionProtoToHTTP(s *subpb.Submission) *domain.SubmissionResponse {
|
||||
return &domain.SubmissionResponse{
|
||||
ID: s.Id,
|
||||
@@ -150,6 +160,7 @@ func TaskHTTPToProto(req *domain.TaskRequest) *taskpb.Task {
|
||||
InCompetitionPosition: req.InCompetitionPosition,
|
||||
MaxPoints: req.MaxPoints,
|
||||
MaxAttempts: req.MaxAttempts,
|
||||
AnswerUrl: req.AnswerURL,
|
||||
Type: StringToTaskType(req.Type),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user