From 2149ff83ade8f020ca952b11401d3cc89bc60694 Mon Sep 17 00:00:00 2001 From: daz-3ux Date: Mon, 16 Oct 2023 22:56:32 +0800 Subject: [PATCH] docs: update DB and api Signed-off-by: daz-3ux --- README.md | 3 + configs/dBlog.sql | 56 +++++++------ configs/dazBlog.yaml | 2 +- docs/devel/zh-CN/conversions/DB.md | 52 ++++++++++++ internal/dazBlog/biz/user/user.go | 22 +++-- internal/dazBlog/controller/v1/user/list.go | 2 + internal/pkg/model/post.go | 20 +++++ internal/pkg/model/user.go | 2 + pkg/api/dazBlog/v1/user.go | 18 +++-- pkg/proto/dazBlog/v1/dazBlog.pb.go | 89 +++++++++++++-------- pkg/proto/dazBlog/v1/dazBlog.proto | 10 ++- 11 files changed, 197 insertions(+), 79 deletions(-) create mode 100644 docs/devel/zh-CN/conversions/DB.md diff --git a/README.md b/README.md index ba783bc..ebf0d45 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,9 @@ docker run --network=host \ dazblog-image:latest ``` +#### 数据库配置 +[初始化数据库](./docs/devel/zh-CN/conversions/DB.md) + ## Documentation ### 实现功能 [openAPI文档](api/openapi/openapi.yaml) diff --git a/configs/dBlog.sql b/configs/dBlog.sql index 2c04993..6ac6b14 100644 --- a/configs/dBlog.sql +++ b/configs/dBlog.sql @@ -5,9 +5,9 @@ -- MariaDB dump 10.19-11.1.2-MariaDB, for Linux (x86_64) -- --- Host: 127.0.0.1 Database: dazBlog +-- Host: 127.0.0.1 Database: dazblog -- ------------------------------------------------------ --- Server version 11.1.2-MariaDB-1:11.1.2+maria~ubu2204 +-- Server version 10.11.5-MariaDB-1:10.11.5+maria~ubu2204 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -21,56 +21,60 @@ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- --- Current Database: `dazBlog` +-- Current Database: `dazblog` -- -/*!40000 DROP DATABASE IF EXISTS `dazBlog`*/; +/*!40000 DROP DATABASE IF EXISTS `dazblog`*/; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dazBlog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dazblog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */; -USE `dazBlog`; +USE `dazblog`; -- --- Table structure for table `posts` +-- Table structure for table `post` -- -DROP TABLE IF EXISTS `posts`; +DROP TABLE IF EXISTS `post`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `posts` ( +CREATE TABLE `post` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `username` varchar(255) NOT NULL, - `postID` varchar(255) NOT NULL, - `title` varchar(255) NOT NULL, - `content` text NOT NULL, + `username` varchar(30) NOT NULL, + `postID` varchar(100) NOT NULL, + `title` varchar(150) NOT NULL, + `content` longtext NOT NULL, `createdAt` timestamp NOT NULL DEFAULT current_timestamp(), `updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `postID` (`postID`), - UNIQUE KEY `title` (`title`), - KEY `username` (`username`) -) ENGINE=MyISAM AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; + KEY `idx_username` (`username`), + CONSTRAINT `fk_post_username` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `users` +-- Table structure for table `user` -- -DROP TABLE IF EXISTS `users`; +DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `users` ( +CREATE TABLE `user` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `username` varchar(255) NOT NULL, + `postcount` int(11) NOT NULL DEFAULT 0, + `username` varchar(30) NOT NULL, `password` varchar(255) NOT NULL, - `nickname` varchar(255) NOT NULL, - `email` varchar(255) NOT NULL, - `phone` varchar(16) NOT NULL, + `nickname` varchar(30) NOT NULL, + `email` varchar(320) NOT NULL, + `gender` enum('Male','Female','Other') DEFAULT NULL, + `phone` varchar(16) DEFAULT NULL, + `qq` varchar(16) DEFAULT NULL, `createdAt` timestamp NOT NULL DEFAULT current_timestamp(), `updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), - UNIQUE KEY `username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; + UNIQUE KEY `username` (`username`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -82,4 +86,4 @@ CREATE TABLE `users` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-09-26 21:08:37 +-- Dump completed on 2023-10-16 21:27:31 diff --git a/configs/dazBlog.yaml b/configs/dazBlog.yaml index c491124..71ee923 100644 --- a/configs/dazBlog.yaml +++ b/configs/dazBlog.yaml @@ -23,7 +23,7 @@ db: host: 127.0.0.1 username: root password: passwd - database: dazBlog + database: dazblog max-idle-connections: 100 max-open-connections: 100 max-connection-life-time: 10s diff --git a/docs/devel/zh-CN/conversions/DB.md b/docs/devel/zh-CN/conversions/DB.md new file mode 100644 index 0000000..5941be5 --- /dev/null +++ b/docs/devel/zh-CN/conversions/DB.md @@ -0,0 +1,52 @@ +# 为 dBlog 创建数据库 +- 使用 Docker + MariaDB 创建数据库 +- sqldump 数据相关详细信息查看: +[sql](/internal/pkg/model/README.md) + +### 创建数据库 +- 启动数据库实例 +```shell +docker run -p 3306:3306 --name dazblogDB -e MARIADB_ROOT_PASSWORD=passwd -d mariadb:lts +``` +- 初始化数据库 +```sql +CREATE DATABASE `dazblog`; +USE `dazblog`; +``` + +- 初始化用户表 +```sql +CREATE TABLE `user` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `postcount` int(11) NOT NULL DEFAULT '0', + `username` varchar(30) NOT NULL, + `password` varchar(255) NOT NULL, + `nickname` varchar(30) NOT NULL, + `email` varchar(320) NOT NULL, + `gender` ENUM('Male', 'Female', 'Other') DEFAULT NULL, + `phone` varchar(16), + `qq` varchar(16), + `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP(), + `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(), + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB, AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; +``` + +- 初始化博客表 +```sql +CREATE TABLE `post` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(30) NOT NULL, + `postID` varchar(100) NOT NULL, + `title` varchar(150) NOT NULL, + `content` longtext NOT NULL, + `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP(), + `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(), + PRIMARY KEY (`id`), + UNIQUE KEY `postID` (`postID`), + KEY `idx_username` (`username`), + CONSTRAINT fk_post_username FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE +)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; +``` diff --git a/internal/dazBlog/biz/user/user.go b/internal/dazBlog/biz/user/user.go index e88ef5d..fd91cd1 100644 --- a/internal/dazBlog/biz/user/user.go +++ b/internal/dazBlog/biz/user/user.go @@ -87,7 +87,7 @@ func (b *userBiz) Get(ctx context.Context, id string) (*v1.GetUserResponse, erro // List is the implementation of the `List` method of the UserBiz interface func (b *userBiz) List(ctx context.Context, offset, limit int) (*v1.ListUserResponse, error) { - count, list, err := b.ds.Users().List(ctx, offset, limit) + userCount, list, err := b.ds.Users().List(ctx, offset, limit) if err != nil { log.C(ctx).Errorw("failed to list users from storage", "err", err) return nil, err @@ -95,7 +95,7 @@ func (b *userBiz) List(ctx context.Context, offset, limit int) (*v1.ListUserResp users := make([]*v1.UserInfo, 0, len(list)) for _, user := range list { - count, _, err := b.ds.Posts().List(ctx, user.Username, 0, 0) + postCount, _, err := b.ds.Posts().List(ctx, user.Username, 0, 0) if err != nil { log.C(ctx).Errorw("Failed to list posts", "err", err) return nil, err @@ -105,16 +105,18 @@ func (b *userBiz) List(ctx context.Context, offset, limit int) (*v1.ListUserResp Username: user.Username, Nickname: user.Nickname, Email: user.Email, + Gender: user.Gender, Phone: user.Phone, - PostCount: count, + QQ: user.QQ, + PostCount: postCount, CreatedAt: user.CreatedAt.Format("2006-01-02 15:04:05"), UpdatedAt: user.UpdatedAt.Format("2006-01-02 15:04:05"), }) } - log.C(ctx).Debugw("Get users from storage", "count", count) + log.C(ctx).Debugw("Get users from storage", "count", userCount) - return &v1.ListUserResponse{TotalCount: count, Users: users}, nil + return &v1.ListUserResponse{TotalCount: userCount, Users: users}, nil } // Update is the implementation of the `Update` method of the UserBiz interface @@ -124,15 +126,21 @@ func (b *userBiz) Update(ctx context.Context, username string, user *v1.UpdateUs return err } + if *user.Nickname != "" { + userM.Nickname = *user.Nickname + } if *user.Email != "" { userM.Email = *user.Email } - if *user.Nickname != "" { - userM.Nickname = *user.Nickname + if *user.Gender != "" { + userM.Gender = *user.Gender } if *user.Phone != "" { userM.Phone = *user.Phone } + if *user.QQ != "" { + userM.QQ = *user.QQ + } if err := b.ds.Users().Update(ctx, userM); err != nil { return err diff --git a/internal/dazBlog/controller/v1/user/list.go b/internal/dazBlog/controller/v1/user/list.go index 1544a56..da40588 100644 --- a/internal/dazBlog/controller/v1/user/list.go +++ b/internal/dazBlog/controller/v1/user/list.go @@ -56,7 +56,9 @@ func (ctrl *UserController) ListUsers(ctx context.Context, r *pb.ListUsersReques Username: u.Username, Nickname: u.Nickname, Email: u.Email, + Gender: u.Gender, Phone: u.Phone, + Qq: u.QQ, Postcount: u.PostCount, CreatedAt: timestamppb.New(createdAt), UpdatedAt: timestamppb.New(updatedAt), diff --git a/internal/pkg/model/post.go b/internal/pkg/model/post.go index 22fff8c..7ee9fa4 100644 --- a/internal/pkg/model/post.go +++ b/internal/pkg/model/post.go @@ -6,6 +6,7 @@ package model import ( + "sync/atomic" "time" "gorm.io/gorm" @@ -33,3 +34,22 @@ func (p *PostM) BeforeCreate(tx *gorm.DB) error { return nil } + +func (p *PostM) AfterCreate(tx *gorm.DB) error { + if tx.Error != nil { + return tx.Error + } + + var user UserM + if err := tx.Where("username = ?", p.Username).First(&user).Error; err != nil { + return err + } + + atomic.AddInt64(&user.PostCount, 1) + + if err := tx.Save(&user).Error; err != nil { + return err + } + + return nil +} diff --git a/internal/pkg/model/user.go b/internal/pkg/model/user.go index 7f499d4..5af4eac 100644 --- a/internal/pkg/model/user.go +++ b/internal/pkg/model/user.go @@ -20,7 +20,9 @@ type UserM struct { Password string `gorm:"column:password"` // password of the user Nickname string `gorm:"column:nickname"` // nickname of the user Email string `gorm:"column:email"` // email of the user + Gender string `gorm:"column:gender"` // gender of the user Phone string `gorm:"column:phone"` // phone number of the user + QQ string `gorm:"column:qq"` // qq number of the user CreatedAt time.Time `gorm:"column:createdAt"` // time when the user was created UpdatedAt time.Time `gorm:"column:updatedAt"` // time when the user was updated } diff --git a/pkg/api/dazBlog/v1/user.go b/pkg/api/dazBlog/v1/user.go index 82d2e44..feb0333 100644 --- a/pkg/api/dazBlog/v1/user.go +++ b/pkg/api/dazBlog/v1/user.go @@ -8,25 +8,29 @@ package v1 // CreateUserRequest specifies the request parameters for // `POST /v1/users` type CreateUserRequest struct { - Postcount int64 `json:"postcount" valid:"required,stringlength(1|255)"` - Username string `json:"username" valid:"alphanum,required,stringlength(1|255)"` + Postcount int64 `json:"postcount" valid:"stringlength(1|255)"` + Username string `json:"username" valid:"alphanum,required,stringlength(1|30)"` Password string `json:"password" valid:"required,stringlength(6|18)"` - Nickname string `json:"nickname" valid:"required,stringlength(1|255)"` + Nickname string `json:"nickname" valid:"required,stringlength(1|30)"` Email string `json:"email" valid:"required,email"` + Gender string `json:"gender" valid:"required"` Phone string `json:"phone" valid:"required,numeric,stringlength(11|11)"` + QQ string `json:"qq" valid:"numeric,stringlength(5|16)"` } // GetUserResponse specifies the response parameters for // `GET /v1/users/{username}` type GetUserResponse UserInfo -// UserInfo is the user's all information +// UserInfo is the user's all information that can be listed type UserInfo struct { + PostCount int64 `json:"postcount"` Username string `json:"username"` Nickname string `json:"nickname"` Email string `json:"email"` + Gender string `json:"gender"` Phone string `json:"phone"` - PostCount int64 `json:"postcount"` + QQ string `json:"qq"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` } @@ -48,9 +52,11 @@ type ListUserResponse struct { // UpdateUserRequest specifies the request parameters for // `PUT /v1/users/{username}` type UpdateUserRequest struct { - Nickname *string `json:"nickname" valid:"required,stringlength(1|255)"` + Nickname *string `json:"nickname" valid:"stringlength(1|255)"` Email *string `json:"email" valid:"email"` + Gender *string `json:"gender" valid:"stringlength(1|10)"` Phone *string `json:"phone" valid:"numeric,stringlength(11|11)"` + QQ *string `json:"qq" valid:"numeric,stringlength(5|16)"` } // ChangePasswordRequest specifies the request parameters for diff --git a/pkg/proto/dazBlog/v1/dazBlog.pb.go b/pkg/proto/dazBlog/v1/dazBlog.pb.go index 59fe7d8..ccf63cf 100644 --- a/pkg/proto/dazBlog/v1/dazBlog.pb.go +++ b/pkg/proto/dazBlog/v1/dazBlog.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.26.0 // protoc v4.24.3 // source: dazBlog/v1/dazBlog.proto @@ -35,10 +35,12 @@ type UserInfo struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` - Postcount int64 `protobuf:"varint,5,opt,name=postcount,proto3" json:"postcount,omitempty"` - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` - UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` + Gender string `protobuf:"bytes,4,opt,name=gender,proto3" json:"gender,omitempty"` + Phone string `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"` + Qq string `protobuf:"bytes,6,opt,name=qq,proto3" json:"qq,omitempty"` + Postcount int64 `protobuf:"varint,7,opt,name=postcount,proto3" json:"postcount,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` } func (x *UserInfo) Reset() { @@ -94,6 +96,13 @@ func (x *UserInfo) GetEmail() string { return "" } +func (x *UserInfo) GetGender() string { + if x != nil { + return x.Gender + } + return "" +} + func (x *UserInfo) GetPhone() string { if x != nil { return x.Phone @@ -101,6 +110,13 @@ func (x *UserInfo) GetPhone() string { return "" } +func (x *UserInfo) GetQq() string { + if x != nil { + return x.Qq + } + return "" +} + func (x *UserInfo) GetPostcount() int64 { if x != nil { return x.Postcount @@ -241,40 +257,43 @@ var file_dazBlog_v1_dazBlog_proto_rawDesc = []byte{ 0x42, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x80, 0x02, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, + 0xa8, 0x02, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, - 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6f, 0x73, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x6f, 0x73, 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, - 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, - 0x41, 0x74, 0x22, 0x40, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x22, 0x57, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x75, 0x73, 0x65, - 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x32, 0x43, 0x0a, - 0x07, 0x44, 0x61, 0x7a, 0x42, 0x6c, 0x6f, 0x67, 0x12, 0x38, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x44, 0x61, 0x7a, 0x2d, 0x33, 0x75, 0x78, 0x2f, 0x64, 0x42, 0x6c, 0x6f, 0x67, 0x2f, 0x70, - 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x7a, 0x42, 0x6c, 0x6f, 0x67, - 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x71, 0x71, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x71, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6f, 0x73, 0x74, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x6f, 0x73, + 0x74, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x38, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x40, 0x0a, 0x10, 0x4c, 0x69, + 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x57, 0x0a, 0x11, + 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x22, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x32, 0x43, 0x0a, 0x07, 0x44, 0x61, 0x7a, 0x42, 0x6c, 0x6f, 0x67, + 0x12, 0x38, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x2e, + 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x61, 0x7a, 0x2d, 0x33, 0x75, 0x78, + 0x2f, 0x64, 0x42, 0x6c, 0x6f, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x64, 0x61, 0x7a, 0x42, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/proto/dazBlog/v1/dazBlog.proto b/pkg/proto/dazBlog/v1/dazBlog.proto index 0f59aca..aecb0a2 100644 --- a/pkg/proto/dazBlog/v1/dazBlog.proto +++ b/pkg/proto/dazBlog/v1/dazBlog.proto @@ -17,10 +17,12 @@ service DazBlog {rpc ListUsers(ListUsersRequest) returns (ListUsersResponse);} message UserInfo {string username = 1; string nickname = 2; string email = 3; - string phone = 4; - int64 postcount = 5; - google.protobuf.Timestamp createdAt = 6; - google.protobuf.Timestamp updatedAt = 7;} + string gender = 4; + string phone = 5; + string qq = 6; + int64 postcount = 7; + google.protobuf.Timestamp createdAt = 8; + google.protobuf.Timestamp updatedAt = 9;} // ListUserRequest specifies the request for `ListUser` endpoint message ListUsersRequest {int64 limit = 1;