Skip to content

Commit

Permalink
Merge pull request #9 from Kyutech-C3/refactor/schema-archtecture
Browse files Browse the repository at this point in the history
スキーマのディレクトリ構造を変更
  • Loading branch information
tosaken1116 authored Apr 6, 2024
2 parents 7d65341 + 18aeeb0 commit adf4154
Show file tree
Hide file tree
Showing 23 changed files with 238 additions and 439 deletions.
280 changes: 81 additions & 199 deletions openapi/api_definition.swagger.yaml

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions proto/schema/auth/discord-callback/callback.proto

This file was deleted.

15 changes: 0 additions & 15 deletions proto/schema/auth/discord-callback/rpc/callback.proto

This file was deleted.

17 changes: 0 additions & 17 deletions proto/schema/auth/discord/discord.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package proto.schema.auth.discord.callback.resources;
package auth.schema.discord_callback;
import "proto/third_party/grpc/openapiv2/options/annotations.proto";

option go_package = "./";
Expand All @@ -14,4 +14,12 @@ message DiscordToken {
example : "{ \"access_token\": \"token\", \"refresh_token\": "
"\"refresh-token\", \"expired_at\": \"expire-time\" }"
};
}

message DiscordCallbackRequest {
string code = 1;

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
example : "{\"code\": \"some-code\"}"
};
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
syntax = "proto3";

package proto.schema.auth.sign_up.resources;
package auth.schema.sign_up;

option go_package = "./";

message InitialAccountTemplate {
message SignUpRequest {
string name = 1;
string email = 2;
string password = 3;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package proto.schema.auth.token.rpc;
package auth.schema.token;

option go_package = "./";

Expand Down
38 changes: 38 additions & 0 deletions proto/schema/auth/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// proto/schema/users/users.proto
syntax = "proto3";

package proto.schema.users;
import "proto/third_party/google/api/annotations.proto";
import "proto/third_party/google/api/wrappers.proto";
import "proto/schema/auth/schema/discord_callback/resource.proto";
import "proto/schema/auth/schema/sign_up/resource.proto";
import "proto/schema/auth/schema/token/resource.proto";
import "proto/schema/users/model/model.proto";
import "google/protobuf/empty.proto";
option go_package = "./";


service AuthService {
rpc DiscordCallBack(.auth.schema.discord_callback.DiscordCallbackRequest) returns (google.protobuf.StringValue) {
option (google.api.http) = {
get: "/v1/auth/discord/callback"
};
}
rpc ExchangeToken(.auth.schema.token.PostTokenRequest)returns(.auth.schema.token.PostTokenResponse){
option (google.api.http) = {
post: "/v1/auth/token"
body: "*"
};
}
rpc RedirectDiscord(google.protobuf.Empty) returns (google.protobuf.StringValue) {
option (google.api.http) = {
get: "/v1/auth/discord"
};
}
rpc SignUp(.auth.schema.sign_up.SignUpRequest) returns (proto.schema.users.model.User) {
option (google.api.http) = {
post: "/v1/auth/sign_up"
body: "*"
};
}
}
19 changes: 0 additions & 19 deletions proto/schema/auth/sign_up/signup.proto

This file was deleted.

17 changes: 0 additions & 17 deletions proto/schema/auth/token/token.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package proto.schema.tags.resources;
package proto.schema.tags.model;
import "proto/third_party/grpc/openapiv2/options/annotations.proto";

option go_package = "./";
Expand Down
22 changes: 0 additions & 22 deletions proto/schema/tags/rpc/tags.proto

This file was deleted.

19 changes: 19 additions & 0 deletions proto/schema/tags/schema/tags/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

package tags.schema.tags;

import "proto/third_party/grpc/openapiv2/options/annotations.proto";
import "proto/third_party/google/api/field_behavior.proto";

option go_package = "./";

message GetTagsRequest {
string limit = 1 [(google.api.field_behavior) = OPTIONAL];
string smallest_tag_id = 2 [(google.api.field_behavior) = OPTIONAL];
string biggest_tag_id = 3 [(google.api.field_behavior) = OPTIONAL];
string w = 4 [(google.api.field_behavior) = OPTIONAL];

option(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
example: "{\"limit\": 100, \"smallest_tag_id\": \"\", \"biggest_tag_id\": \"\", \"w\": \"\"}"
};
}
16 changes: 16 additions & 0 deletions proto/schema/tags/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package proto.schema.users;
import "proto/schema/tags/schema/tags/resource.proto";
import "proto/schema/tags/model/model.proto";
import "proto/third_party/google/api/annotations.proto";
option go_package = "./";

service TagsService {
rpc GetTags(.tags.schema.tags.GetTagsRequest)
returns (stream proto.schema.tags.model.Tag) {
option (google.api.http) = {
get : "/v1/tags"
};
};
}
35 changes: 0 additions & 35 deletions proto/schema/tags/tags.proto

This file was deleted.

28 changes: 0 additions & 28 deletions proto/schema/users/me/me.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
syntax = "proto3";

package proto.schema.users.me.resources;
package proto.schema.users.model;
import "proto/third_party/grpc/openapiv2/options/annotations.proto";
import "proto/third_party/google/api/type/datetime.proto";

option go_package = "./";

message Account {
message User {
string id = 1;
string name = 2;
string display_name = 3;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
syntax = "proto3";

package proto.schema.users.me.rpc;
package users.schema.me;

import "proto/third_party/grpc/openapiv2/options/annotations.proto";

option go_package = "./";

message AccountPatcher {

message PutMeRequest {
string display_name = 1;
string profile = 2;
string twitter_id = 3;
Expand Down
10 changes: 10 additions & 0 deletions proto/schema/users/schema/user_id/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package users.schema.user_id;

option go_package = "./";

// Request type for getting a user.
message GetUserRequest {
string user_id = 1; // Path parameter representing the user's ID
}
20 changes: 20 additions & 0 deletions proto/schema/users/schema/users/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package users.schema.users;

import "proto/schema/users/model/model.proto";
import "proto/third_party/google/api/wrappers.proto";

option go_package = "./";

message GetUsersRequest {
// Default value: 30
google.protobuf.Int32Value limit = 1;
string oldest_user_id = 2;
string newest_user_id = 3;
}

message GetUsersResponse {
repeated proto.schema.users.model.User users = 1;
}

Loading

0 comments on commit adf4154

Please sign in to comment.