Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit 28e3799

Browse files
authored
Merge pull request #33 from gedorinku/update_profile
Update profile
2 parents a8628a5 + fa38ba9 commit 28e3799

26 files changed

+831
-175
lines changed

Gopkg.lock

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
[[constraint]]
66
name = "github.com/ory/hydra"
77
version = "1.0.0-rc.6+oryOS.10"
8+
9+
[[constraint]]
10+
branch = "master"
11+
name = "github.com/mwitkow/go-proto-validators"

api/oauth.validator.pb.go

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protos/users.proto

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package programming_lab.prolab_accounts;
55
option go_package = "github.com/ProgrammingLab/prolab-accounts/api;api_pb";
66

77

8+
import "github.com/mwitkow/go-proto-validators/validator.proto";
89
import "google/api/annotations.proto";
910
import "google/protobuf/empty.proto";
1011

@@ -32,10 +33,10 @@ service UserService {
3233
get: "/user"
3334
};
3435
}
35-
rpc UpdateUser (UpdateUserRequest) returns (User) {
36+
rpc UpdateUserProfile (UpdateUserProfileRequest) returns (User) {
3637
option (google.api.http) = {
37-
patch: "/user"
38-
body: "user"
38+
patch: "/user/profile"
39+
body: "*"
3940
};
4041
}
4142
rpc UpdatePassword (UpdatePasswordRequest) returns (google.protobuf.Empty) {
@@ -54,11 +55,16 @@ message User {
5455
string description = 6;
5556
int32 grade = 7;
5657
bool left = 8;
57-
string short_department = 10;
5858
string role = 11;
5959
string twitter_screen_name = 12;
6060
string github_user_name = 13;
6161
type.Department department = 14;
62+
ProfileScope profile_scope = 15;
63+
}
64+
65+
enum ProfileScope {
66+
MEMBERS_ONLY = 0;
67+
PUBLIC = 1;
6268
}
6369

6470
message ListUsersRequest {
@@ -82,8 +88,16 @@ message CreateUserRequest {
8288

8389
message GetCurrentUserRequest {}
8490

85-
message UpdateUserRequest {
86-
User user = 1;
91+
message UpdateUserProfileRequest {
92+
string full_name = 1 [(validator.field) = {length_lt: 128}];
93+
string description = 2 [(validator.field) = {length_lt: 1024}];
94+
int32 grade = 3 [(validator.field) = {int_gt: 0, int_lt: 6}];
95+
bool left = 4;
96+
uint32 role_id = 5;
97+
string twitter_screen_name = 6 [(validator.field) = {regex: "^[A-Za-z0-9_]{0,15}$"}];
98+
string github_user_name = 7 [(validator.field) = {regex: "^([a-z\\d]+-)*[a-z\\d]+$", length_lt: 40}];
99+
uint32 department_id = 8;
100+
ProfileScope profile_scope = 9 [(validator.field) = {is_in_enum : true}];
87101
}
88102

89103
message UpdatePasswordRequest {

api/sessions.validator.pb.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/type/client.validator.pb.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/type/department.validator.pb.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)