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

Commit 58934f9

Browse files
committed
Merge remote-tracking branch 'upstream/master' into upgrade_postgres
2 parents 85f216e + fcce598 commit 58934f9

31 files changed

+1281
-189
lines changed

.env.ci

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ OAUTH2_LOGIN_URL=http://localhost:8080/oauth/login
99
# for ridgepole
1010
DATABASE_URL_RIDGEPOLE=postgresql://postgres:@localhost/accounts?sslmode=disable
1111

12+
# for minio
13+
MINIO_ACCESS_KEY=youReallyNeedToChangeThis
14+
MINIO_SECRET_KEY=youReallyNeedToChangeThis
15+
MINIO_BROWSER=off
16+
1217
# for app
1318
DATABASE_URL=postgresql://postgres:@localhost/accounts?sslmode=disable
1419

20+
MINIO_PUBLIC_URL=http://localhost:9100
21+
MINIO_ENDPOINT=minio:9000
22+
MINIO_BUCKET_NAME=public
23+
1524
REDIS_ADDR=localhost:6379
1625

1726
DEBUG_LOG=true

.env.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ OAUTH2_LOGIN_URL=http://localhost:8080/oauth/login
99
# for ridgepole
1010
DATABASE_URL_RIDGEPOLE=postgresql://postgres:@localhost/accounts?sslmode=disable
1111

12+
# for minio
13+
MINIO_ACCESS_KEY=youReallyNeedToChangeThis
14+
MINIO_SECRET_KEY=youReallyNeedToChangeThis
15+
MINIO_BROWSER=off
16+
1217
# for app
1318
DATABASE_URL=postgresql://postgres:@pg/accounts?sslmode=disable
1419
POSTGRES_PASSWORD=
1520

21+
MINIO_PUBLIC_URL=http://localhost:9100
22+
MINIO_ENDPOINT=minio:9000
23+
MINIO_BUCKET_NAME=public
24+
1625
REDIS_ADDR=redis:6379
1726

1827
DEBUG_LOG=true

Gopkg.lock

Lines changed: 89 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: 31 additions & 7 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,16 @@ 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: "*"
40+
};
41+
}
42+
rpc UpdateUserIcon (UpdateUserIconRequest) returns (User) {
43+
option (google.api.http) = {
44+
post: "/user/icon"
45+
body: "*"
3946
};
4047
}
4148
rpc UpdatePassword (UpdatePasswordRequest) returns (google.protobuf.Empty) {
@@ -50,15 +57,20 @@ message User {
5057
string name = 2;
5158
string email = 3;
5259
string full_name = 4;
53-
string avatar_url = 5;
60+
string icon_url = 5;
5461
string description = 6;
5562
int32 grade = 7;
5663
bool left = 8;
57-
string short_department = 10;
5864
string role = 11;
5965
string twitter_screen_name = 12;
6066
string github_user_name = 13;
6167
type.Department department = 14;
68+
ProfileScope profile_scope = 15;
69+
}
70+
71+
enum ProfileScope {
72+
MEMBERS_ONLY = 0;
73+
PUBLIC = 1;
6274
}
6375

6476
message ListUsersRequest {
@@ -82,8 +94,20 @@ message CreateUserRequest {
8294

8395
message GetCurrentUserRequest {}
8496

85-
message UpdateUserRequest {
86-
User user = 1;
97+
message UpdateUserProfileRequest {
98+
string full_name = 1 [(validator.field) = {length_lt: 128}];
99+
string description = 2 [(validator.field) = {length_lt: 1024}];
100+
int32 grade = 3 [(validator.field) = {int_gt: 0, int_lt: 6}];
101+
bool left = 4;
102+
uint32 role_id = 5;
103+
string twitter_screen_name = 6 [(validator.field) = {regex: "^[A-Za-z0-9_]{0,15}$"}];
104+
string github_user_name = 7 [(validator.field) = {regex: "^([a-z\\d]+-)*[a-z\\d]+$", length_lt: 40}];
105+
uint32 department_id = 8;
106+
ProfileScope profile_scope = 9 [(validator.field) = {is_in_enum : true}];
107+
}
108+
109+
message UpdateUserIconRequest {
110+
bytes image = 1;
87111
}
88112

89113
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.

0 commit comments

Comments
 (0)