diff --git a/Makefile b/Makefile index 082e735..118e407 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ go: mkdir -p go - -cd go; go mod init github.com/isd-sgcu/johnjud-go-proto + -cd go; go mod init github.com/isd-sgcu/rpkm67-go-proto perl scripts/go/go.pl cd go; go mod tidy diff --git a/README.md b/README.md index 2ec7a69..5040472 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ # rpkm67-proto + +## Note +rpkm67-proto: private SSH key in secret +rpkm67-go-proto: public SSH key in Deploy Keys \ No newline at end of file diff --git a/rpkm67/auth/auth/v1/auth.proto b/rpkm67/auth/auth/v1/auth.proto index aa6d486..1439613 100644 --- a/rpkm67/auth/auth/v1/auth.proto +++ b/rpkm67/auth/auth/v1/auth.proto @@ -7,11 +7,8 @@ option go_package = "rpkm67/auth/auth/v1"; service AuthService { rpc Validate(ValidateRequest) returns (ValidateResponse) {} rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse) {} - rpc SignUp(SignUpRequest) returns (SignUpResponse) {} - rpc SignIn(SignInRequest) returns (SignInResponse) {} - rpc SignOut(SignOutRequest) returns (SignOutResponse) {} - rpc ForgotPassword(ForgotPasswordRequest) returns (ForgotPasswordResponse) {} - rpc ResetPassword(ResetPasswordRequest) returns (ResetPasswordResponse) {} + rpc GetGoogleLoginUrl(GetGoogleLoginUrlRequest) returns (GetGoogleLoginUrlResponse) {} + rpc VerifyGoogleLogin(VerifyGoogleLoginRequest) returns (VerifyGoogleLoginResponse) {} } message Credential{ @@ -30,7 +27,7 @@ message ValidateResponse{ string role = 2; } -// Redeem Refresh Token +// RefreshToken message RefreshTokenRequest{ string refreshToken = 1; } @@ -39,54 +36,19 @@ message RefreshTokenResponse{ Credential credential = 1; } -// Sign up -message SignUpRequest { - string studentId = 1; - string password = 2; - string firstname = 3; - string lastname = 4; - string tel = 5; - string role = 6; +// GetGoogleLoginUrl +message GetGoogleLoginUrlRequest { } -message SignUpResponse { - Credential credential = 1; -} - -// Sign in -message SignInRequest { - string studentId = 1; - string password = 2; -} - -message SignInResponse { - Credential credential = 1; -} - -// Sign out -message SignOutRequest { - string token = 1; -} - -message SignOutResponse { - bool isSuccess = 1; -} - -// Forgot password -message ForgotPasswordRequest { - string tel = 1; -} - -message ForgotPasswordResponse { +message GetGoogleLoginUrlResponse { string url = 1; } -// Reset password -message ResetPasswordRequest { - string token = 1; - string password = 2; +// VerifyGoogleLogin +message VerifyGoogleLoginRequest { + string code = 1; } -message ResetPasswordResponse { - bool isSuccess = 1; -} +message VerifyGoogleLoginResponse { + Credential credential = 1; +} \ No newline at end of file diff --git a/rpkm67/auth/user/v1/user.proto b/rpkm67/auth/user/v1/user.proto index aed0c7a..393c8ed 100644 --- a/rpkm67/auth/user/v1/user.proto +++ b/rpkm67/auth/user/v1/user.proto @@ -5,63 +5,87 @@ package rpkm67.auth.user.v1; option go_package = "rpkm67/auth/user/v1"; service UserService { - rpc Create(CreateRequest) returns (CreateResponse){} - rpc FindOne(FindOneRequest) returns (FindOneResponse){} - // rpc Update(UpdateUserRequest) returns (UpdateUserResponse){} - // rpc Delete(DeleteRequest) returns (DeleteResponse){} + rpc Create(CreateUserRequest) returns (CreateUserResponse){} + rpc FindOne(FindOneUserRequest) returns (FindOneUserResponse){} + rpc FindByEmail(FindByEmailRequest) returns (FindByEmailResponse){} + rpc Update(UpdateUserRequest) returns (UpdateUserResponse){} } message User{ string id = 1; - string studentId = 2; - string password = 3; - string firstname = 4; - string lastname = 5; - string tel = 6; - string role = 7; + string email = 2; + string nickname = 3; + string title = 4; + string firstname = 5; + string lastname = 6; + int32 year = 7; + string faculty = 8; + string tel = 9; + string parentTel = 10; + string parent = 11; + string foodAllergy = 12; + string drugAllergy = 13; + string illness = 14; + string role = 15; + string photoKey = 16; + string photoUrl = 17; + string baan = 18; + string groupId = 19; + int32 receiveGift = 20; } // Create -message CreateRequest{ - string studentId = 1; - string password = 2; - string firstname = 3; - string lastname = 4; - string tel = 5; - string role = 6; +message CreateUserRequest{ + string email = 1; + string role = 2; } -message CreateResponse{ +message CreateUserResponse{ User user = 1; } // FindOne -message FindOneRequest{ +message FindOneUserRequest{ string id = 1; } -message FindOneResponse{ +message FindOneUserResponse{ User user = 1; } -// Update -// message UpdateUserRequest{ -// string id = 1; -// string email = 2; -// string password = 3; -// string firstname = 4; -// string lastname = 5; -// } +// FindByEmail +message FindByEmailRequest{ + string email = 1; +} -// message UpdateUserResponse{ -// User user = 1; -// } +message FindByEmailResponse{ + User user = 1; +} -// Delete -// message DeleteRequest{ -// string id = 1; -// } +// Update +message UpdateUserRequest{ + string id = 1; + string email = 2; + string nickname = 3; + string title = 4; + string firstname = 5; + string lastname = 6; + int32 year = 7; + string faculty = 8; + string tel = 9; + string parentTel = 10; + string parent = 11; + string foodAllergy = 12; + string drugAllergy = 13; + string illness = 14; + string role = 15; + string photoKey = 16; + string photoUrl = 17; + string baan = 18; + string groupId = 19; + int32 receiveGift = 20; +} -// message DeleteResponse{ -// bool success = 1; -// } +message UpdateUserResponse{ + User user = 1; +} \ No newline at end of file diff --git a/rpkm67/backend/baan/v1/baan.proto b/rpkm67/backend/baan/v1/baan.proto deleted file mode 100644 index 5baeb97..0000000 --- a/rpkm67/backend/baan/v1/baan.proto +++ /dev/null @@ -1,60 +0,0 @@ -syntax = "proto3"; - -package rpkm67.backend.baan.v1; - -option go_package = "rpkm67/backend/baan/v1"; - -service BaanService { - rpc FindAllBaan(FindAllBaanRequest) returns (FindAllBaanResponse) {} - rpc FindOneBaan(FindOneBaanRequest) returns (FindOneBaanResponse) {} -} - -enum BaanSize{ - UNKNOWN = 0; - S = 1; - M = 2; - L = 3; - XL = 4; - XXL = 5; -} - -message Baan{ - string id = 1; - string nameTH = 2; - string descriptionTH = 3; - string nameEN = 4; - string descriptionEN = 5; - BaanSize size = 6; - string facebook = 7; - string facebookUrl = 8; - string instagram = 9; - string instagramUrl = 10; - string line = 11; - string lineUrl = 12; - string imageUrl = 13; -} - -message BaanInfo{ - string id = 1; - string nameTH = 2; - string nameEN = 3; - string imageUrl = 4; - BaanSize size = 5; -} - -// Find All Baan -message FindAllBaanRequest{ -} - -message FindAllBaanResponse{ - repeated Baan baans = 1; -} - -// Find Baan -message FindOneBaanRequest{ - string id = 1; -} - -message FindOneBaanResponse{ - Baan baan = 1; -} \ No newline at end of file diff --git a/rpkm67/backend/pin/v1/pin.proto b/rpkm67/backend/pin/v1/pin.proto new file mode 100644 index 0000000..cac66f3 --- /dev/null +++ b/rpkm67/backend/pin/v1/pin.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package rpkm67.backend.pin.v1; + +option go_package = "rpkm67/backend/pin/v1"; + +service PinService { + rpc FindAll(FindAllPinRequest) returns (FindAllPinResponse){} + rpc ResetPin(ResetPinRequest) returns (ResetPinResponse) {} +} + +message Pin{ + string workshopId = 1; + string code = 2; +} + +// FindAll +message FindAllPinRequest{ +} + +message FindAllPinResponse{ + repeated Pin pins = 1; +} + +// ResetPin +message ResetPinRequest{ + string workshopId = 1; +} + +message ResetPinResponse{ + bool success = 1; +} diff --git a/rpkm67/backend/selection/v1/selection.proto b/rpkm67/backend/selection/v1/selection.proto index a23230b..991de27 100644 --- a/rpkm67/backend/selection/v1/selection.proto +++ b/rpkm67/backend/selection/v1/selection.proto @@ -6,40 +6,56 @@ option go_package = "rpkm67/backend/selection/v1"; service SelectionService { rpc Create(CreateSelectionRequest) returns (CreateSelectionResponse){} - rpc FindByStudentId(FindByStudentIdSelectionRequest) returns (FindByStudentIdSelectionResponse) {} - rpc Update(UpdateSelectionRequest) returns (UpdateSelectionResponse){} + rpc FindByGroupId(FindByGroupIdSelectionRequest) returns (FindByGroupIdSelectionResponse) {} + rpc Delete(DeleteSelectionRequest) returns (DeleteSelectionResponse){} + rpc CountByBaanId(CountByBaanIdSelectionRequest) returns (CountByBaanIdSelectionResponse){} } message Selection{ string id = 1; - string userId = 2; - repeated string baanIds = 3; + string groupId = 2; + string baanId = 3; + int32 order = 4; +} + +message BaanCount{ + string baanId = 1; + int32 count = 2; } // Create message CreateSelectionRequest{ - string userId = 1; - repeated string baanIds = 2; + string groupId = 1; + string baanId = 2; + int32 order = 3; } message CreateSelectionResponse{ Selection selection = 1; } -// FindByStudentId -message FindByStudentIdSelectionRequest{ - string userId = 1; +// FindByGroupId +message FindByGroupIdSelectionRequest{ + string groupId = 1; } -message FindByStudentIdSelectionResponse{ - Selection selection = 1; +message FindByGroupIdSelectionResponse{ + repeated Selection selections = 1; } -// Update -message UpdateSelectionRequest{ - Selection selection = 1; +// Delete +message DeleteSelectionRequest{ + string id = 1; } -message UpdateSelectionResponse{ +message DeleteSelectionResponse{ bool success = 1; +} + +// CountByBaanId +message CountByBaanIdSelectionRequest{ +} + +message CountByBaanIdSelectionResponse{ + repeated BaanCount baanCounts = 1; } \ No newline at end of file diff --git a/rpkm67/backend/stamp/v1/stamp.proto b/rpkm67/backend/stamp/v1/stamp.proto new file mode 100644 index 0000000..1b34552 --- /dev/null +++ b/rpkm67/backend/stamp/v1/stamp.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +package rpkm67.backend.stamp.v1; + +option go_package = "rpkm67/backend/stamp/v1"; + +service StampService { + rpc FindByUserId(FindByUserIdStampRequest) returns (FindByUserIdStampResponse){} + rpc StampByUserId(StampByUserIdRequest) returns (StampByUserIdResponse) {} +} + +message Stamp{ + string id = 1; + string userId = 2; + int32 pointA = 3; + int32 pointB = 4; + int32 pointC = 5; + int32 pointD = 6; + bool workshop1 = 7; + bool workshop2 = 8; + bool workshop3 = 9; + bool workshop4 = 10; + bool workshop5 = 11; + bool landmark1 = 12; + bool landmark2 = 13; + bool landmark3 = 14; + bool landmark4 = 15; + bool institute1 = 16; + bool institute2 = 17; +} + +// FindByUserId +message FindByUserIdStampRequest{ + string userId = 1; +} + +message FindByUserIdStampResponse{ + Stamp stamp = 1; +} + +// StampByUserId +message StampByUserIdRequest{ + string userId = 1; + string activityId = 2; +} + +message StampByUserIdResponse{ + Stamp stamp = 1; +} diff --git a/rpkm67/checkin/checkin/v1/checkin.proto b/rpkm67/checkin/checkin/v1/checkin.proto index ba75a97..e1a98e7 100644 --- a/rpkm67/checkin/checkin/v1/checkin.proto +++ b/rpkm67/checkin/checkin/v1/checkin.proto @@ -6,30 +6,42 @@ option go_package = "rpkm67/checkin/checkin/v1"; service CheckInService { rpc Create(CreateCheckInRequest) returns (CreateCheckInResponse){} - rpc FindByStudentId(FindByStudentIdCheckInRequest) returns (FindByStudentIdCheckInResponse){} + rpc FindByUserId(FindByUserIdCheckInRequest) returns (FindByUserIdCheckInResponse){} + rpc FindByEmail(FindByEmailCheckInRequest) returns (FindByEmailCheckInResponse){} } message CheckIn{ string id = 1; - string studentId = 2; - string event = 3; + string userId = 2; + string email = 3; + string event = 4; } // Create message CreateCheckInRequest{ - string studentId = 1; - string event = 2; + string email = 1; + string userId = 2; + string event = 3; } message CreateCheckInResponse{ CheckIn checkIn = 1; } -// FindByStudentId -message FindByStudentIdCheckInRequest{ - string studentId = 1; +// FindByUserId +message FindByUserIdCheckInRequest{ + string userId = 1; +} + +message FindByUserIdCheckInResponse{ + repeated CheckIn checkIns = 1; +} + +// FindByEmail +message FindByEmailCheckInRequest{ + string email = 1; } -message FindByStudentIdCheckInResponse{ +message FindByEmailCheckInResponse{ repeated CheckIn checkIns = 1; } diff --git a/rpkm67/store/object/v1/object.proto b/rpkm67/store/object/v1/object.proto index 6a4a7fb..fb2a9bc 100644 --- a/rpkm67/store/object/v1/object.proto +++ b/rpkm67/store/object/v1/object.proto @@ -12,11 +12,13 @@ service ObjectService { message Object{ string url = 1; - string objectKey = 2; + string key = 2; } // FindByKey -message FindByKeyObjectRequest{} +message FindByKeyObjectRequest{ + string key = 1; +} message FindByKeyObjectResponse{ Object object = 1; @@ -34,7 +36,7 @@ message UploadObjectResponse{ // DeleteByKey message DeleteByKeyObjectRequest{ - string objectKey = 1; + string key = 1; } message DeleteByKeyObjectResponse{ diff --git a/scripts/go/go.pl b/scripts/go/go.pl index 3c323ef..057d157 100644 --- a/scripts/go/go.pl +++ b/scripts/go/go.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -my $go_module = "github.com/isd-sgcu/johnjud-go-proto"; +my $go_module = "github.com/isd-sgcu/rpkm67-go-proto"; my $proto_package = ""; my $source_dir = scalar(@ARGV) < 1 ? "*" : "${ARGV[0]}";