feat: complete quest service implementation

master
ALI Hamza 2021-12-23 10:09:24 +07:00
parent 321da1e6c5
commit d335d0ac45
Signed by: hamza
GPG Key ID: 22473A32291F8CB6
21 changed files with 423 additions and 828 deletions

@ -5,9 +5,11 @@ import (
"context" "context"
"errors" "errors"
"log" "log"
"time"
codequestpb "github.com/hhhapz/codequest/api/v1" codequestpb "github.com/hhhapz/codequest/api/v1"
"github.com/hhhapz/codequest/models" "github.com/hhhapz/codequest/models"
"github.com/hhhapz/codequest/question"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/emptypb"
@ -35,7 +37,7 @@ func (qs *QuestService) Questions(ctx context.Context, req *emptypb.Empty) (*cod
for _, q := range questions { for _, q := range questions {
res.Questions = append(res.Questions, &codequestpb.Question{ res.Questions = append(res.Questions, &codequestpb.Question{
ID: q.QuestionID, ID: q.Question.ID,
Title: q.Name, Title: q.Name,
Part1: &codequestpb.PartData{ Part1: &codequestpb.PartData{
Completed: q.Part1.Completed, Completed: q.Part1.Completed,
@ -70,7 +72,7 @@ func (qs *QuestService) QuestionByID(ctx context.Context, req *codequestpb.Quest
} }
q := &codequestpb.Question{ q := &codequestpb.Question{
ID: question.QuestionID, ID: question.Question.ID,
Title: question.Name, Title: question.Name,
Text: content.String(), Text: content.String(),
Part1: &codequestpb.PartData{ Part1: &codequestpb.PartData{
@ -87,9 +89,79 @@ func (qs *QuestService) QuestionByID(ctx context.Context, req *codequestpb.Quest
} }
func (qs *QuestService) QuestionInput(ctx context.Context, req *codequestpb.QuestionInputRequest) (*codequestpb.QuestionInput, error) { func (qs *QuestService) QuestionInput(ctx context.Context, req *codequestpb.QuestionInputRequest) (*codequestpb.QuestionInput, error) {
panic("not implemented") // TODO: Implement u := UserCtx(ctx)
question, err := qs.questStore.Question(ctx, u, req.ID)
if err != nil {
if errors.As(err, &models.UserError{}) {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
log.Printf("could not get question %s: %v", req.ID, err)
return nil, status.Errorf(codes.Internal, "could not get question: internal error")
}
inp := question.Question.Generate(u)
return &codequestpb.QuestionInput{
ID: question.Question.ID,
Input: inp,
}, nil
} }
func (qs *QuestService) Submit(ctx context.Context, req *codequestpb.SubmitRequest) (*codequestpb.SubmitResponse, error) { func (qs *QuestService) Submit(ctx context.Context, req *codequestpb.SubmitRequest) (*codequestpb.SubmitResponse, error) {
panic("not implemented") // TODO: Implement u := UserCtx(ctx)
q, err := qs.questStore.Question(ctx, u, req.ID)
if err != nil {
if errors.As(err, &models.UserError{}) {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
return nil, status.Errorf(codes.Internal, "could not get question: internal error")
}
data := req.Body
completed, attempts, err := qs.questStore.Submissions(ctx, u, req.ID, question.Part(data.Part))
if err != nil {
if errors.As(err, &models.UserError{}) {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
log.Printf("could not get submissions: %v", err)
return nil, status.Errorf(codes.Internal, "could not get submissions: internal error")
}
if completed {
return nil, status.Errorf(codes.AlreadyExists, "question %s (part %d) already completed", req.ID, data.Part)
}
// TODO: cooldowns
correct := q.Question.Validate(u, question.Part(data.Part), data.Answer)
var points int
if correct {
points = 5000 - (attempts * 100)
if points < 2000 {
points = 2000
}
}
qa := &models.QuestionAttempt{
UserID: u.ID,
QuestionID: q.Question.ID,
QuestionPart: int(data.Part),
Correct: correct,
PointsAwarded: points,
Answer: data.Answer,
Code: data.Code,
SubmittedAt: models.NewTime(time.Now()),
}
qs.questStore.AddSubmission(ctx, qa)
res := &codequestpb.SubmitResponse{
Correct: qa.Correct,
Points: int32(qa.PointsAwarded),
}
return res, nil
} }

@ -12,8 +12,5 @@
[generate openapiv2] [generate openapiv2]
out=./gen/json/{{ .Package }} out=./gen/json/{{ .Package }}
[generate ts] ; typescript
out=./gen/ts/{{ .Package }}
[generate grpc-gateway-ts] ; typescript [generate grpc-gateway-ts] ; typescript
out=./gen/ts-gateway/{{ .Package }} out=../../web_src/lib/pb

@ -697,19 +697,18 @@ func (x *QuestionInput) GetInput() string {
return "" return ""
} }
type SubmitRequest struct { type SubmitRequestData struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ID string `protobuf:"bytes,1,opt,name=ID,json=id,proto3" json:"id,omitempty"` Answer string `protobuf:"bytes,2,opt,name=Answer,json=answer,proto3" json:"answer,omitempty"`
Answer string `protobuf:"bytes,2,opt,name=Answer,json=content,proto3" json:"content,omitempty"` Part int32 `protobuf:"varint,3,opt,name=Part,json=part,proto3" json:"part,omitempty"`
Part bool `protobuf:"varint,3,opt,name=Part,json=part,proto3" json:"part,omitempty"`
Code string `protobuf:"bytes,4,opt,name=Code,json=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,4,opt,name=Code,json=code,proto3" json:"code,omitempty"`
} }
func (x *SubmitRequest) Reset() { func (x *SubmitRequestData) Reset() {
*x = SubmitRequest{} *x = SubmitRequestData{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[12] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -717,13 +716,13 @@ func (x *SubmitRequest) Reset() {
} }
} }
func (x *SubmitRequest) String() string { func (x *SubmitRequestData) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*SubmitRequest) ProtoMessage() {} func (*SubmitRequestData) ProtoMessage() {}
func (x *SubmitRequest) ProtoReflect() protoreflect.Message { func (x *SubmitRequestData) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[12] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -735,53 +734,43 @@ func (x *SubmitRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use SubmitRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SubmitRequestData.ProtoReflect.Descriptor instead.
func (*SubmitRequest) Descriptor() ([]byte, []int) { func (*SubmitRequestData) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{12} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{12}
} }
func (x *SubmitRequest) GetID() string { func (x *SubmitRequestData) GetAnswer() string {
if x != nil {
return x.ID
}
return ""
}
func (x *SubmitRequest) GetAnswer() string {
if x != nil { if x != nil {
return x.Answer return x.Answer
} }
return "" return ""
} }
func (x *SubmitRequest) GetPart() bool { func (x *SubmitRequestData) GetPart() int32 {
if x != nil { if x != nil {
return x.Part return x.Part
} }
return false return 0
} }
func (x *SubmitRequest) GetCode() string { func (x *SubmitRequestData) GetCode() string {
if x != nil { if x != nil {
return x.Code return x.Code
} }
return "" return ""
} }
type SubmitResponse struct { type SubmitRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ID string `protobuf:"bytes,1,opt,name=ID,json=id,proto3" json:"id,omitempty"` ID string `protobuf:"bytes,1,opt,name=ID,json=id,proto3" json:"id,omitempty"`
Part int32 `protobuf:"varint,2,opt,name=Part,json=part,proto3" json:"part,omitempty"` Body *SubmitRequestData `protobuf:"bytes,2,opt,name=Body,json=body,proto3" json:"body,omitempty"`
Correct bool `protobuf:"varint,3,opt,name=Correct,json=correct,proto3" json:"correct,omitempty"`
Ranking int32 `protobuf:"varint,4,opt,name=Ranking,json=ranking,proto3" json:"ranking,omitempty"`
Points int32 `protobuf:"varint,5,opt,name=Points,json=points,proto3" json:"points,omitempty"`
} }
func (x *SubmitResponse) Reset() { func (x *SubmitRequest) Reset() {
*x = SubmitResponse{} *x = SubmitRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[13] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -789,13 +778,13 @@ func (x *SubmitResponse) Reset() {
} }
} }
func (x *SubmitResponse) String() string { func (x *SubmitRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*SubmitResponse) ProtoMessage() {} func (*SubmitRequest) ProtoMessage() {}
func (x *SubmitResponse) ProtoReflect() protoreflect.Message { func (x *SubmitRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[13] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -807,37 +796,71 @@ func (x *SubmitResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use SubmitResponse.ProtoReflect.Descriptor instead. // Deprecated: Use SubmitRequest.ProtoReflect.Descriptor instead.
func (*SubmitResponse) Descriptor() ([]byte, []int) { func (*SubmitRequest) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{13} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{13}
} }
func (x *SubmitResponse) GetID() string { func (x *SubmitRequest) GetID() string {
if x != nil { if x != nil {
return x.ID return x.ID
} }
return "" return ""
} }
func (x *SubmitResponse) GetPart() int32 { func (x *SubmitRequest) GetBody() *SubmitRequestData {
if x != nil { if x != nil {
return x.Part return x.Body
} }
return 0 return nil
} }
func (x *SubmitResponse) GetCorrect() bool { type SubmitResponse struct {
if x != nil { state protoimpl.MessageState
return x.Correct sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Correct bool `protobuf:"varint,3,opt,name=Correct,json=correct,proto3" json:"correct,omitempty"`
Points int32 `protobuf:"varint,5,opt,name=Points,json=points,proto3" json:"points,omitempty"`
}
func (x *SubmitResponse) Reset() {
*x = SubmitResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
} }
return false
} }
func (x *SubmitResponse) GetRanking() int32 { func (x *SubmitResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SubmitResponse) ProtoMessage() {}
func (x *SubmitResponse) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SubmitResponse.ProtoReflect.Descriptor instead.
func (*SubmitResponse) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{14}
}
func (x *SubmitResponse) GetCorrect() bool {
if x != nil { if x != nil {
return x.Ranking return x.Correct
} }
return 0 return false
} }
func (x *SubmitResponse) GetPoints() int32 { func (x *SubmitResponse) GetPoints() int32 {
@ -860,7 +883,7 @@ type UpdateFields struct {
func (x *UpdateFields) Reset() { func (x *UpdateFields) Reset() {
*x = UpdateFields{} *x = UpdateFields{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[14] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -873,7 +896,7 @@ func (x *UpdateFields) String() string {
func (*UpdateFields) ProtoMessage() {} func (*UpdateFields) ProtoMessage() {}
func (x *UpdateFields) ProtoReflect() protoreflect.Message { func (x *UpdateFields) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[14] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -886,7 +909,7 @@ func (x *UpdateFields) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateFields.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateFields.ProtoReflect.Descriptor instead.
func (*UpdateFields) Descriptor() ([]byte, []int) { func (*UpdateFields) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{14} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{15}
} }
func (x *UpdateFields) GetName() string { func (x *UpdateFields) GetName() string {
@ -919,7 +942,7 @@ type UserRequest struct {
func (x *UserRequest) Reset() { func (x *UserRequest) Reset() {
*x = UserRequest{} *x = UserRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[15] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -932,7 +955,7 @@ func (x *UserRequest) String() string {
func (*UserRequest) ProtoMessage() {} func (*UserRequest) ProtoMessage() {}
func (x *UserRequest) ProtoReflect() protoreflect.Message { func (x *UserRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[15] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -945,7 +968,7 @@ func (x *UserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserRequest.ProtoReflect.Descriptor instead. // Deprecated: Use UserRequest.ProtoReflect.Descriptor instead.
func (*UserRequest) Descriptor() ([]byte, []int) { func (*UserRequest) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{15} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{16}
} }
type AllUsersRequest struct { type AllUsersRequest struct {
@ -957,7 +980,7 @@ type AllUsersRequest struct {
func (x *AllUsersRequest) Reset() { func (x *AllUsersRequest) Reset() {
*x = AllUsersRequest{} *x = AllUsersRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[16] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -970,7 +993,7 @@ func (x *AllUsersRequest) String() string {
func (*AllUsersRequest) ProtoMessage() {} func (*AllUsersRequest) ProtoMessage() {}
func (x *AllUsersRequest) ProtoReflect() protoreflect.Message { func (x *AllUsersRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[16] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -983,7 +1006,7 @@ func (x *AllUsersRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use AllUsersRequest.ProtoReflect.Descriptor instead. // Deprecated: Use AllUsersRequest.ProtoReflect.Descriptor instead.
func (*AllUsersRequest) Descriptor() ([]byte, []int) { func (*AllUsersRequest) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{16} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{17}
} }
type UpdateUserRequest struct { type UpdateUserRequest struct {
@ -998,7 +1021,7 @@ type UpdateUserRequest struct {
func (x *UpdateUserRequest) Reset() { func (x *UpdateUserRequest) Reset() {
*x = UpdateUserRequest{} *x = UpdateUserRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[17] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1011,7 +1034,7 @@ func (x *UpdateUserRequest) String() string {
func (*UpdateUserRequest) ProtoMessage() {} func (*UpdateUserRequest) ProtoMessage() {}
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[17] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1024,7 +1047,7 @@ func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) Descriptor() ([]byte, []int) { func (*UpdateUserRequest) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{17} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{18}
} }
func (x *UpdateUserRequest) GetEmail() string { func (x *UpdateUserRequest) GetEmail() string {
@ -1052,7 +1075,7 @@ type UserByEmailRequest struct {
func (x *UserByEmailRequest) Reset() { func (x *UserByEmailRequest) Reset() {
*x = UserByEmailRequest{} *x = UserByEmailRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[18] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1065,7 +1088,7 @@ func (x *UserByEmailRequest) String() string {
func (*UserByEmailRequest) ProtoMessage() {} func (*UserByEmailRequest) ProtoMessage() {}
func (x *UserByEmailRequest) ProtoReflect() protoreflect.Message { func (x *UserByEmailRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[18] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1078,7 +1101,7 @@ func (x *UserByEmailRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserByEmailRequest.ProtoReflect.Descriptor instead. // Deprecated: Use UserByEmailRequest.ProtoReflect.Descriptor instead.
func (*UserByEmailRequest) Descriptor() ([]byte, []int) { func (*UserByEmailRequest) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{18} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{19}
} }
func (x *UserByEmailRequest) GetEmail() string { func (x *UserByEmailRequest) GetEmail() string {
@ -1099,7 +1122,7 @@ type DeleteUserRequest struct {
func (x *DeleteUserRequest) Reset() { func (x *DeleteUserRequest) Reset() {
*x = DeleteUserRequest{} *x = DeleteUserRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[19] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1112,7 +1135,7 @@ func (x *DeleteUserRequest) String() string {
func (*DeleteUserRequest) ProtoMessage() {} func (*DeleteUserRequest) ProtoMessage() {}
func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[19] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1125,7 +1148,7 @@ func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserRequest) Descriptor() ([]byte, []int) { func (*DeleteUserRequest) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{19} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{20}
} }
func (x *DeleteUserRequest) GetEmail() string { func (x *DeleteUserRequest) GetEmail() string {
@ -1146,7 +1169,7 @@ type AllUsersResponse struct {
func (x *AllUsersResponse) Reset() { func (x *AllUsersResponse) Reset() {
*x = AllUsersResponse{} *x = AllUsersResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[20] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1159,7 +1182,7 @@ func (x *AllUsersResponse) String() string {
func (*AllUsersResponse) ProtoMessage() {} func (*AllUsersResponse) ProtoMessage() {}
func (x *AllUsersResponse) ProtoReflect() protoreflect.Message { func (x *AllUsersResponse) ProtoReflect() protoreflect.Message {
mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[20] mi := &file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1172,7 +1195,7 @@ func (x *AllUsersResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use AllUsersResponse.ProtoReflect.Descriptor instead. // Deprecated: Use AllUsersResponse.ProtoReflect.Descriptor instead.
func (*AllUsersResponse) Descriptor() ([]byte, []int) { func (*AllUsersResponse) Descriptor() ([]byte, []int) {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{20} return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP(), []int{21}
} }
func (x *AllUsersResponse) GetUsers() []*User { func (x *AllUsersResponse) GetUsers() []*User {
@ -1279,26 +1302,26 @@ var file_github_com_hhhapz_codequest_api_v1_all_proto_rawDesc = []byte{
0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x05, 0x49, 0x6e, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x05, 0x49, 0x6e,
0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28,
0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x3a, 0x06, 0x08, 0x00, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x3a, 0x06, 0x08, 0x00,
0x10, 0x00, 0x18, 0x00, 0x22, 0x98, 0x01, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x10, 0x00, 0x18, 0x00, 0x22, 0x7f, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x06, 0x41, 0x6e, 0x73,
0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28,
0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x0a,
0x04, 0x50, 0x61, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0x08, 0x00, 0x18,
0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x04, 0x70, 0x61, 0x72, 0x74, 0x12, 0x1e, 0x0a,
0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18,
0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x06, 0x08,
0x00, 0x10, 0x00, 0x18, 0x00, 0x22, 0x7b, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x02, 0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x02,
0x69, 0x64, 0x12, 0x23, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x69, 0x64, 0x12, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x07, 0x32, 0x26, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75,
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x04, 0x50, 0x61, 0x72, 0x74, 0x18, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00,
0x30, 0x00, 0x50, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x3a, 0x06, 0x08, 0x00, 0x10, 0x00,
0x18, 0x00, 0x22, 0x62, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50,
0x00, 0x52, 0x04, 0x70, 0x61, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x00, 0x52, 0x07, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x50, 0x6f,
0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50,
0x00, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x06, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x22,
0xc4, 0x01, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a,
0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e,
0x0a, 0x04, 0x50, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0x08, 0x00,
0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x04, 0x70, 0x61, 0x72, 0x74, 0x12, 0x24,
0x0a, 0x07, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42,
0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x07, 0x63, 0x6f, 0x72,
0x72, 0x65, 0x63, 0x74, 0x12, 0x24, 0x0a, 0x07, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x18,
0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x30, 0x00, 0x50,
0x00, 0x52, 0x07, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a, 0x06, 0x50, 0x6f,
0x69, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0x08, 0x00, 0x18, 0x00,
0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x3a, 0x06, 0x28, 0x00, 0x30, 0x00, 0x50, 0x00, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x3a, 0x06,
0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74,
@ -1357,7 +1380,7 @@ var file_github_com_hhhapz_codequest_api_v1_all_proto_rawDesc = []byte{
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
0x6d, 0x70, 0x74, 0x79, 0x22, 0x1c, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1c, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x10, 0x2a, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x02, 0x10, 0x2a, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f, 0x6b,
0x65, 0x6e, 0x28, 0x00, 0x1a, 0x03, 0x88, 0x02, 0x00, 0x32, 0x84, 0x04, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x6e, 0x28, 0x00, 0x1a, 0x03, 0x88, 0x02, 0x00, 0x32, 0x8a, 0x04, 0x0a, 0x0c, 0x51, 0x75,
0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6a, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6a, 0x0a, 0x09, 0x51, 0x75,
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a,
@ -1382,66 +1405,67 @@ var file_github_com_hhhapz_codequest_api_v1_all_proto_rawDesc = []byte{
0x6e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x22, 0x26, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0x6e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x22, 0x26, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x49, 0x44, 0x7d, 0x2f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x28, 0x00, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x49, 0x44, 0x7d, 0x2f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x28, 0x00,
0x30, 0x00, 0x12, 0x77, 0x0a, 0x06, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x12, 0x22, 0x2e, 0x68, 0x30, 0x00, 0x12, 0x7d, 0x0a, 0x06, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x12, 0x22, 0x2e, 0x68,
0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e,
0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x23, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x1a, 0x23, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x14, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x93, 0x02, 0x1a, 0x3a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x71,
0x6e, 0x73, 0x2f, 0x7b, 0x49, 0x44, 0x7d, 0x28, 0x00, 0x30, 0x00, 0x1a, 0x03, 0x88, 0x02, 0x00, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x49, 0x44, 0x7d, 0x28, 0x00, 0x30,
0x32, 0xec, 0x05, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x00, 0x1a, 0x03, 0x88, 0x02, 0x00, 0x32, 0xec, 0x05, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53,
0x12, 0x63, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x20,
0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73,
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1a, 0x88, 0x02, 0x00,
0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x75,
0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x28, 0x00, 0x30, 0x00, 0x12, 0x7c, 0x0a, 0x0b, 0x55,
0x73, 0x65, 0x72, 0x42, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x27, 0x2e, 0x68, 0x68, 0x68,
0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1a, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75,
0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64,
0x65, 0x28, 0x00, 0x30, 0x00, 0x12, 0x7c, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x45, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x25,
0x6d, 0x61, 0x69, 0x6c, 0x12, 0x27, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x76,
0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x45,
0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x61, 0x69, 0x6c, 0x7d, 0x28, 0x00, 0x30, 0x00, 0x12, 0x7a, 0x0a, 0x08, 0x41, 0x6c, 0x6c,
0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x24, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63,
0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x25, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69,
0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x7d, 0x28,
0x00, 0x30, 0x00, 0x12, 0x7a, 0x0a, 0x08, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12,
0x24, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63,
0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x55, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x55,
0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x88, 0x02, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x68, 0x68,
0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76,
0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x28, 0x00, 0x30, 0x00, 0x12, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x75, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x73, 0x65, 0x22, 0x1d, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11,
0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72,
0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x28, 0x00, 0x30, 0x00, 0x12, 0x75, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x73, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64,
0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x22, 0x20, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68,
0x42, 0x6f, 0x64, 0x79, 0x1a, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76,
0x6d, 0x65, 0x28, 0x00, 0x30, 0x00, 0x12, 0x85, 0x01, 0x0a, 0x0f, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x20, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x68, 0x68, 0x68, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x0c, 0x2f, 0x76, 0x31, 0x2f,
0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x28, 0x00, 0x30, 0x00, 0x12, 0x85, 0x01, 0x0a,
0x0f, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,
0x12, 0x26, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70,
0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x22, 0x2b, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x1f, 0x3a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d,
0x69, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x7d,
0x28, 0x00, 0x30, 0x00, 0x12, 0x7a, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73,
0x65, 0x72, 0x12, 0x26, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55,
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68,
0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x25, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4,
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x75,
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x2b, 0x88, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x7d, 0x28, 0x00, 0x30, 0x00,
0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04, 0x42, 0x6f, 0x64, 0x1a, 0x03, 0x88, 0x02, 0x00, 0x42, 0x47, 0x48, 0x01, 0x50, 0x00, 0x5a, 0x2c, 0x67, 0x69, 0x74,
0x79, 0x1a, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2f, 0x63,
0x72, 0x73, 0x2f, 0x7b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x7d, 0x28, 0x00, 0x30, 0x00, 0x12, 0x7a, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b,
0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x68, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x80, 0x01, 0x00, 0x88, 0x01, 0x00, 0x90,
0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x01, 0x00, 0xb8, 0x01, 0x00, 0xd8, 0x01, 0x00, 0xf8, 0x01, 0x01, 0xd0, 0x02, 0x00, 0x62, 0x06,
0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2e, 0x63, 0x6f,
0x64, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22,
0x25, 0x88, 0x02, 0x00, 0x90, 0x02, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f,
0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b,
0x45, 0x6d, 0x61, 0x69, 0x6c, 0x7d, 0x28, 0x00, 0x30, 0x00, 0x1a, 0x03, 0x88, 0x02, 0x00, 0x42,
0x47, 0x48, 0x01, 0x50, 0x00, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x68, 0x68, 0x68, 0x61, 0x70, 0x7a, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x64, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x80, 0x01, 0x00, 0x88, 0x01, 0x00, 0x90, 0x01, 0x00, 0xb8, 0x01, 0x00, 0xd8,
0x01, 0x00, 0xf8, 0x01, 0x01, 0xd0, 0x02, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1456,7 +1480,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescGZIP() []byte {
return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescData return file_github_com_hhhapz_codequest_api_v1_all_proto_rawDescData
} }
var file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_github_com_hhhapz_codequest_api_v1_all_proto_goTypes = []interface{}{ var file_github_com_hhhapz_codequest_api_v1_all_proto_goTypes = []interface{}{
(*Token)(nil), // 0: hhhapz.codequest.v1.Token (*Token)(nil), // 0: hhhapz.codequest.v1.Token
(*OAuthCodeRequest)(nil), // 1: hhhapz.codequest.v1.OAuthCodeRequest (*OAuthCodeRequest)(nil), // 1: hhhapz.codequest.v1.OAuthCodeRequest
@ -1470,58 +1494,60 @@ var file_github_com_hhhapz_codequest_api_v1_all_proto_goTypes = []interface{}{
(*QuestionByIDRequest)(nil), // 9: hhhapz.codequest.v1.QuestionByIDRequest (*QuestionByIDRequest)(nil), // 9: hhhapz.codequest.v1.QuestionByIDRequest
(*QuestionInputRequest)(nil), // 10: hhhapz.codequest.v1.QuestionInputRequest (*QuestionInputRequest)(nil), // 10: hhhapz.codequest.v1.QuestionInputRequest
(*QuestionInput)(nil), // 11: hhhapz.codequest.v1.QuestionInput (*QuestionInput)(nil), // 11: hhhapz.codequest.v1.QuestionInput
(*SubmitRequest)(nil), // 12: hhhapz.codequest.v1.SubmitRequest (*SubmitRequestData)(nil), // 12: hhhapz.codequest.v1.SubmitRequestData
(*SubmitResponse)(nil), // 13: hhhapz.codequest.v1.SubmitResponse (*SubmitRequest)(nil), // 13: hhhapz.codequest.v1.SubmitRequest
(*UpdateFields)(nil), // 14: hhhapz.codequest.v1.UpdateFields (*SubmitResponse)(nil), // 14: hhhapz.codequest.v1.SubmitResponse
(*UserRequest)(nil), // 15: hhhapz.codequest.v1.UserRequest (*UpdateFields)(nil), // 15: hhhapz.codequest.v1.UpdateFields
(*AllUsersRequest)(nil), // 16: hhhapz.codequest.v1.AllUsersRequest (*UserRequest)(nil), // 16: hhhapz.codequest.v1.UserRequest
(*UpdateUserRequest)(nil), // 17: hhhapz.codequest.v1.UpdateUserRequest (*AllUsersRequest)(nil), // 17: hhhapz.codequest.v1.AllUsersRequest
(*UserByEmailRequest)(nil), // 18: hhhapz.codequest.v1.UserByEmailRequest (*UpdateUserRequest)(nil), // 18: hhhapz.codequest.v1.UpdateUserRequest
(*DeleteUserRequest)(nil), // 19: hhhapz.codequest.v1.DeleteUserRequest (*UserByEmailRequest)(nil), // 19: hhhapz.codequest.v1.UserByEmailRequest
(*AllUsersResponse)(nil), // 20: hhhapz.codequest.v1.AllUsersResponse (*DeleteUserRequest)(nil), // 20: hhhapz.codequest.v1.DeleteUserRequest
(*timestamppb.Timestamp)(nil), // 21: google.protobuf.Timestamp (*AllUsersResponse)(nil), // 21: hhhapz.codequest.v1.AllUsersResponse
(*emptypb.Empty)(nil), // 22: google.protobuf.Empty (*timestamppb.Timestamp)(nil), // 22: google.protobuf.Timestamp
(*emptypb.Empty)(nil), // 23: google.protobuf.Empty
} }
var file_github_com_hhhapz_codequest_api_v1_all_proto_depIdxs = []int32{ var file_github_com_hhhapz_codequest_api_v1_all_proto_depIdxs = []int32{
21, // 0: hhhapz.codequest.v1.Token.Expires:type_name -> google.protobuf.Timestamp 22, // 0: hhhapz.codequest.v1.Token.Expires:type_name -> google.protobuf.Timestamp
0, // 1: hhhapz.codequest.v1.DeleteTokenRequest.Token:type_name -> hhhapz.codequest.v1.Token 0, // 1: hhhapz.codequest.v1.DeleteTokenRequest.Token:type_name -> hhhapz.codequest.v1.Token
21, // 2: hhhapz.codequest.v1.User.CreatedAt:type_name -> google.protobuf.Timestamp 22, // 2: hhhapz.codequest.v1.User.CreatedAt:type_name -> google.protobuf.Timestamp
6, // 3: hhhapz.codequest.v1.Question.Part1:type_name -> hhhapz.codequest.v1.PartData 6, // 3: hhhapz.codequest.v1.Question.Part1:type_name -> hhhapz.codequest.v1.PartData
6, // 4: hhhapz.codequest.v1.Question.Part2:type_name -> hhhapz.codequest.v1.PartData 6, // 4: hhhapz.codequest.v1.Question.Part2:type_name -> hhhapz.codequest.v1.PartData
7, // 5: hhhapz.codequest.v1.QuestionsResponse.Questions:type_name -> hhhapz.codequest.v1.Question 7, // 5: hhhapz.codequest.v1.QuestionsResponse.Questions:type_name -> hhhapz.codequest.v1.Question
14, // 6: hhhapz.codequest.v1.UpdateUserRequest.Body:type_name -> hhhapz.codequest.v1.UpdateFields 12, // 6: hhhapz.codequest.v1.SubmitRequest.Body:type_name -> hhhapz.codequest.v1.SubmitRequestData
5, // 7: hhhapz.codequest.v1.AllUsersResponse.Users:type_name -> hhhapz.codequest.v1.User 15, // 7: hhhapz.codequest.v1.UpdateUserRequest.Body:type_name -> hhhapz.codequest.v1.UpdateFields
1, // 8: hhhapz.codequest.v1.AuthService.OAuthCode:input_type -> hhhapz.codequest.v1.OAuthCodeRequest 5, // 8: hhhapz.codequest.v1.AllUsersResponse.Users:type_name -> hhhapz.codequest.v1.User
3, // 9: hhhapz.codequest.v1.AuthService.Token:input_type -> hhhapz.codequest.v1.TokenRequest 1, // 9: hhhapz.codequest.v1.AuthService.OAuthCode:input_type -> hhhapz.codequest.v1.OAuthCodeRequest
4, // 10: hhhapz.codequest.v1.AuthService.DeleteToken:input_type -> hhhapz.codequest.v1.DeleteTokenRequest 3, // 10: hhhapz.codequest.v1.AuthService.Token:input_type -> hhhapz.codequest.v1.TokenRequest
22, // 11: hhhapz.codequest.v1.QuestService.Questions:input_type -> google.protobuf.Empty 4, // 11: hhhapz.codequest.v1.AuthService.DeleteToken:input_type -> hhhapz.codequest.v1.DeleteTokenRequest
9, // 12: hhhapz.codequest.v1.QuestService.QuestionByID:input_type -> hhhapz.codequest.v1.QuestionByIDRequest 23, // 12: hhhapz.codequest.v1.QuestService.Questions:input_type -> google.protobuf.Empty
10, // 13: hhhapz.codequest.v1.QuestService.QuestionInput:input_type -> hhhapz.codequest.v1.QuestionInputRequest 9, // 13: hhhapz.codequest.v1.QuestService.QuestionByID:input_type -> hhhapz.codequest.v1.QuestionByIDRequest
12, // 14: hhhapz.codequest.v1.QuestService.Submit:input_type -> hhhapz.codequest.v1.SubmitRequest 10, // 14: hhhapz.codequest.v1.QuestService.QuestionInput:input_type -> hhhapz.codequest.v1.QuestionInputRequest
15, // 15: hhhapz.codequest.v1.UserService.User:input_type -> hhhapz.codequest.v1.UserRequest 13, // 15: hhhapz.codequest.v1.QuestService.Submit:input_type -> hhhapz.codequest.v1.SubmitRequest
18, // 16: hhhapz.codequest.v1.UserService.UserByEmail:input_type -> hhhapz.codequest.v1.UserByEmailRequest 16, // 16: hhhapz.codequest.v1.UserService.User:input_type -> hhhapz.codequest.v1.UserRequest
16, // 17: hhhapz.codequest.v1.UserService.AllUsers:input_type -> hhhapz.codequest.v1.AllUsersRequest 19, // 17: hhhapz.codequest.v1.UserService.UserByEmail:input_type -> hhhapz.codequest.v1.UserByEmailRequest
17, // 18: hhhapz.codequest.v1.UserService.UpdateUser:input_type -> hhhapz.codequest.v1.UpdateUserRequest 17, // 18: hhhapz.codequest.v1.UserService.AllUsers:input_type -> hhhapz.codequest.v1.AllUsersRequest
17, // 19: hhhapz.codequest.v1.UserService.AdminUpdateUser:input_type -> hhhapz.codequest.v1.UpdateUserRequest 18, // 19: hhhapz.codequest.v1.UserService.UpdateUser:input_type -> hhhapz.codequest.v1.UpdateUserRequest
19, // 20: hhhapz.codequest.v1.UserService.DeleteUser:input_type -> hhhapz.codequest.v1.DeleteUserRequest 18, // 20: hhhapz.codequest.v1.UserService.AdminUpdateUser:input_type -> hhhapz.codequest.v1.UpdateUserRequest
2, // 21: hhhapz.codequest.v1.AuthService.OAuthCode:output_type -> hhhapz.codequest.v1.OAuthCodeResponse 20, // 21: hhhapz.codequest.v1.UserService.DeleteUser:input_type -> hhhapz.codequest.v1.DeleteUserRequest
0, // 22: hhhapz.codequest.v1.AuthService.Token:output_type -> hhhapz.codequest.v1.Token 2, // 22: hhhapz.codequest.v1.AuthService.OAuthCode:output_type -> hhhapz.codequest.v1.OAuthCodeResponse
22, // 23: hhhapz.codequest.v1.AuthService.DeleteToken:output_type -> google.protobuf.Empty 0, // 23: hhhapz.codequest.v1.AuthService.Token:output_type -> hhhapz.codequest.v1.Token
8, // 24: hhhapz.codequest.v1.QuestService.Questions:output_type -> hhhapz.codequest.v1.QuestionsResponse 23, // 24: hhhapz.codequest.v1.AuthService.DeleteToken:output_type -> google.protobuf.Empty
7, // 25: hhhapz.codequest.v1.QuestService.QuestionByID:output_type -> hhhapz.codequest.v1.Question 8, // 25: hhhapz.codequest.v1.QuestService.Questions:output_type -> hhhapz.codequest.v1.QuestionsResponse
11, // 26: hhhapz.codequest.v1.QuestService.QuestionInput:output_type -> hhhapz.codequest.v1.QuestionInput 7, // 26: hhhapz.codequest.v1.QuestService.QuestionByID:output_type -> hhhapz.codequest.v1.Question
13, // 27: hhhapz.codequest.v1.QuestService.Submit:output_type -> hhhapz.codequest.v1.SubmitResponse 11, // 27: hhhapz.codequest.v1.QuestService.QuestionInput:output_type -> hhhapz.codequest.v1.QuestionInput
5, // 28: hhhapz.codequest.v1.UserService.User:output_type -> hhhapz.codequest.v1.User 14, // 28: hhhapz.codequest.v1.QuestService.Submit:output_type -> hhhapz.codequest.v1.SubmitResponse
5, // 29: hhhapz.codequest.v1.UserService.UserByEmail:output_type -> hhhapz.codequest.v1.User 5, // 29: hhhapz.codequest.v1.UserService.User:output_type -> hhhapz.codequest.v1.User
20, // 30: hhhapz.codequest.v1.UserService.AllUsers:output_type -> hhhapz.codequest.v1.AllUsersResponse 5, // 30: hhhapz.codequest.v1.UserService.UserByEmail:output_type -> hhhapz.codequest.v1.User
5, // 31: hhhapz.codequest.v1.UserService.UpdateUser:output_type -> hhhapz.codequest.v1.User 21, // 31: hhhapz.codequest.v1.UserService.AllUsers:output_type -> hhhapz.codequest.v1.AllUsersResponse
5, // 32: hhhapz.codequest.v1.UserService.AdminUpdateUser:output_type -> hhhapz.codequest.v1.User 5, // 32: hhhapz.codequest.v1.UserService.UpdateUser:output_type -> hhhapz.codequest.v1.User
5, // 33: hhhapz.codequest.v1.UserService.DeleteUser:output_type -> hhhapz.codequest.v1.User 5, // 33: hhhapz.codequest.v1.UserService.AdminUpdateUser:output_type -> hhhapz.codequest.v1.User
21, // [21:34] is the sub-list for method output_type 5, // 34: hhhapz.codequest.v1.UserService.DeleteUser:output_type -> hhhapz.codequest.v1.User
8, // [8:21] is the sub-list for method input_type 22, // [22:35] is the sub-list for method output_type
8, // [8:8] is the sub-list for extension type_name 9, // [9:22] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension extendee 9, // [9:9] is the sub-list for extension type_name
0, // [0:8] is the sub-list for field type_name 9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
} }
func init() { file_github_com_hhhapz_codequest_api_v1_all_proto_init() } func init() { file_github_com_hhhapz_codequest_api_v1_all_proto_init() }
@ -1675,7 +1701,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubmitRequest); i { switch v := v.(*SubmitRequestData); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1687,7 +1713,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubmitResponse); i { switch v := v.(*SubmitRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1699,7 +1725,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateFields); i { switch v := v.(*SubmitResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1711,7 +1737,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRequest); i { switch v := v.(*UpdateFields); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1723,7 +1749,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllUsersRequest); i { switch v := v.(*UserRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1735,7 +1761,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateUserRequest); i { switch v := v.(*AllUsersRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1747,7 +1773,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserByEmailRequest); i { switch v := v.(*UpdateUserRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1759,7 +1785,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteUserRequest); i { switch v := v.(*UserByEmailRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1771,6 +1797,18 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
} }
} }
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteUserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_github_com_hhhapz_codequest_api_v1_all_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllUsersResponse); i { switch v := v.(*AllUsersResponse); i {
case 0: case 0:
return &v.state return &v.state
@ -1789,7 +1827,7 @@ func file_github_com_hhhapz_codequest_api_v1_all_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_github_com_hhhapz_codequest_api_v1_all_proto_rawDesc, RawDescriptor: file_github_com_hhhapz_codequest_api_v1_all_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 21, NumMessages: 22,
NumExtensions: 0, NumExtensions: 0,
NumServices: 3, NumServices: 3,
}, },

@ -244,14 +244,18 @@ func local_request_QuestService_QuestionInput_0(ctx context.Context, marshaler r
} }
var (
filter_QuestService_Submit_0 = &utilities.DoubleArray{Encoding: map[string]int{"ID": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_QuestService_Submit_0(ctx context.Context, marshaler runtime.Marshaler, client QuestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_QuestService_Submit_0(ctx context.Context, marshaler runtime.Marshaler, client QuestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SubmitRequest var protoReq SubmitRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var ( var (
val string val string
ok bool ok bool
@ -269,13 +273,6 @@ func request_QuestService_Submit_0(ctx context.Context, marshaler runtime.Marsha
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ID", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ID", err)
} }
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QuestService_Submit_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Submit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Submit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
@ -285,6 +282,14 @@ func local_request_QuestService_Submit_0(ctx context.Context, marshaler runtime.
var protoReq SubmitRequest var protoReq SubmitRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var ( var (
val string val string
ok bool ok bool
@ -302,13 +307,6 @@ func local_request_QuestService_Submit_0(ctx context.Context, marshaler runtime.
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ID", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ID", err)
} }
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QuestService_Submit_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Submit(ctx, &protoReq) msg, err := server.Submit(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err

@ -312,22 +312,12 @@
"type": "string" "type": "string"
}, },
{ {
"name": "content", "name": "body",
"in": "query", "in": "body",
"required": false, "required": true,
"type": "string" "schema": {
}, "$ref": "#/definitions/v1SubmitRequestData"
{ }
"name": "part",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "code",
"in": "query",
"required": false,
"type": "string"
} }
], ],
"tags": [ "tags": [
@ -525,23 +515,27 @@
} }
} }
}, },
"v1SubmitResponse": { "v1SubmitRequestData": {
"type": "object", "type": "object",
"properties": { "properties": {
"id": { "answer": {
"type": "string" "type": "string"
}, },
"part": { "part": {
"type": "integer", "type": "integer",
"format": "int32" "format": "int32"
}, },
"code": {
"type": "string"
}
}
},
"v1SubmitResponse": {
"type": "object",
"properties": {
"correct": { "correct": {
"type": "boolean" "type": "boolean"
}, },
"ranking": {
"type": "integer",
"format": "int32"
},
"points": { "points": {
"type": "integer", "type": "integer",
"format": "int32" "format": "int32"

@ -1,528 +0,0 @@
// package: hhhapz.codequest.v1
// file: github.com/hhhapz/codequest/api/v1/all.proto
import * as jspb from "google-protobuf";
import * as google_api_annotations_pb from "../../../../../google/api/annotations_pb";
import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
export class Token extends jspb.Message {
getToken(): string;
setToken(value: string): void;
hasExpires(): boolean;
clearExpires(): void;
getExpires(): google_protobuf_timestamp_pb.Timestamp | undefined;
setExpires(value?: google_protobuf_timestamp_pb.Timestamp): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Token.AsObject;
static toObject(includeInstance: boolean, msg: Token): Token.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Token, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Token;
static deserializeBinaryFromReader(message: Token, reader: jspb.BinaryReader): Token;
}
export namespace Token {
export type AsObject = {
token: string,
expires?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
export class OAuthCodeRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): OAuthCodeRequest.AsObject;
static toObject(includeInstance: boolean, msg: OAuthCodeRequest): OAuthCodeRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: OAuthCodeRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): OAuthCodeRequest;
static deserializeBinaryFromReader(message: OAuthCodeRequest, reader: jspb.BinaryReader): OAuthCodeRequest;
}
export namespace OAuthCodeRequest {
export type AsObject = {
}
}
export class OAuthCodeResponse extends jspb.Message {
getRedirecturi(): string;
setRedirecturi(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): OAuthCodeResponse.AsObject;
static toObject(includeInstance: boolean, msg: OAuthCodeResponse): OAuthCodeResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: OAuthCodeResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): OAuthCodeResponse;
static deserializeBinaryFromReader(message: OAuthCodeResponse, reader: jspb.BinaryReader): OAuthCodeResponse;
}
export namespace OAuthCodeResponse {
export type AsObject = {
redirecturi: string,
}
}
export class TokenRequest extends jspb.Message {
getCode(): string;
setCode(value: string): void;
getState(): string;
setState(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): TokenRequest.AsObject;
static toObject(includeInstance: boolean, msg: TokenRequest): TokenRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: TokenRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): TokenRequest;
static deserializeBinaryFromReader(message: TokenRequest, reader: jspb.BinaryReader): TokenRequest;
}
export namespace TokenRequest {
export type AsObject = {
code: string,
state: string,
}
}
export class DeleteTokenRequest extends jspb.Message {
getAll(): boolean;
setAll(value: boolean): void;
hasToken(): boolean;
clearToken(): void;
getToken(): Token | undefined;
setToken(value?: Token): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeleteTokenRequest.AsObject;
static toObject(includeInstance: boolean, msg: DeleteTokenRequest): DeleteTokenRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeleteTokenRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeleteTokenRequest;
static deserializeBinaryFromReader(message: DeleteTokenRequest, reader: jspb.BinaryReader): DeleteTokenRequest;
}
export namespace DeleteTokenRequest {
export type AsObject = {
all: boolean,
token?: Token.AsObject,
}
}
export class User extends jspb.Message {
getId(): string;
setId(value: string): void;
getName(): string;
setName(value: string): void;
getEmail(): string;
setEmail(value: string): void;
getPicture(): string;
setPicture(value: string): void;
getAdmin(): boolean;
setAdmin(value: boolean): void;
hasCreatedat(): boolean;
clearCreatedat(): void;
getCreatedat(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreatedat(value?: google_protobuf_timestamp_pb.Timestamp): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): User.AsObject;
static toObject(includeInstance: boolean, msg: User): User.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: User, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): User;
static deserializeBinaryFromReader(message: User, reader: jspb.BinaryReader): User;
}
export namespace User {
export type AsObject = {
id: string,
name: string,
email: string,
picture: string,
admin: boolean,
createdat?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
export class PartData extends jspb.Message {
getCompleted(): boolean;
setCompleted(value: boolean): void;
getPointsworth(): number;
setPointsworth(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PartData.AsObject;
static toObject(includeInstance: boolean, msg: PartData): PartData.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: PartData, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): PartData;
static deserializeBinaryFromReader(message: PartData, reader: jspb.BinaryReader): PartData;
}
export namespace PartData {
export type AsObject = {
completed: boolean,
pointsworth: number,
}
}
export class Question extends jspb.Message {
getId(): string;
setId(value: string): void;
getTitle(): string;
setTitle(value: string): void;
getText(): string;
setText(value: string): void;
hasPart1(): boolean;
clearPart1(): void;
getPart1(): PartData | undefined;
setPart1(value?: PartData): void;
hasPart2(): boolean;
clearPart2(): void;
getPart2(): PartData | undefined;
setPart2(value?: PartData): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Question.AsObject;
static toObject(includeInstance: boolean, msg: Question): Question.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Question, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Question;
static deserializeBinaryFromReader(message: Question, reader: jspb.BinaryReader): Question;
}
export namespace Question {
export type AsObject = {
id: string,
title: string,
text: string,
part1?: PartData.AsObject,
part2?: PartData.AsObject,
}
}
export class QuestionsResponse extends jspb.Message {
clearQuestionsList(): void;
getQuestionsList(): Array<Question>;
setQuestionsList(value: Array<Question>): void;
addQuestions(value?: Question, index?: number): Question;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuestionsResponse.AsObject;
static toObject(includeInstance: boolean, msg: QuestionsResponse): QuestionsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: QuestionsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): QuestionsResponse;
static deserializeBinaryFromReader(message: QuestionsResponse, reader: jspb.BinaryReader): QuestionsResponse;
}
export namespace QuestionsResponse {
export type AsObject = {
questionsList: Array<Question.AsObject>,
}
}
export class QuestionByIDRequest extends jspb.Message {
getId(): string;
setId(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuestionByIDRequest.AsObject;
static toObject(includeInstance: boolean, msg: QuestionByIDRequest): QuestionByIDRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: QuestionByIDRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): QuestionByIDRequest;
static deserializeBinaryFromReader(message: QuestionByIDRequest, reader: jspb.BinaryReader): QuestionByIDRequest;
}
export namespace QuestionByIDRequest {
export type AsObject = {
id: string,
}
}
export class QuestionInputRequest extends jspb.Message {
getId(): string;
setId(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuestionInputRequest.AsObject;
static toObject(includeInstance: boolean, msg: QuestionInputRequest): QuestionInputRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: QuestionInputRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): QuestionInputRequest;
static deserializeBinaryFromReader(message: QuestionInputRequest, reader: jspb.BinaryReader): QuestionInputRequest;
}
export namespace QuestionInputRequest {
export type AsObject = {
id: string,
}
}
export class QuestionInput extends jspb.Message {
getId(): string;
setId(value: string): void;
getInput(): string;
setInput(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuestionInput.AsObject;
static toObject(includeInstance: boolean, msg: QuestionInput): QuestionInput.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: QuestionInput, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): QuestionInput;
static deserializeBinaryFromReader(message: QuestionInput, reader: jspb.BinaryReader): QuestionInput;
}
export namespace QuestionInput {
export type AsObject = {
id: string,
input: string,
}
}
export class SubmitRequest extends jspb.Message {
getId(): string;
setId(value: string): void;
getAnswer(): string;
setAnswer(value: string): void;
getPart(): boolean;
setPart(value: boolean): void;
getCode(): string;
setCode(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): SubmitRequest.AsObject;
static toObject(includeInstance: boolean, msg: SubmitRequest): SubmitRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: SubmitRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): SubmitRequest;
static deserializeBinaryFromReader(message: SubmitRequest, reader: jspb.BinaryReader): SubmitRequest;
}
export namespace SubmitRequest {
export type AsObject = {
id: string,
answer: string,
part: boolean,
code: string,
}
}
export class SubmitResponse extends jspb.Message {
getId(): string;
setId(value: string): void;
getPart(): number;
setPart(value: number): void;
getCorrect(): boolean;
setCorrect(value: boolean): void;
getRanking(): number;
setRanking(value: number): void;
getPoints(): number;
setPoints(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): SubmitResponse.AsObject;
static toObject(includeInstance: boolean, msg: SubmitResponse): SubmitResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: SubmitResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): SubmitResponse;
static deserializeBinaryFromReader(message: SubmitResponse, reader: jspb.BinaryReader): SubmitResponse;
}
export namespace SubmitResponse {
export type AsObject = {
id: string,
part: number,
correct: boolean,
ranking: number,
points: number,
}
}
export class UpdateFields extends jspb.Message {
getName(): string;
setName(value: string): void;
getGradelevel(): number;
setGradelevel(value: number): void;
getAdmin(): boolean;
setAdmin(value: boolean): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateFields.AsObject;
static toObject(includeInstance: boolean, msg: UpdateFields): UpdateFields.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpdateFields, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateFields;
static deserializeBinaryFromReader(message: UpdateFields, reader: jspb.BinaryReader): UpdateFields;
}
export namespace UpdateFields {
export type AsObject = {
name: string,
gradelevel: number,
admin: boolean,
}
}
export class UserRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UserRequest.AsObject;
static toObject(includeInstance: boolean, msg: UserRequest): UserRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UserRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UserRequest;
static deserializeBinaryFromReader(message: UserRequest, reader: jspb.BinaryReader): UserRequest;
}
export namespace UserRequest {
export type AsObject = {
}
}
export class AllUsersRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AllUsersRequest.AsObject;
static toObject(includeInstance: boolean, msg: AllUsersRequest): AllUsersRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AllUsersRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AllUsersRequest;
static deserializeBinaryFromReader(message: AllUsersRequest, reader: jspb.BinaryReader): AllUsersRequest;
}
export namespace AllUsersRequest {
export type AsObject = {
}
}
export class UpdateUserRequest extends jspb.Message {
getEmail(): string;
setEmail(value: string): void;
hasBody(): boolean;
clearBody(): void;
getBody(): UpdateFields | undefined;
setBody(value?: UpdateFields): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateUserRequest.AsObject;
static toObject(includeInstance: boolean, msg: UpdateUserRequest): UpdateUserRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpdateUserRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateUserRequest;
static deserializeBinaryFromReader(message: UpdateUserRequest, reader: jspb.BinaryReader): UpdateUserRequest;
}
export namespace UpdateUserRequest {
export type AsObject = {
email: string,
body?: UpdateFields.AsObject,
}
}
export class UserByEmailRequest extends jspb.Message {
getEmail(): string;
setEmail(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UserByEmailRequest.AsObject;
static toObject(includeInstance: boolean, msg: UserByEmailRequest): UserByEmailRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UserByEmailRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UserByEmailRequest;
static deserializeBinaryFromReader(message: UserByEmailRequest, reader: jspb.BinaryReader): UserByEmailRequest;
}
export namespace UserByEmailRequest {
export type AsObject = {
email: string,
}
}
export class DeleteUserRequest extends jspb.Message {
getEmail(): string;
setEmail(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeleteUserRequest.AsObject;
static toObject(includeInstance: boolean, msg: DeleteUserRequest): DeleteUserRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeleteUserRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeleteUserRequest;
static deserializeBinaryFromReader(message: DeleteUserRequest, reader: jspb.BinaryReader): DeleteUserRequest;
}
export namespace DeleteUserRequest {
export type AsObject = {
email: string,
}
}
export class AllUsersResponse extends jspb.Message {
clearUsersList(): void;
getUsersList(): Array<User>;
setUsersList(value: Array<User>): void;
addUsers(value?: User, index?: number): User;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AllUsersResponse.AsObject;
static toObject(includeInstance: boolean, msg: AllUsersResponse): AllUsersResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AllUsersResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AllUsersResponse;
static deserializeBinaryFromReader(message: AllUsersResponse, reader: jspb.BinaryReader): AllUsersResponse;
}
export namespace AllUsersResponse {
export type AsObject = {
usersList: Array<User.AsObject>,
}
}

@ -29,6 +29,7 @@ type QuestService interface {
// +gunk http.Match{ // +gunk http.Match{
// Method: "POST", // Method: "POST",
// Path: "/v1/questions/{ID}", // Path: "/v1/questions/{ID}",
// Body: "Body",
// } // }
Submit(SubmitRequest) SubmitResponse Submit(SubmitRequest) SubmitResponse
} }
@ -63,17 +64,18 @@ type QuestionInput struct {
Input string `pb:"2" json:"input"` Input string `pb:"2" json:"input"`
} }
type SubmitRequestData struct {
Answer string `pb:"2" json:"answer"`
Part int `pb:"3" json:"part"`
Code string `pb:"4" json:"code"`
}
type SubmitRequest struct { type SubmitRequest struct {
ID string `pb:"1" json:"id"` ID string `pb:"1" json:"id"`
Answer string `pb:"2" json:"content"` Body SubmitRequestData `pb:"2" json:"body"`
Part bool `pb:"3" json:"part"`
Code string `pb:"4" json:"code"`
} }
type SubmitResponse struct { type SubmitResponse struct {
ID string `pb:"1" json:"id"`
Part int `pb:"2" json:"part"`
Correct bool `pb:"3" json:"correct"` Correct bool `pb:"3" json:"correct"`
Ranking int `pb:"4" json:"ranking"`
Points int `pb:"5" json:"points"` Points int `pb:"5" json:"points"`
} }

@ -16,6 +16,7 @@ import (
"github.com/kenshaw/redoc" "github.com/kenshaw/redoc"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"google.golang.org/protobuf/encoding/protojson"
) )
func main() { func main() {
@ -31,10 +32,17 @@ func main() {
// run creates and runs the gateway instance. // run creates and runs the gateway instance.
func run(ctx context.Context, addr, endpoint string) error { func run(ctx context.Context, addr, endpoint string) error {
// build gateway mux // build gateway mux
gw, opts := runtime.NewServeMux(), []grpc.DialOption{grpc.WithInsecure()} gw, opts := runtime.NewServeMux(
runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{
MarshalOptions: protojson.MarshalOptions{
EmitUnpopulated: true,
},
}),
), []grpc.DialOption{grpc.WithInsecure()}
for _, f := range []func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error{ for _, f := range []func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error{
codequestpb.RegisterAuthServiceHandlerFromEndpoint, codequestpb.RegisterAuthServiceHandlerFromEndpoint,
codequestpb.RegisterUserServiceHandlerFromEndpoint, codequestpb.RegisterUserServiceHandlerFromEndpoint,
codequestpb.RegisterQuestServiceHandlerFromEndpoint,
} { } {
if err := f(ctx, gw, endpoint, opts); err != nil { if err := f(ctx, gw, endpoint, opts); err != nil {
return err return err

@ -24,6 +24,7 @@ func run() error {
port := fs.Int("port", 10000, "GRPC Server Port") port := fs.Int("port", 10000, "GRPC Server Port")
secretFile := fs.String("secret", "client.secret.json", "Path to google oauth2 secret credentials JSON file.") secretFile := fs.String("secret", "client.secret.json", "Path to google oauth2 secret credentials JSON file.")
dbFile := fs.String("db", "db.sqlite", "Path to sqlite3 database file") dbFile := fs.String("db", "db.sqlite", "Path to sqlite3 database file")
debug := fs.Bool("debug", false, "debug sql queries")
if err := ff.Parse(fs, os.Args[1:], ff.WithEnvVarPrefix("HK")); err != nil { if err := ff.Parse(fs, os.Args[1:], ff.WithEnvVarPrefix("HK")); err != nil {
return err return err
} }
@ -36,7 +37,9 @@ func run() error {
if err != nil { if err != nil {
return fmt.Errorf("could not open db: %v", err) return fmt.Errorf("could not open db: %v", err)
} }
if *debug {
models.SetLogger(log.Printf) models.SetLogger(log.Printf)
}
oaStore, err := db.NewOAuthState(*secretFile) oaStore, err := db.NewOAuthState(*secretFile)
if err != nil { if err != nil {

@ -49,7 +49,7 @@ func (db *DB) Questions(ctx context.Context, u *models.User) ([]*question.Data,
} }
data = append(data, &question.Data{ data = append(data, &question.Data{
QuestionID: q.ID, Question: q,
UserID: u.ID, UserID: u.ID,
Name: q.Name, Name: q.Name,
Part1: p1, Part1: p1,
@ -90,7 +90,7 @@ func (db *DB) Question(ctx context.Context, u *models.User, id string) (*questio
} }
return &question.Data{ return &question.Data{
QuestionID: q.ID, Question: q,
UserID: u.ID, UserID: u.ID,
Name: q.Name, Name: q.Name,
Text: q.Text, Text: q.Text,
@ -98,10 +98,12 @@ func (db *DB) Question(ctx context.Context, u *models.User, id string) (*questio
Part1: question.PartData{ Part1: question.PartData{
Completed: partData.P1Awarded.Valid, Completed: partData.P1Awarded.Valid,
PointsWorth: int(partData.P1Awarded.Int64), PointsWorth: int(partData.P1Awarded.Int64),
Solution: partData.P1Answer.String,
}, },
Part2: question.PartData{ Part2: question.PartData{
Completed: partData.P2Awarded.Valid, Completed: partData.P2Awarded.Valid,
PointsWorth: int(partData.P2Awarded.Int64), PointsWorth: int(partData.P2Awarded.Int64),
Solution: partData.P2Answer.String,
}, },
}, nil }, nil
} }

@ -93,7 +93,9 @@ WITH attempts AS (
) )
SELECT SELECT
p1.points_awarded AS p1_awarded, p1.points_awarded AS p1_awarded,
p2.points_awarded AS p2_awarded p1.answer AS p1_answer,
p2.points_awarded AS p2_awarded,
p2.answer AS p2_answer
FROM users u FROM users u
LEFT JOIN attempts AS p1 LEFT JOIN attempts AS p1

@ -6,7 +6,7 @@ require (
github.com/google/uuid v1.1.2 github.com/google/uuid v1.1.2
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0
github.com/k0kubun/pp/v3 v3.0.7 github.com/k0kubun/pp/v3 v3.0.8-0.20211130055516-28dbe910808d
github.com/kenshaw/redoc v0.1.3 github.com/kenshaw/redoc v0.1.3
github.com/mattn/go-sqlite3 v1.14.8 github.com/mattn/go-sqlite3 v1.14.8
github.com/peterbourgon/ff/v3 v3.1.0 github.com/peterbourgon/ff/v3 v3.1.0

@ -188,6 +188,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
github.com/k0kubun/pp/v3 v3.0.7 h1:Qj4zVxA0ceXq0mfNbHwFPye58UyabBWi3emM2SwBT5Y= github.com/k0kubun/pp/v3 v3.0.7 h1:Qj4zVxA0ceXq0mfNbHwFPye58UyabBWi3emM2SwBT5Y=
github.com/k0kubun/pp/v3 v3.0.7/go.mod h1:2ol0zQBSPTermAo8igHVJ4d5vTiNmBkCrUdu7wZp4aI= github.com/k0kubun/pp/v3 v3.0.7/go.mod h1:2ol0zQBSPTermAo8igHVJ4d5vTiNmBkCrUdu7wZp4aI=
github.com/k0kubun/pp/v3 v3.0.8-0.20211130055516-28dbe910808d h1:pnhp6N9BrdCXRnnUO+HDeqMaajUzytmMd49UydYP/Wg=
github.com/k0kubun/pp/v3 v3.0.8-0.20211130055516-28dbe910808d/go.mod h1:8nuy25R0zFAdhfsMYvI5UWvUqW4MvF8wwSd3LXGQZiY=
github.com/kenshaw/diskcache v0.5.0/go.mod h1:niKrpaT3MnShxQ4OojUoT8VNr9e5r+SQf8nrzVWjIrQ= github.com/kenshaw/diskcache v0.5.0/go.mod h1:niKrpaT3MnShxQ4OojUoT8VNr9e5r+SQf8nrzVWjIrQ=
github.com/kenshaw/diskcache v0.5.1 h1:mdgyJGiGOn+1ZW6WOa7u+HwsJoExiRzEBymjjTBbOJc= github.com/kenshaw/diskcache v0.5.1 h1:mdgyJGiGOn+1ZW6WOa7u+HwsJoExiRzEBymjjTBbOJc=
github.com/kenshaw/diskcache v0.5.1/go.mod h1:2g5XF+9Dgd1iBFi0anYYw3beLaLnTgJSSzsKIuk+Z5E= github.com/kenshaw/diskcache v0.5.1/go.mod h1:2g5XF+9Dgd1iBFi0anYYw3beLaLnTgJSSzsKIuk+Z5E=

@ -10,7 +10,9 @@ import (
// PartsData represents a row from 'parts_data'. // PartsData represents a row from 'parts_data'.
type PartsData struct { type PartsData struct {
P1Awarded sql.NullInt64 `json:"p1_awarded"` // p1_awarded P1Awarded sql.NullInt64 `json:"p1_awarded"` // p1_awarded
P1Answer sql.NullString `json:"p1_answer"` // p1_answer
P2Awarded sql.NullInt64 `json:"p2_awarded"` // p2_awarded P2Awarded sql.NullInt64 `json:"p2_awarded"` // p2_awarded
P2Answer sql.NullString `json:"p2_answer"` // p2_answer
} }
// QuestionPartsData runs a custom query, returning results as PartsData. // QuestionPartsData runs a custom query, returning results as PartsData.
@ -24,7 +26,9 @@ func QuestionPartsData(ctx context.Context, db DB, question_id, user_id string)
`) ` + `) ` +
`SELECT ` + `SELECT ` +
`p1.points_awarded AS p1_awarded, ` + `p1.points_awarded AS p1_awarded, ` +
`p2.points_awarded AS p2_awarded ` + `p1.answer AS p1_answer, ` +
`p2.points_awarded AS p2_awarded, ` +
`p2.answer AS p2_answer ` +
`FROM users u ` + `FROM users u ` +
` ` + ` ` +
`LEFT JOIN attempts AS p1 ` + `LEFT JOIN attempts AS p1 ` +
@ -40,7 +44,7 @@ func QuestionPartsData(ctx context.Context, db DB, question_id, user_id string)
// run // run
logf(sqlstr, question_id, user_id) logf(sqlstr, question_id, user_id)
var pd PartsData var pd PartsData
if err := db.QueryRowContext(ctx, sqlstr, question_id, user_id).Scan(&pd.P1Awarded, &pd.P2Awarded); err != nil { if err := db.QueryRowContext(ctx, sqlstr, question_id, user_id).Scan(&pd.P1Awarded, &pd.P1Answer, &pd.P2Awarded, &pd.P2Answer); err != nil {
return nil, logerror(err) return nil, logerror(err)
} }
return &pd, nil return &pd, nil

@ -14,7 +14,7 @@ type QuestionAttempt struct {
QuestionPart int `json:"question_part"` // question_part QuestionPart int `json:"question_part"` // question_part
Correct bool `json:"correct"` // correct Correct bool `json:"correct"` // correct
PointsAwarded int `json:"points_awarded"` // points_awarded PointsAwarded int `json:"points_awarded"` // points_awarded
Input string `json:"input"` // input Answer string `json:"answer"` // answer
Code string `json:"code"` // code Code string `json:"code"` // code
SubmittedAt Time `json:"submitted_at"` // submitted_at SubmittedAt Time `json:"submitted_at"` // submitted_at
// xo fields // xo fields
@ -42,13 +42,13 @@ func (qa *QuestionAttempt) Insert(ctx context.Context, db DB) error {
} }
// insert (primary key generated and returned by database) // insert (primary key generated and returned by database)
const sqlstr = `INSERT INTO question_attempt (` + const sqlstr = `INSERT INTO question_attempt (` +
`user_id, question_id, question_part, correct, points_awarded, input, code, submitted_at` + `user_id, question_id, question_part, correct, points_awarded, answer, code, submitted_at` +
`) VALUES (` + `) VALUES (` +
`$1, $2, $3, $4, $5, $6, $7, $8` + `$1, $2, $3, $4, $5, $6, $7, $8` +
`)` `)`
// run // run
logf(sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Input, qa.Code, qa.SubmittedAt) logf(sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Answer, qa.Code, qa.SubmittedAt)
res, err := db.ExecContext(ctx, sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Input, qa.Code, qa.SubmittedAt) res, err := db.ExecContext(ctx, sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Answer, qa.Code, qa.SubmittedAt)
if err != nil { if err != nil {
return logerror(err) return logerror(err)
} }
@ -73,11 +73,11 @@ func (qa *QuestionAttempt) Update(ctx context.Context, db DB) error {
} }
// update with primary key // update with primary key
const sqlstr = `UPDATE question_attempt SET ` + const sqlstr = `UPDATE question_attempt SET ` +
`user_id = $1, question_id = $2, question_part = $3, correct = $4, points_awarded = $5, input = $6, code = $7, submitted_at = $8 ` + `user_id = $1, question_id = $2, question_part = $3, correct = $4, points_awarded = $5, answer = $6, code = $7, submitted_at = $8 ` +
`WHERE id = $9` `WHERE id = $9`
// run // run
logf(sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Input, qa.Code, qa.SubmittedAt, qa.ID) logf(sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Answer, qa.Code, qa.SubmittedAt, qa.ID)
if _, err := db.ExecContext(ctx, sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Input, qa.Code, qa.SubmittedAt, qa.ID); err != nil { if _, err := db.ExecContext(ctx, sqlstr, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Answer, qa.Code, qa.SubmittedAt, qa.ID); err != nil {
return logerror(err) return logerror(err)
} }
return nil return nil
@ -99,16 +99,16 @@ func (qa *QuestionAttempt) Upsert(ctx context.Context, db DB) error {
} }
// upsert // upsert
const sqlstr = `INSERT INTO question_attempt (` + const sqlstr = `INSERT INTO question_attempt (` +
`id, user_id, question_id, question_part, correct, points_awarded, input, code, submitted_at` + `id, user_id, question_id, question_part, correct, points_awarded, answer, code, submitted_at` +
`) VALUES (` + `) VALUES (` +
`$1, $2, $3, $4, $5, $6, $7, $8, $9` + `$1, $2, $3, $4, $5, $6, $7, $8, $9` +
`)` + `)` +
` ON CONFLICT (id) DO ` + ` ON CONFLICT (id) DO ` +
`UPDATE SET ` + `UPDATE SET ` +
`user_id = EXCLUDED.user_id, question_id = EXCLUDED.question_id, question_part = EXCLUDED.question_part, correct = EXCLUDED.correct, points_awarded = EXCLUDED.points_awarded, input = EXCLUDED.input, code = EXCLUDED.code, submitted_at = EXCLUDED.submitted_at ` `user_id = EXCLUDED.user_id, question_id = EXCLUDED.question_id, question_part = EXCLUDED.question_part, correct = EXCLUDED.correct, points_awarded = EXCLUDED.points_awarded, answer = EXCLUDED.answer, code = EXCLUDED.code, submitted_at = EXCLUDED.submitted_at `
// run // run
logf(sqlstr, qa.ID, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Input, qa.Code, qa.SubmittedAt) logf(sqlstr, qa.ID, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Answer, qa.Code, qa.SubmittedAt)
if _, err := db.ExecContext(ctx, sqlstr, qa.ID, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Input, qa.Code, qa.SubmittedAt); err != nil { if _, err := db.ExecContext(ctx, sqlstr, qa.ID, qa.UserID, qa.QuestionID, qa.QuestionPart, qa.Correct, qa.PointsAwarded, qa.Answer, qa.Code, qa.SubmittedAt); err != nil {
return logerror(err) return logerror(err)
} }
// set exists // set exists
@ -143,7 +143,7 @@ func (qa *QuestionAttempt) Delete(ctx context.Context, db DB) error {
func QuestionAttemptByID(ctx context.Context, db DB, id int) (*QuestionAttempt, error) { func QuestionAttemptByID(ctx context.Context, db DB, id int) (*QuestionAttempt, error) {
// query // query
const sqlstr = `SELECT ` + const sqlstr = `SELECT ` +
`id, user_id, question_id, question_part, correct, points_awarded, input, code, submitted_at ` + `id, user_id, question_id, question_part, correct, points_awarded, answer, code, submitted_at ` +
`FROM question_attempt ` + `FROM question_attempt ` +
`WHERE id = $1` `WHERE id = $1`
// run // run
@ -151,7 +151,7 @@ func QuestionAttemptByID(ctx context.Context, db DB, id int) (*QuestionAttempt,
qa := QuestionAttempt{ qa := QuestionAttempt{
_exists: true, _exists: true,
} }
if err := db.QueryRowContext(ctx, sqlstr, id).Scan(&qa.ID, &qa.UserID, &qa.QuestionID, &qa.QuestionPart, &qa.Correct, &qa.PointsAwarded, &qa.Input, &qa.Code, &qa.SubmittedAt); err != nil { if err := db.QueryRowContext(ctx, sqlstr, id).Scan(&qa.ID, &qa.UserID, &qa.QuestionID, &qa.QuestionPart, &qa.Correct, &qa.PointsAwarded, &qa.Answer, &qa.Code, &qa.SubmittedAt); err != nil {
return nil, logerror(err) return nil, logerror(err)
} }
return &qa, nil return &qa, nil

@ -27,7 +27,7 @@ schemas:
- name: points_awarded - name: points_awarded
datatype: datatype:
type: integer type: integer
- name: input - name: answer
datatype: datatype:
type: text type: text
- name: code - name: code

@ -9,7 +9,7 @@ type PartData struct {
} }
type Data struct { type Data struct {
QuestionID string Question *Question
UserID string UserID string
Name string Name string
Text *template.Template Text *template.Template

@ -36,14 +36,14 @@ type Question struct {
type Level int type Level int
const ( const (
Level1 Level = iota Level1 Level = iota + 1
Level2 Level2
) )
type Part int type Part int
const ( const (
Part1 Part = iota Part1 Part = iota + 1
Part2 Part2
) )

@ -34,7 +34,7 @@ CREATE TABLE question_attempt (
question_part INTEGER NOT NULL, question_part INTEGER NOT NULL,
correct BOOLEAN NOT NULL, correct BOOLEAN NOT NULL,
points_awarded INTEGER NOT NULL, points_awarded INTEGER NOT NULL,
input TEXT NOT NULL, answer TEXT NOT NULL,
code TEXT NOT NULL, code TEXT NOT NULL,
submitted_at DATETIME NOT NULL submitted_at DATETIME NOT NULL
); );

@ -68,18 +68,19 @@ export type QuestionInput = {
input?: string input?: string
} }
export type SubmitRequest = { export type SubmitRequestData = {
id?: string
answer?: string answer?: string
part?: boolean part?: number
code?: string code?: string
} }
export type SubmitResponse = { export type SubmitRequest = {
id?: string id?: string
part?: number body?: SubmitRequestData
}
export type SubmitResponse = {
correct?: boolean correct?: boolean
ranking?: number
points?: number points?: number
} }
@ -134,7 +135,7 @@ export class QuestService {
return fm.fetchReq<QuestionInputRequest, QuestionInput>(`/v1/questions/${req["id"]}/input?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"}) return fm.fetchReq<QuestionInputRequest, QuestionInput>(`/v1/questions/${req["id"]}/input?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
} }
static Submit(req: SubmitRequest, initReq?: fm.InitReq): Promise<SubmitResponse> { static Submit(req: SubmitRequest, initReq?: fm.InitReq): Promise<SubmitResponse> {
return fm.fetchReq<SubmitRequest, SubmitResponse>(`/v1/questions/${req["id"]}`, {...initReq, method: "POST"}) return fm.fetchReq<SubmitRequest, SubmitResponse>(`/v1/questions/${req["id"]}`, {...initReq, method: "POST", body: JSON.stringify(req["Body"])})
} }
} }
export class UserService { export class UserService {