feat(tester, user): migrate from gRPC to REST
This commit is contained in:
parent
11644adc88
commit
b7ea2e6cc7
10 changed files with 638 additions and 1458 deletions
343
tester/v1/openapi.yaml
Normal file
343
tester/v1/openapi.yaml
Normal file
|
@ -0,0 +1,343 @@
|
|||
openapi: 3.0.3
|
||||
info:
|
||||
title: TesterService API
|
||||
version: 0.0.1
|
||||
paths:
|
||||
/problems:
|
||||
get:
|
||||
operationId: ListProblems
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ListProblemsResponse'
|
||||
post:
|
||||
operationId: CreateProblem
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateProblemResponse'
|
||||
/problems/{id}:
|
||||
get:
|
||||
operationId: GetProblem
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetProblemResponse'
|
||||
delete:
|
||||
operationId: DeleteProblem
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content: { }
|
||||
/contests:
|
||||
get:
|
||||
operationId: ListContests
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ListContestsResponse'
|
||||
post:
|
||||
operationId: CreateContest
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateContestResponse'
|
||||
/contests/{id}:
|
||||
get:
|
||||
operationId: GetContest
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetContestResponse'
|
||||
delete:
|
||||
operationId: DeleteContest
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
/contests/{id}/tasks:
|
||||
post:
|
||||
operationId: AddTask
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
- name: problem_id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AddTaskResponse'
|
||||
delete:
|
||||
operationId: DeleteTask
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
- name: task_id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
/contests/{id}/participants:
|
||||
post:
|
||||
operationId: AddParticipant
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
- name: user_id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AddParticipantResponse'
|
||||
delete:
|
||||
operationId: DeleteParticipant
|
||||
security:
|
||||
- bearerAuth: [ ]
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
- name: participant_id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
components:
|
||||
schemas:
|
||||
Problem:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- title
|
||||
- legend
|
||||
- input_format
|
||||
- output_format
|
||||
- notes
|
||||
- tutorial
|
||||
- latex_summary
|
||||
- time_limit
|
||||
- memory_limit
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
title:
|
||||
type: string
|
||||
legend:
|
||||
type: string
|
||||
input_format:
|
||||
type: string
|
||||
output_format:
|
||||
type: string
|
||||
notes:
|
||||
type: string
|
||||
tutorial:
|
||||
type: string
|
||||
latex_summary:
|
||||
type: string
|
||||
time_limit:
|
||||
type: integer
|
||||
format: int32
|
||||
memory_limit:
|
||||
type: integer
|
||||
format: int32
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
ListProblemsResponse:
|
||||
type: object
|
||||
required:
|
||||
- problems
|
||||
properties:
|
||||
problems:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
CreateProblemResponse:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
GetProblemResponse:
|
||||
type: object
|
||||
required:
|
||||
- problem
|
||||
properties:
|
||||
problem:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
Contest:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- title
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
title:
|
||||
type: string
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
ListContestsResponse:
|
||||
type: object
|
||||
required:
|
||||
- contests
|
||||
properties:
|
||||
contests:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Contest'
|
||||
CreateContestResponse:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
GetContestResponse:
|
||||
type: object
|
||||
required:
|
||||
- contest
|
||||
properties:
|
||||
contest:
|
||||
$ref: '#/components/schemas/Contest'
|
||||
AddParticipantResponse:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
AddTaskResponse:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
securitySchemes:
|
||||
bearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
|
@ -1,18 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package tester.v1;
|
||||
option go_package = "/tester/v1;testerv1";
|
||||
|
||||
service TesterService {
|
||||
rpc CreateSolution (CreateSolutionRequest) returns (stream TestingState);
|
||||
}
|
||||
|
||||
message CreateSolutionRequest {
|
||||
int32 task_id = 1;
|
||||
int32 language = 2;
|
||||
string solution = 3;
|
||||
}
|
||||
|
||||
message TestingState {
|
||||
string msg = 1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue