feat: add submodule

This commit is contained in:
Vyacheslav1557 2024-08-16 16:10:21 +05:00
parent 046b8cf847
commit c8b55f6866
6 changed files with 10 additions and 110 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "proto"]
path = proto
url = https://git.sch9.ru/new_gate/contracts

View file

@ -1,7 +1,10 @@
gen:
@buf generate proto/session
@buf generate proto/user
dev: dev:
@buf generate proto @make gen
@go run main.go @go run main.go
build: build:
@buf generate proto @make gen
# TODO: build dockerfile # TODO: build dockerfile

View file

@ -2,7 +2,7 @@ version: v1
managed: managed:
enabled: true enabled: true
go_package_prefix: go_package_prefix:
default: ms-auth/pkg/go/gen default: ./pkg/go/gen
plugins: plugins:
- name: go - name: go
out: pkg/go/gen out: pkg/go/gen

1
proto Submodule

@ -0,0 +1 @@
Subproject commit b679e062747938cbd23e7b6f950b05f75eced5b4

View file

@ -1,35 +0,0 @@
syntax = "proto3";
package proto.session.v1;
import "google/protobuf/empty.proto";
service SessionService {
rpc Create (CreateSessionRequest) returns (CreateSessionResponse);
rpc Read (ReadSessionRequest) returns (ReadSessionResponse);
rpc Update (UpdateSessionRequest) returns (google.protobuf.Empty);
rpc Delete (DeleteSessionRequest) returns (google.protobuf.Empty);
}
message CreateSessionRequest {
string handle = 1;
string password = 2;
}
message CreateSessionResponse {
string token = 1;
}
message ReadSessionRequest {
string token = 1;
}
message ReadSessionResponse {
int32 user_id = 2;
}
message UpdateSessionRequest {
string token = 1;
}
message DeleteSessionRequest {
string token = 1;
}

View file

@ -1,72 +0,0 @@
syntax = "proto3";
package proto.user.v1;
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
service UserService {
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
rpc ReadUser (ReadUserRequest) returns (ReadUserResponse);
rpc UpdateUser (UpdateUserRequest) returns (google.protobuf.Empty);
rpc DeleteUser (DeleteUserRequest) returns (google.protobuf.Empty);
}
enum Role {
ROLE_SPECTATOR_UNSPECIFIED = 0;
ROLE_PARTICIPANT = 1;
ROLE_MODERATOR = 2;
ROLE_ADMIN = 3;
}
message CreateUserRequest {
message User {
string username = 1;
string password = 2;
reserved 3;
optional google.protobuf.Timestamp expires_at = 4;
Role role = 5;
}
string token = 1;
User user = 2;
}
message CreateUserResponse {
int32 id = 1;
}
message ReadUserRequest {
string token = 1;
int32 id = 2;
}
message ReadUserResponse {
message User {
int32 id = 1;
string username = 2;
reserved 3;
string password = 4;
google.protobuf.Timestamp expires_at = 5;
google.protobuf.Timestamp created_at = 6;
Role role = 7;
}
User user = 1;
}
message UpdateUserRequest {
message User {
int32 id = 1;
optional string username = 2;
reserved 3;
optional string password = 4;
optional google.protobuf.Timestamp expires_at = 5;
optional Role role = 6;
}
string token = 1;
User user = 2;
}
message DeleteUserRequest {
string token = 1;
int32 id = 2;
}