From 5319e94f00cf8352c6cd6f0b22c04f66efc9db2b Mon Sep 17 00:00:00 2001 From: tosuke <13393900+tosuke@users.noreply.github.com> Date: Thu, 19 Dec 2024 04:40:06 +0900 Subject: [PATCH] feat: add Problem spec for admin.v1 --- .../v1/adminv1connect/problem.connect.go | 203 +++++++ backend/pkg/proto/admin/v1/problem.pb.go | 556 ++++++++++++++++++ frontend/packages/proto/exports/admin-v1.ts | 1 + .../proto/proto/admin/v1/problem_pb.ts | 215 +++++++ proto/admin/v1/problem.proto | 77 +++ 5 files changed, 1052 insertions(+) create mode 100644 backend/pkg/proto/admin/v1/adminv1connect/problem.connect.go create mode 100644 backend/pkg/proto/admin/v1/problem.pb.go create mode 100644 frontend/packages/proto/proto/admin/v1/problem_pb.ts create mode 100644 proto/admin/v1/problem.proto diff --git a/backend/pkg/proto/admin/v1/adminv1connect/problem.connect.go b/backend/pkg/proto/admin/v1/adminv1connect/problem.connect.go new file mode 100644 index 00000000..1b0bd3f7 --- /dev/null +++ b/backend/pkg/proto/admin/v1/adminv1connect/problem.connect.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: admin/v1/problem.proto + +package adminv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/ictsc/ictsc-regalia/backend/pkg/proto/admin/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // ProblemServiceName is the fully-qualified name of the ProblemService service. + ProblemServiceName = "admin.v1.ProblemService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ProblemServiceListProblemsProcedure is the fully-qualified name of the ProblemService's + // ListProblems RPC. + ProblemServiceListProblemsProcedure = "/admin.v1.ProblemService/ListProblems" + // ProblemServiceGetProblemProcedure is the fully-qualified name of the ProblemService's GetProblem + // RPC. + ProblemServiceGetProblemProcedure = "/admin.v1.ProblemService/GetProblem" + // ProblemServiceCreateProblemProcedure is the fully-qualified name of the ProblemService's + // CreateProblem RPC. + ProblemServiceCreateProblemProcedure = "/admin.v1.ProblemService/CreateProblem" + // ProblemServiceDeleteProblemProcedure is the fully-qualified name of the ProblemService's + // DeleteProblem RPC. + ProblemServiceDeleteProblemProcedure = "/admin.v1.ProblemService/DeleteProblem" +) + +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + problemServiceServiceDescriptor = v1.File_admin_v1_problem_proto.Services().ByName("ProblemService") + problemServiceListProblemsMethodDescriptor = problemServiceServiceDescriptor.Methods().ByName("ListProblems") + problemServiceGetProblemMethodDescriptor = problemServiceServiceDescriptor.Methods().ByName("GetProblem") + problemServiceCreateProblemMethodDescriptor = problemServiceServiceDescriptor.Methods().ByName("CreateProblem") + problemServiceDeleteProblemMethodDescriptor = problemServiceServiceDescriptor.Methods().ByName("DeleteProblem") +) + +// ProblemServiceClient is a client for the admin.v1.ProblemService service. +type ProblemServiceClient interface { + ListProblems(context.Context, *connect.Request[v1.ListProblemsRequest]) (*connect.Response[v1.ListProblemsResponse], error) + GetProblem(context.Context, *connect.Request[v1.GetProblemRequest]) (*connect.Response[v1.GetProblemResponse], error) + CreateProblem(context.Context, *connect.Request[v1.CreateProblemRequest]) (*connect.Response[v1.CreateProblemResponse], error) + DeleteProblem(context.Context, *connect.Request[v1.DeleteProblemRequest]) (*connect.Response[v1.DeleteProblemResponse], error) +} + +// NewProblemServiceClient constructs a client for the admin.v1.ProblemService service. By default, +// it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and +// sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() +// or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewProblemServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ProblemServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &problemServiceClient{ + listProblems: connect.NewClient[v1.ListProblemsRequest, v1.ListProblemsResponse]( + httpClient, + baseURL+ProblemServiceListProblemsProcedure, + connect.WithSchema(problemServiceListProblemsMethodDescriptor), + connect.WithClientOptions(opts...), + ), + getProblem: connect.NewClient[v1.GetProblemRequest, v1.GetProblemResponse]( + httpClient, + baseURL+ProblemServiceGetProblemProcedure, + connect.WithSchema(problemServiceGetProblemMethodDescriptor), + connect.WithClientOptions(opts...), + ), + createProblem: connect.NewClient[v1.CreateProblemRequest, v1.CreateProblemResponse]( + httpClient, + baseURL+ProblemServiceCreateProblemProcedure, + connect.WithSchema(problemServiceCreateProblemMethodDescriptor), + connect.WithClientOptions(opts...), + ), + deleteProblem: connect.NewClient[v1.DeleteProblemRequest, v1.DeleteProblemResponse]( + httpClient, + baseURL+ProblemServiceDeleteProblemProcedure, + connect.WithSchema(problemServiceDeleteProblemMethodDescriptor), + connect.WithClientOptions(opts...), + ), + } +} + +// problemServiceClient implements ProblemServiceClient. +type problemServiceClient struct { + listProblems *connect.Client[v1.ListProblemsRequest, v1.ListProblemsResponse] + getProblem *connect.Client[v1.GetProblemRequest, v1.GetProblemResponse] + createProblem *connect.Client[v1.CreateProblemRequest, v1.CreateProblemResponse] + deleteProblem *connect.Client[v1.DeleteProblemRequest, v1.DeleteProblemResponse] +} + +// ListProblems calls admin.v1.ProblemService.ListProblems. +func (c *problemServiceClient) ListProblems(ctx context.Context, req *connect.Request[v1.ListProblemsRequest]) (*connect.Response[v1.ListProblemsResponse], error) { + return c.listProblems.CallUnary(ctx, req) +} + +// GetProblem calls admin.v1.ProblemService.GetProblem. +func (c *problemServiceClient) GetProblem(ctx context.Context, req *connect.Request[v1.GetProblemRequest]) (*connect.Response[v1.GetProblemResponse], error) { + return c.getProblem.CallUnary(ctx, req) +} + +// CreateProblem calls admin.v1.ProblemService.CreateProblem. +func (c *problemServiceClient) CreateProblem(ctx context.Context, req *connect.Request[v1.CreateProblemRequest]) (*connect.Response[v1.CreateProblemResponse], error) { + return c.createProblem.CallUnary(ctx, req) +} + +// DeleteProblem calls admin.v1.ProblemService.DeleteProblem. +func (c *problemServiceClient) DeleteProblem(ctx context.Context, req *connect.Request[v1.DeleteProblemRequest]) (*connect.Response[v1.DeleteProblemResponse], error) { + return c.deleteProblem.CallUnary(ctx, req) +} + +// ProblemServiceHandler is an implementation of the admin.v1.ProblemService service. +type ProblemServiceHandler interface { + ListProblems(context.Context, *connect.Request[v1.ListProblemsRequest]) (*connect.Response[v1.ListProblemsResponse], error) + GetProblem(context.Context, *connect.Request[v1.GetProblemRequest]) (*connect.Response[v1.GetProblemResponse], error) + CreateProblem(context.Context, *connect.Request[v1.CreateProblemRequest]) (*connect.Response[v1.CreateProblemResponse], error) + DeleteProblem(context.Context, *connect.Request[v1.DeleteProblemRequest]) (*connect.Response[v1.DeleteProblemResponse], error) +} + +// NewProblemServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewProblemServiceHandler(svc ProblemServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + problemServiceListProblemsHandler := connect.NewUnaryHandler( + ProblemServiceListProblemsProcedure, + svc.ListProblems, + connect.WithSchema(problemServiceListProblemsMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + problemServiceGetProblemHandler := connect.NewUnaryHandler( + ProblemServiceGetProblemProcedure, + svc.GetProblem, + connect.WithSchema(problemServiceGetProblemMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + problemServiceCreateProblemHandler := connect.NewUnaryHandler( + ProblemServiceCreateProblemProcedure, + svc.CreateProblem, + connect.WithSchema(problemServiceCreateProblemMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + problemServiceDeleteProblemHandler := connect.NewUnaryHandler( + ProblemServiceDeleteProblemProcedure, + svc.DeleteProblem, + connect.WithSchema(problemServiceDeleteProblemMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + return "/admin.v1.ProblemService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ProblemServiceListProblemsProcedure: + problemServiceListProblemsHandler.ServeHTTP(w, r) + case ProblemServiceGetProblemProcedure: + problemServiceGetProblemHandler.ServeHTTP(w, r) + case ProblemServiceCreateProblemProcedure: + problemServiceCreateProblemHandler.ServeHTTP(w, r) + case ProblemServiceDeleteProblemProcedure: + problemServiceDeleteProblemHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedProblemServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedProblemServiceHandler struct{} + +func (UnimplementedProblemServiceHandler) ListProblems(context.Context, *connect.Request[v1.ListProblemsRequest]) (*connect.Response[v1.ListProblemsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("admin.v1.ProblemService.ListProblems is not implemented")) +} + +func (UnimplementedProblemServiceHandler) GetProblem(context.Context, *connect.Request[v1.GetProblemRequest]) (*connect.Response[v1.GetProblemResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("admin.v1.ProblemService.GetProblem is not implemented")) +} + +func (UnimplementedProblemServiceHandler) CreateProblem(context.Context, *connect.Request[v1.CreateProblemRequest]) (*connect.Response[v1.CreateProblemResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("admin.v1.ProblemService.CreateProblem is not implemented")) +} + +func (UnimplementedProblemServiceHandler) DeleteProblem(context.Context, *connect.Request[v1.DeleteProblemRequest]) (*connect.Response[v1.DeleteProblemResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("admin.v1.ProblemService.DeleteProblem is not implemented")) +} diff --git a/backend/pkg/proto/admin/v1/problem.pb.go b/backend/pkg/proto/admin/v1/problem.pb.go new file mode 100644 index 00000000..b8955d06 --- /dev/null +++ b/backend/pkg/proto/admin/v1/problem.pb.go @@ -0,0 +1,556 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.0 +// protoc (unknown) +// source: admin/v1/problem.proto + +package adminv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Problem struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 問題コード + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + // タイトル + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + // 最大得点 + MaxScore int64 `protobuf:"varint,4,opt,name=max_score,json=maxScore,proto3" json:"max_score,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Problem) Reset() { + *x = Problem{} + mi := &file_admin_v1_problem_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Problem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Problem) ProtoMessage() {} + +func (x *Problem) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Problem.ProtoReflect.Descriptor instead. +func (*Problem) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{0} +} + +func (x *Problem) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Problem) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Problem) GetMaxScore() int64 { + if x != nil { + return x.MaxScore + } + return 0 +} + +type ListProblemsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListProblemsRequest) Reset() { + *x = ListProblemsRequest{} + mi := &file_admin_v1_problem_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListProblemsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListProblemsRequest) ProtoMessage() {} + +func (x *ListProblemsRequest) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListProblemsRequest.ProtoReflect.Descriptor instead. +func (*ListProblemsRequest) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{1} +} + +type ListProblemsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Problems []*Problem `protobuf:"bytes,1,rep,name=problems,proto3" json:"problems,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListProblemsResponse) Reset() { + *x = ListProblemsResponse{} + mi := &file_admin_v1_problem_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListProblemsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListProblemsResponse) ProtoMessage() {} + +func (x *ListProblemsResponse) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListProblemsResponse.ProtoReflect.Descriptor instead. +func (*ListProblemsResponse) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{2} +} + +func (x *ListProblemsResponse) GetProblems() []*Problem { + if x != nil { + return x.Problems + } + return nil +} + +type GetProblemRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProblemRequest) Reset() { + *x = GetProblemRequest{} + mi := &file_admin_v1_problem_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProblemRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProblemRequest) ProtoMessage() {} + +func (x *GetProblemRequest) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProblemRequest.ProtoReflect.Descriptor instead. +func (*GetProblemRequest) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{3} +} + +func (x *GetProblemRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type GetProblemResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Problem *Problem `protobuf:"bytes,1,opt,name=problem,proto3" json:"problem,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProblemResponse) Reset() { + *x = GetProblemResponse{} + mi := &file_admin_v1_problem_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProblemResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProblemResponse) ProtoMessage() {} + +func (x *GetProblemResponse) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProblemResponse.ProtoReflect.Descriptor instead. +func (*GetProblemResponse) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{4} +} + +func (x *GetProblemResponse) GetProblem() *Problem { + if x != nil { + return x.Problem + } + return nil +} + +type CreateProblemRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Problem *Problem `protobuf:"bytes,1,opt,name=problem,proto3" json:"problem,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateProblemRequest) Reset() { + *x = CreateProblemRequest{} + mi := &file_admin_v1_problem_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateProblemRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateProblemRequest) ProtoMessage() {} + +func (x *CreateProblemRequest) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateProblemRequest.ProtoReflect.Descriptor instead. +func (*CreateProblemRequest) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateProblemRequest) GetProblem() *Problem { + if x != nil { + return x.Problem + } + return nil +} + +type CreateProblemResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Problem *Problem `protobuf:"bytes,1,opt,name=problem,proto3" json:"problem,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateProblemResponse) Reset() { + *x = CreateProblemResponse{} + mi := &file_admin_v1_problem_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateProblemResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateProblemResponse) ProtoMessage() {} + +func (x *CreateProblemResponse) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateProblemResponse.ProtoReflect.Descriptor instead. +func (*CreateProblemResponse) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{6} +} + +func (x *CreateProblemResponse) GetProblem() *Problem { + if x != nil { + return x.Problem + } + return nil +} + +type DeleteProblemRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteProblemRequest) Reset() { + *x = DeleteProblemRequest{} + mi := &file_admin_v1_problem_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteProblemRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteProblemRequest) ProtoMessage() {} + +func (x *DeleteProblemRequest) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteProblemRequest.ProtoReflect.Descriptor instead. +func (*DeleteProblemRequest) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteProblemRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type DeleteProblemResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteProblemResponse) Reset() { + *x = DeleteProblemResponse{} + mi := &file_admin_v1_problem_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteProblemResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteProblemResponse) ProtoMessage() {} + +func (x *DeleteProblemResponse) ProtoReflect() protoreflect.Message { + mi := &file_admin_v1_problem_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteProblemResponse.ProtoReflect.Descriptor instead. +func (*DeleteProblemResponse) Descriptor() ([]byte, []int) { + return file_admin_v1_problem_proto_rawDescGZIP(), []int{8} +} + +var File_admin_v1_problem_proto protoreflect.FileDescriptor + +var file_admin_v1_problem_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x62, 0x6c, + 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, + 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x59, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x12, 0x1b, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69, + 0x73, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x45, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x08, 0x70, 0x72, 0x6f, + 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x08, + 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x22, 0x27, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, + 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x22, 0x41, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x62, 0x6c, + 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x07, 0x70, 0x72, 0x6f, + 0x62, 0x6c, 0x65, 0x6d, 0x22, 0x43, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, + 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, + 0x52, 0x07, 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x22, 0x44, 0x0a, 0x15, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x22, + 0x2a, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcc, 0x02, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, + 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, 0x1d, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x62, 0x6c, 0x65, 0x6d, 0x12, 0x1b, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x50, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, + 0x12, 0x1e, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x50, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, + 0x65, 0x6d, 0x12, 0x1e, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x69, 0x63, 0x74, 0x73, 0x63, 0x2f, 0x69, 0x63, 0x74, 0x73, 0x63, 0x2d, 0x72, 0x65, + 0x67, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x76, 0x31, + 0x3b, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_admin_v1_problem_proto_rawDescOnce sync.Once + file_admin_v1_problem_proto_rawDescData = file_admin_v1_problem_proto_rawDesc +) + +func file_admin_v1_problem_proto_rawDescGZIP() []byte { + file_admin_v1_problem_proto_rawDescOnce.Do(func() { + file_admin_v1_problem_proto_rawDescData = protoimpl.X.CompressGZIP(file_admin_v1_problem_proto_rawDescData) + }) + return file_admin_v1_problem_proto_rawDescData +} + +var file_admin_v1_problem_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_admin_v1_problem_proto_goTypes = []any{ + (*Problem)(nil), // 0: admin.v1.Problem + (*ListProblemsRequest)(nil), // 1: admin.v1.ListProblemsRequest + (*ListProblemsResponse)(nil), // 2: admin.v1.ListProblemsResponse + (*GetProblemRequest)(nil), // 3: admin.v1.GetProblemRequest + (*GetProblemResponse)(nil), // 4: admin.v1.GetProblemResponse + (*CreateProblemRequest)(nil), // 5: admin.v1.CreateProblemRequest + (*CreateProblemResponse)(nil), // 6: admin.v1.CreateProblemResponse + (*DeleteProblemRequest)(nil), // 7: admin.v1.DeleteProblemRequest + (*DeleteProblemResponse)(nil), // 8: admin.v1.DeleteProblemResponse +} +var file_admin_v1_problem_proto_depIdxs = []int32{ + 0, // 0: admin.v1.ListProblemsResponse.problems:type_name -> admin.v1.Problem + 0, // 1: admin.v1.GetProblemResponse.problem:type_name -> admin.v1.Problem + 0, // 2: admin.v1.CreateProblemRequest.problem:type_name -> admin.v1.Problem + 0, // 3: admin.v1.CreateProblemResponse.problem:type_name -> admin.v1.Problem + 1, // 4: admin.v1.ProblemService.ListProblems:input_type -> admin.v1.ListProblemsRequest + 3, // 5: admin.v1.ProblemService.GetProblem:input_type -> admin.v1.GetProblemRequest + 5, // 6: admin.v1.ProblemService.CreateProblem:input_type -> admin.v1.CreateProblemRequest + 7, // 7: admin.v1.ProblemService.DeleteProblem:input_type -> admin.v1.DeleteProblemRequest + 2, // 8: admin.v1.ProblemService.ListProblems:output_type -> admin.v1.ListProblemsResponse + 4, // 9: admin.v1.ProblemService.GetProblem:output_type -> admin.v1.GetProblemResponse + 6, // 10: admin.v1.ProblemService.CreateProblem:output_type -> admin.v1.CreateProblemResponse + 8, // 11: admin.v1.ProblemService.DeleteProblem:output_type -> admin.v1.DeleteProblemResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_admin_v1_problem_proto_init() } +func file_admin_v1_problem_proto_init() { + if File_admin_v1_problem_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_admin_v1_problem_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_admin_v1_problem_proto_goTypes, + DependencyIndexes: file_admin_v1_problem_proto_depIdxs, + MessageInfos: file_admin_v1_problem_proto_msgTypes, + }.Build() + File_admin_v1_problem_proto = out.File + file_admin_v1_problem_proto_rawDesc = nil + file_admin_v1_problem_proto_goTypes = nil + file_admin_v1_problem_proto_depIdxs = nil +} diff --git a/frontend/packages/proto/exports/admin-v1.ts b/frontend/packages/proto/exports/admin-v1.ts index 7545767a..58ba5a3f 100644 --- a/frontend/packages/proto/exports/admin-v1.ts +++ b/frontend/packages/proto/exports/admin-v1.ts @@ -1,2 +1,3 @@ // Code generated by scripts/generate-exports.ts; DO NOT EDIT. +export * from "../proto/admin/v1/problem_pb.ts"; export * from "../proto/admin/v1/team_pb.ts"; diff --git a/frontend/packages/proto/proto/admin/v1/problem_pb.ts b/frontend/packages/proto/proto/admin/v1/problem_pb.ts new file mode 100644 index 00000000..dfb2c05d --- /dev/null +++ b/frontend/packages/proto/proto/admin/v1/problem_pb.ts @@ -0,0 +1,215 @@ +// @generated by protoc-gen-es v2.2.3 with parameter "target=ts" +// @generated from file admin/v1/problem.proto (package admin.v1, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import { file_buf_validate_validate } from "../../buf/validate/validate_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file admin/v1/problem.proto. + */ +export const file_admin_v1_problem: GenFile = /*@__PURE__*/ + fileDesc("ChZhZG1pbi92MS9wcm9ibGVtLnByb3RvEghhZG1pbi52MSJCCgdQcm9ibGVtEhUKBGNvZGUYASABKAlCB7pIBHICEAESDQoFdGl0bGUYAiABKAkSEQoJbWF4X3Njb3JlGAQgASgDIhUKE0xpc3RQcm9ibGVtc1JlcXVlc3QiOwoUTGlzdFByb2JsZW1zUmVzcG9uc2USIwoIcHJvYmxlbXMYASADKAsyES5hZG1pbi52MS5Qcm9ibGVtIiEKEUdldFByb2JsZW1SZXF1ZXN0EgwKBGNvZGUYASABKAkiOAoSR2V0UHJvYmxlbVJlc3BvbnNlEiIKB3Byb2JsZW0YASABKAsyES5hZG1pbi52MS5Qcm9ibGVtIjoKFENyZWF0ZVByb2JsZW1SZXF1ZXN0EiIKB3Byb2JsZW0YASABKAsyES5hZG1pbi52MS5Qcm9ibGVtIjsKFUNyZWF0ZVByb2JsZW1SZXNwb25zZRIiCgdwcm9ibGVtGAEgASgLMhEuYWRtaW4udjEuUHJvYmxlbSIkChREZWxldGVQcm9ibGVtUmVxdWVzdBIMCgRjb2RlGAEgASgJIhcKFURlbGV0ZVByb2JsZW1SZXNwb25zZTLMAgoOUHJvYmxlbVNlcnZpY2USTQoMTGlzdFByb2JsZW1zEh0uYWRtaW4udjEuTGlzdFByb2JsZW1zUmVxdWVzdBoeLmFkbWluLnYxLkxpc3RQcm9ibGVtc1Jlc3BvbnNlEkcKCkdldFByb2JsZW0SGy5hZG1pbi52MS5HZXRQcm9ibGVtUmVxdWVzdBocLmFkbWluLnYxLkdldFByb2JsZW1SZXNwb25zZRJQCg1DcmVhdGVQcm9ibGVtEh4uYWRtaW4udjEuQ3JlYXRlUHJvYmxlbVJlcXVlc3QaHy5hZG1pbi52MS5DcmVhdGVQcm9ibGVtUmVzcG9uc2USUAoNRGVsZXRlUHJvYmxlbRIeLmFkbWluLnYxLkRlbGV0ZVByb2JsZW1SZXF1ZXN0Gh8uYWRtaW4udjEuRGVsZXRlUHJvYmxlbVJlc3BvbnNlQqABCgxjb20uYWRtaW4udjFCDFByb2JsZW1Qcm90b1ABWkFnaXRodWIuY29tL2ljdHNjL2ljdHNjLXJlZ2FsaWEvYmFja2VuZC9wa2cvcHJvdG8vYWRtaW4vdjE7YWRtaW52MaICA0FYWKoCCEFkbWluLlYxygIIQWRtaW5cVjHiAhRBZG1pblxWMVxHUEJNZXRhZGF0YeoCCUFkbWluOjpWMWIGcHJvdG8z", [file_buf_validate_validate]); + +/** + * @generated from message admin.v1.Problem + */ +export type Problem = Message<"admin.v1.Problem"> & { + /** + * 問題コード + * + * @generated from field: string code = 1; + */ + code: string; + + /** + * タイトル + * + * @generated from field: string title = 2; + */ + title: string; + + /** + * 最大得点 + * + * @generated from field: int64 max_score = 4; + */ + maxScore: bigint; +}; + +/** + * Describes the message admin.v1.Problem. + * Use `create(ProblemSchema)` to create a new message. + */ +export const ProblemSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 0); + +/** + * @generated from message admin.v1.ListProblemsRequest + */ +export type ListProblemsRequest = Message<"admin.v1.ListProblemsRequest"> & { +}; + +/** + * Describes the message admin.v1.ListProblemsRequest. + * Use `create(ListProblemsRequestSchema)` to create a new message. + */ +export const ListProblemsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 1); + +/** + * @generated from message admin.v1.ListProblemsResponse + */ +export type ListProblemsResponse = Message<"admin.v1.ListProblemsResponse"> & { + /** + * @generated from field: repeated admin.v1.Problem problems = 1; + */ + problems: Problem[]; +}; + +/** + * Describes the message admin.v1.ListProblemsResponse. + * Use `create(ListProblemsResponseSchema)` to create a new message. + */ +export const ListProblemsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 2); + +/** + * @generated from message admin.v1.GetProblemRequest + */ +export type GetProblemRequest = Message<"admin.v1.GetProblemRequest"> & { + /** + * @generated from field: string code = 1; + */ + code: string; +}; + +/** + * Describes the message admin.v1.GetProblemRequest. + * Use `create(GetProblemRequestSchema)` to create a new message. + */ +export const GetProblemRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 3); + +/** + * @generated from message admin.v1.GetProblemResponse + */ +export type GetProblemResponse = Message<"admin.v1.GetProblemResponse"> & { + /** + * @generated from field: admin.v1.Problem problem = 1; + */ + problem?: Problem; +}; + +/** + * Describes the message admin.v1.GetProblemResponse. + * Use `create(GetProblemResponseSchema)` to create a new message. + */ +export const GetProblemResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 4); + +/** + * @generated from message admin.v1.CreateProblemRequest + */ +export type CreateProblemRequest = Message<"admin.v1.CreateProblemRequest"> & { + /** + * @generated from field: admin.v1.Problem problem = 1; + */ + problem?: Problem; +}; + +/** + * Describes the message admin.v1.CreateProblemRequest. + * Use `create(CreateProblemRequestSchema)` to create a new message. + */ +export const CreateProblemRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 5); + +/** + * @generated from message admin.v1.CreateProblemResponse + */ +export type CreateProblemResponse = Message<"admin.v1.CreateProblemResponse"> & { + /** + * @generated from field: admin.v1.Problem problem = 1; + */ + problem?: Problem; +}; + +/** + * Describes the message admin.v1.CreateProblemResponse. + * Use `create(CreateProblemResponseSchema)` to create a new message. + */ +export const CreateProblemResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 6); + +/** + * @generated from message admin.v1.DeleteProblemRequest + */ +export type DeleteProblemRequest = Message<"admin.v1.DeleteProblemRequest"> & { + /** + * @generated from field: string code = 1; + */ + code: string; +}; + +/** + * Describes the message admin.v1.DeleteProblemRequest. + * Use `create(DeleteProblemRequestSchema)` to create a new message. + */ +export const DeleteProblemRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 7); + +/** + * @generated from message admin.v1.DeleteProblemResponse + */ +export type DeleteProblemResponse = Message<"admin.v1.DeleteProblemResponse"> & { +}; + +/** + * Describes the message admin.v1.DeleteProblemResponse. + * Use `create(DeleteProblemResponseSchema)` to create a new message. + */ +export const DeleteProblemResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_admin_v1_problem, 8); + +/** + * @generated from service admin.v1.ProblemService + */ +export const ProblemService: GenService<{ + /** + * @generated from rpc admin.v1.ProblemService.ListProblems + */ + listProblems: { + methodKind: "unary"; + input: typeof ListProblemsRequestSchema; + output: typeof ListProblemsResponseSchema; + }, + /** + * @generated from rpc admin.v1.ProblemService.GetProblem + */ + getProblem: { + methodKind: "unary"; + input: typeof GetProblemRequestSchema; + output: typeof GetProblemResponseSchema; + }, + /** + * @generated from rpc admin.v1.ProblemService.CreateProblem + */ + createProblem: { + methodKind: "unary"; + input: typeof CreateProblemRequestSchema; + output: typeof CreateProblemResponseSchema; + }, + /** + * @generated from rpc admin.v1.ProblemService.DeleteProblem + */ + deleteProblem: { + methodKind: "unary"; + input: typeof DeleteProblemRequestSchema; + output: typeof DeleteProblemResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_admin_v1_problem, 0); + diff --git a/proto/admin/v1/problem.proto b/proto/admin/v1/problem.proto new file mode 100644 index 00000000..a8fdcdae --- /dev/null +++ b/proto/admin/v1/problem.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package admin.v1; + +import "buf/validate/validate.proto"; + +option go_package = "github.com/ictsc/ictsc-regalia/backend/pkg/proto/admin/v1;adminv1"; + +message Problem { + // 問題コード + string code = 1 [(buf.validate.field).string.min_len = 1]; + // タイトル + string title = 2; + // 最大得点 + int64 max_score = 4; + + // VM などのホストを使う問題 + // optional HostInfo host = 5; + + // ProblemBody body = 6; +} + +/* + TODO: 問題の細かい情報を決める + 再展開を考える上では不要 + + message HostInfo { + // TODO + } + + message ProblemBody { + ProblemType type = 1; + oneof body { + DescriptiveProblem descriptive = 2; + } + } + + enum ProblemType { + PROBLEM_TYPE_UNSPECIFIED = 0; + PROBLEM_TYPE_DESCRIPTIVE = 1; + } + + message DescriptiveProblem { + // TODO + } +*/ + +message ListProblemsRequest {} +message ListProblemsResponse { + repeated Problem problems = 1; +} + +message GetProblemRequest { + string code = 1; +} +message GetProblemResponse { + Problem problem = 1; +} + +message CreateProblemRequest { + Problem problem = 1; +} +message CreateProblemResponse { + Problem problem = 1; +} + +message DeleteProblemRequest { + string code = 1; +} +message DeleteProblemResponse {} + +service ProblemService { + rpc ListProblems(ListProblemsRequest) returns (ListProblemsResponse); + rpc GetProblem(GetProblemRequest) returns (GetProblemResponse); + rpc CreateProblem(CreateProblemRequest) returns (CreateProblemResponse); + rpc DeleteProblem(DeleteProblemRequest) returns (DeleteProblemResponse); +}