add full auth

This commit is contained in:
2026-07-06 15:56:10 +07:00
parent 434627d61a
commit 6be4142487
14 changed files with 1512 additions and 50 deletions
+256 -41
View File
@@ -7,9 +7,11 @@
package proto
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
@@ -582,12 +584,184 @@ func (x *RefreshRsp) GetRefreshToken() string {
return ""
}
type GetUsersReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetUsersReq) Reset() {
*x = GetUsersReq{}
mi := &file_main_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetUsersReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUsersReq) ProtoMessage() {}
func (x *GetUsersReq) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUsersReq.ProtoReflect.Descriptor instead.
func (*GetUsersReq) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{12}
}
type GetUsersRsp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
Users []*User `protobuf:"bytes,2,rep,name=users,proto3" json:"users,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetUsersRsp) Reset() {
*x = GetUsersRsp{}
mi := &file_main_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetUsersRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUsersRsp) ProtoMessage() {}
func (x *GetUsersRsp) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUsersRsp.ProtoReflect.Descriptor instead.
func (*GetUsersRsp) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{13}
}
func (x *GetUsersRsp) GetError() string {
if x != nil {
return x.Error
}
return ""
}
func (x *GetUsersRsp) GetUsers() []*User {
if x != nil {
return x.Users
}
return nil
}
type User struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
Roles []string `protobuf:"bytes,4,rep,name=roles,proto3" json:"roles,omitempty"`
IsActive bool `protobuf:"varint,5,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"`
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *User) Reset() {
*x = User{}
mi := &file_main_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *User) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{14}
}
func (x *User) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *User) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *User) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *User) GetRoles() []string {
if x != nil {
return x.Roles
}
return nil
}
func (x *User) GetIsActive() bool {
if x != nil {
return x.IsActive
}
return false
}
func (x *User) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
var File_main_proto protoreflect.FileDescriptor
const file_main_proto_rawDesc = "" +
"\n" +
"\n" +
"main.proto\x12\x1ecrabs.evening_detective_server\x1a\x1cgoogle/api/annotations.proto\"\t\n" +
"main.proto\x12\x1ecrabs.evening_detective_server\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a.protoc-gen-openapiv2/options/annotations.proto\"\t\n" +
"\aPingReq\"\t\n" +
"\aPingRsp\"\x1d\n" +
"\aEchoReq\x12\x12\n" +
@@ -617,15 +791,48 @@ const file_main_proto_rawDesc = "" +
"RefreshRsp\x12\x14\n" +
"\x05error\x18\x01 \x01(\tR\x05error\x12 \n" +
"\vaccessToken\x18\x02 \x01(\tR\vaccessToken\x12\"\n" +
"\frefreshToken\x18\x03 \x01(\tR\frefreshToken2\xf8\x05\n" +
"\x16EveningDetectiveServer\x12k\n" +
"\x04Ping\x12'.crabs.evening_detective_server.PingReq\x1a'.crabs.evening_detective_server.PingRsp\"\x11\x82\xd3\xe4\x93\x02\v\x12\t/api/ping\x12k\n" +
"\x04Echo\x12'.crabs.evening_detective_server.EchoReq\x1a'.crabs.evening_detective_server.EchoRsp\"\x11\x82\xd3\xe4\x93\x02\v\"\t/api/echo\x12v\n" +
"\x06Signup\x12).crabs.evening_detective_server.SignupReq\x1a).crabs.evening_detective_server.SignupRsp\"\x16\x82\xd3\xe4\x93\x02\x10:\x01*\"\v/api/signup\x12\x9b\x01\n" +
"\x0fRefreshPassword\x122.crabs.evening_detective_server.RefreshPasswordReq\x1a2.crabs.evening_detective_server.RefreshPasswordRsp\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/refresh-password\x12r\n" +
"\x05Login\x12(.crabs.evening_detective_server.LoginReq\x1a(.crabs.evening_detective_server.LoginRsp\"\x15\x82\xd3\xe4\x93\x02\x0f:\x01*\"\n" +
"/api/login\x12z\n" +
"\aRefresh\x12*.crabs.evening_detective_server.RefreshReq\x1a*.crabs.evening_detective_server.RefreshRsp\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\"\f/api/refreshB\vZ\tpkg/protob\x06proto3"
"\frefreshToken\x18\x03 \x01(\tR\frefreshToken\"\r\n" +
"\vGetUsersReq\"_\n" +
"\vGetUsersRsp\x12\x14\n" +
"\x05error\x18\x01 \x01(\tR\x05error\x12:\n" +
"\x05users\x18\x02 \x03(\v2$.crabs.evening_detective_server.UserR\x05users\"\xb6\x01\n" +
"\x04User\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x05R\x02id\x12\x1a\n" +
"\busername\x18\x02 \x01(\tR\busername\x12\x14\n" +
"\x05email\x18\x03 \x01(\tR\x05email\x12\x14\n" +
"\x05roles\x18\x04 \x03(\tR\x05roles\x12\x1b\n" +
"\tis_active\x18\x05 \x01(\bR\bisActive\x129\n" +
"\n" +
"created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt2\xb6\a\n" +
"\x16EveningDetectiveServer\x12v\n" +
"\x04Ping\x12'.crabs.evening_detective_server.PingReq\x1a'.crabs.evening_detective_server.PingRsp\"\x1c\x92A\bb\x06\n" +
"\x04\n" +
"\x00\x12\x00\x82\xd3\xe4\x93\x02\v\x12\t/api/ping\x12v\n" +
"\x04Echo\x12'.crabs.evening_detective_server.EchoReq\x1a'.crabs.evening_detective_server.EchoRsp\"\x1c\x92A\bb\x06\n" +
"\x04\n" +
"\x00\x12\x00\x82\xd3\xe4\x93\x02\v\"\t/api/echo\x12\x81\x01\n" +
"\x06Signup\x12).crabs.evening_detective_server.SignupReq\x1a).crabs.evening_detective_server.SignupRsp\"!\x92A\bb\x06\n" +
"\x04\n" +
"\x00\x12\x00\x82\xd3\xe4\x93\x02\x10:\x01*\"\v/api/signup\x12\xa6\x01\n" +
"\x0fRefreshPassword\x122.crabs.evening_detective_server.RefreshPasswordReq\x1a2.crabs.evening_detective_server.RefreshPasswordRsp\"+\x92A\bb\x06\n" +
"\x04\n" +
"\x00\x12\x00\x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/refresh-password\x12}\n" +
"\x05Login\x12(.crabs.evening_detective_server.LoginReq\x1a(.crabs.evening_detective_server.LoginRsp\" \x92A\bb\x06\n" +
"\x04\n" +
"\x00\x12\x00\x82\xd3\xe4\x93\x02\x0f:\x01*\"\n" +
"/api/login\x12\x85\x01\n" +
"\aRefresh\x12*.crabs.evening_detective_server.RefreshReq\x1a*.crabs.evening_detective_server.RefreshRsp\"\"\x92A\bb\x06\n" +
"\x04\n" +
"\x00\x12\x00\x82\xd3\xe4\x93\x02\x11:\x01*\"\f/api/refresh\x12x\n" +
"\bGetUsers\x12+.crabs.evening_detective_server.GetUsersReq\x1a+.crabs.evening_detective_server.GetUsersRsp\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" +
"/api/usersB\xd7\x01\x92A\xc8\x01\x12U\n" +
"KДокументация сервиса \"Вечерний детектив\"2\x06v0.1.0Z]\n" +
"[\n" +
"\n" +
"BearerAuth\x12M\b\x02\x128Authentication token, prefixed by Bearer: Bearer <token>\x1a\rAuthorization \x02b\x10\n" +
"\x0e\n" +
"\n" +
"BearerAuth\x12\x00Z\tpkg/protob\x06proto3"
var (
file_main_proto_rawDescOnce sync.Once
@@ -639,39 +846,47 @@ func file_main_proto_rawDescGZIP() []byte {
return file_main_proto_rawDescData
}
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_main_proto_goTypes = []any{
(*PingReq)(nil), // 0: crabs.evening_detective_server.PingReq
(*PingRsp)(nil), // 1: crabs.evening_detective_server.PingRsp
(*EchoReq)(nil), // 2: crabs.evening_detective_server.EchoReq
(*EchoRsp)(nil), // 3: crabs.evening_detective_server.EchoRsp
(*SignupReq)(nil), // 4: crabs.evening_detective_server.SignupReq
(*SignupRsp)(nil), // 5: crabs.evening_detective_server.SignupRsp
(*RefreshPasswordReq)(nil), // 6: crabs.evening_detective_server.RefreshPasswordReq
(*RefreshPasswordRsp)(nil), // 7: crabs.evening_detective_server.RefreshPasswordRsp
(*LoginReq)(nil), // 8: crabs.evening_detective_server.LoginReq
(*LoginRsp)(nil), // 9: crabs.evening_detective_server.LoginRsp
(*RefreshReq)(nil), // 10: crabs.evening_detective_server.RefreshReq
(*RefreshRsp)(nil), // 11: crabs.evening_detective_server.RefreshRsp
(*PingReq)(nil), // 0: crabs.evening_detective_server.PingReq
(*PingRsp)(nil), // 1: crabs.evening_detective_server.PingRsp
(*EchoReq)(nil), // 2: crabs.evening_detective_server.EchoReq
(*EchoRsp)(nil), // 3: crabs.evening_detective_server.EchoRsp
(*SignupReq)(nil), // 4: crabs.evening_detective_server.SignupReq
(*SignupRsp)(nil), // 5: crabs.evening_detective_server.SignupRsp
(*RefreshPasswordReq)(nil), // 6: crabs.evening_detective_server.RefreshPasswordReq
(*RefreshPasswordRsp)(nil), // 7: crabs.evening_detective_server.RefreshPasswordRsp
(*LoginReq)(nil), // 8: crabs.evening_detective_server.LoginReq
(*LoginRsp)(nil), // 9: crabs.evening_detective_server.LoginRsp
(*RefreshReq)(nil), // 10: crabs.evening_detective_server.RefreshReq
(*RefreshRsp)(nil), // 11: crabs.evening_detective_server.RefreshRsp
(*GetUsersReq)(nil), // 12: crabs.evening_detective_server.GetUsersReq
(*GetUsersRsp)(nil), // 13: crabs.evening_detective_server.GetUsersRsp
(*User)(nil), // 14: crabs.evening_detective_server.User
(*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp
}
var file_main_proto_depIdxs = []int32{
0, // 0: crabs.evening_detective_server.EveningDetectiveServer.Ping:input_type -> crabs.evening_detective_server.PingReq
2, // 1: crabs.evening_detective_server.EveningDetectiveServer.Echo:input_type -> crabs.evening_detective_server.EchoReq
4, // 2: crabs.evening_detective_server.EveningDetectiveServer.Signup:input_type -> crabs.evening_detective_server.SignupReq
6, // 3: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:input_type -> crabs.evening_detective_server.RefreshPasswordReq
8, // 4: crabs.evening_detective_server.EveningDetectiveServer.Login:input_type -> crabs.evening_detective_server.LoginReq
10, // 5: crabs.evening_detective_server.EveningDetectiveServer.Refresh:input_type -> crabs.evening_detective_server.RefreshReq
1, // 6: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp
3, // 7: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp
5, // 8: crabs.evening_detective_server.EveningDetectiveServer.Signup:output_type -> crabs.evening_detective_server.SignupRsp
7, // 9: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:output_type -> crabs.evening_detective_server.RefreshPasswordRsp
9, // 10: crabs.evening_detective_server.EveningDetectiveServer.Login:output_type -> crabs.evening_detective_server.LoginRsp
11, // 11: crabs.evening_detective_server.EveningDetectiveServer.Refresh:output_type -> crabs.evening_detective_server.RefreshRsp
6, // [6:12] is the sub-list for method output_type
0, // [0:6] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
14, // 0: crabs.evening_detective_server.GetUsersRsp.users:type_name -> crabs.evening_detective_server.User
15, // 1: crabs.evening_detective_server.User.created_at:type_name -> google.protobuf.Timestamp
0, // 2: crabs.evening_detective_server.EveningDetectiveServer.Ping:input_type -> crabs.evening_detective_server.PingReq
2, // 3: crabs.evening_detective_server.EveningDetectiveServer.Echo:input_type -> crabs.evening_detective_server.EchoReq
4, // 4: crabs.evening_detective_server.EveningDetectiveServer.Signup:input_type -> crabs.evening_detective_server.SignupReq
6, // 5: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:input_type -> crabs.evening_detective_server.RefreshPasswordReq
8, // 6: crabs.evening_detective_server.EveningDetectiveServer.Login:input_type -> crabs.evening_detective_server.LoginReq
10, // 7: crabs.evening_detective_server.EveningDetectiveServer.Refresh:input_type -> crabs.evening_detective_server.RefreshReq
12, // 8: crabs.evening_detective_server.EveningDetectiveServer.GetUsers:input_type -> crabs.evening_detective_server.GetUsersReq
1, // 9: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp
3, // 10: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp
5, // 11: crabs.evening_detective_server.EveningDetectiveServer.Signup:output_type -> crabs.evening_detective_server.SignupRsp
7, // 12: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:output_type -> crabs.evening_detective_server.RefreshPasswordRsp
9, // 13: crabs.evening_detective_server.EveningDetectiveServer.Login:output_type -> crabs.evening_detective_server.LoginRsp
11, // 14: crabs.evening_detective_server.EveningDetectiveServer.Refresh:output_type -> crabs.evening_detective_server.RefreshRsp
13, // 15: crabs.evening_detective_server.EveningDetectiveServer.GetUsers:output_type -> crabs.evening_detective_server.GetUsersRsp
9, // [9:16] is the sub-list for method output_type
2, // [2:9] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_main_proto_init() }
@@ -685,7 +900,7 @@ func file_main_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_main_proto_rawDesc), len(file_main_proto_rawDesc)),
NumEnums: 0,
NumMessages: 12,
NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},