ft/adds additional endpoints and refactors others

New:
- GetAccount
- ListAccounts
- CreatePerson

Refactored:
- CreateAccount
- RefreshToken
- UpdateAccount
This commit is contained in:
itsscb 2023-10-06 00:18:53 +02:00
parent 0d812a0f24
commit 91903b9a2e
23 changed files with 1436 additions and 136 deletions

View File

@ -12,6 +12,8 @@ make backend
or run those commands, listed in ```Makefile```, ***manually*** with your terminal in the repository root directory.
**Important**: The docker commands were tested on *fedora*. On *Windows* some commands might differ or do not work at all. E. g. `make migrateup`.
That is due to the fact that on *Windows* the parameters `--privileged=true` and `--network host` do not exist or are handled differently.
# Prerequisites
@ -69,7 +71,21 @@ Should you want to make changes you need further tools.
- [sqlc](https://docs.sqlc.dev/en/stable/overview/install.html): For generating code from `postgres` queries
- [gomock](https://github.com/uber-go/mock): For generating a mock database for testing
- evans: For testing gRPC endpoints
- [evans](https://github.com/ktr0731/evans): For testing gRPC endpoints
- [protoc](https://grpc.io/docs/protoc-installation/): For generating code from `.proto`-files (gRPC)
- *plugins*:```
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
```
**Important**: If you install `protoc` on *fedora* you will need an additional package to make it work. Use the following command for setup:
```
sudo dnf install -y protobuf-compiler protobuf-devel
```
## Frontend

View File

@ -11,6 +11,7 @@ type Store interface {
CreateAccountTx(ctx context.Context, arg CreateAccountTxParams) (Account, error)
UpdateAccountTx(ctx context.Context, arg UpdateAccountTxParams) (Account, error)
UpdateAccountPrivacyTx(ctx context.Context, arg UpdateAccountPrivacyTxParams) (Account, error)
CreatePersonTx(ctx context.Context, arg CreatePersonTxParams) (Person, error)
}
// Store provides all functions to execute db queries and transactions

View File

@ -0,0 +1,37 @@
package db
import (
"context"
"time"
)
type CreatePersonTxParams struct {
AccountID int64 `json:"account_id"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Birthday time.Time `json:"birthday"`
City string `json:"city"`
Zip string `json:"zip"`
Street string `json:"street"`
Country string `json:"country"`
Creator string `json:"creator"`
Changer string `json:"changer"`
}
type CreatePersonTxResult struct {
Person Person `json:"person"`
}
func (store *SQLStore) CreatePersonTx(ctx context.Context, arg CreatePersonTxParams) (Person, error) {
var result CreatePersonTxResult
err := store.execTx(ctx, func(q *Queries) error {
var err error
result.Person, err = q.CreatePerson(ctx, CreatePersonParams(arg))
return err
})
return result.Person, err
}

View File

@ -97,6 +97,44 @@
]
}
},
"/v1/create_person": {
"post": {
"operationId": "df_CreatePerson",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/pbCreatePersonResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"description": "Create an Person",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pbCreatePersonRequest"
}
}
],
"tags": [
"df"
],
"security": [
{
"BearerAuth": []
}
]
}
},
"/v1/get_account": {
"get": {
"operationId": "df_GetAccount",
@ -518,6 +556,69 @@
"description": "Returns the created Account",
"title": "Created Account"
},
"pbCreatePersonRequest": {
"type": "object",
"example": {
"account_id": "1",
"firstname": "John",
"lastname": "Doe",
"street": "Main Street 1",
"zip": "0815",
"city": "New York",
"country": "USA",
"birthday": "1990-10-05T00:00:00Z"
},
"properties": {
"accountId": {
"type": "string",
"format": "int64"
},
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
},
"street": {
"type": "string"
},
"city": {
"type": "string"
},
"zip": {
"type": "string"
},
"country": {
"type": "string"
},
"birthday": {
"type": "string",
"format": "date-time",
"example": "1990-10-05T00:00:00Z"
}
},
"description": "Create an Person",
"title": "Create Person",
"required": [
"firstname",
"lastname",
"street",
"city",
"zip",
"country",
"birthday"
]
},
"pbCreatePersonResponse": {
"type": "object",
"properties": {
"person": {
"$ref": "#/definitions/pbPerson"
}
},
"description": "Returns the created Person",
"title": "Created Person"
},
"pbGetAccountResponse": {
"type": "object",
"properties": {
@ -599,6 +700,73 @@
},
"title": "Login Response"
},
"pbPerson": {
"type": "object",
"example": {
"id": "1",
"email": "john.doe@example.com",
"firstname": "John",
"lastname": "Doe",
"phone": "",
"street": "Death Star 2",
"zip": "0815",
"city": "New York",
"country": "USA",
"birthday": "1990-10-05T00:00:00Z",
"privacy_accepted": false,
"privacy_accepted_date": "0001-01-01T00:00:00Z",
"creator": "john.doe@example.com",
"created": "2023-10-05T02:30:53Z",
"changer": "john.doe@example.com",
"changed": "2023-10-05T02:30:53Z"
},
"properties": {
"accountId": {
"type": "string",
"format": "int64"
},
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
},
"street": {
"type": "string"
},
"city": {
"type": "string"
},
"zip": {
"type": "string"
},
"country": {
"type": "string"
},
"birthday": {
"type": "string",
"format": "date-time",
"example": "1990-10-05T00:00:00Z"
},
"creator": {
"type": "string"
},
"created": {
"type": "string",
"format": "date-time",
"example": "2023-10-05T00:00:00Z"
},
"changer": {
"type": "string"
},
"changed": {
"type": "string",
"format": "date-time",
"example": "2023-10-05T00:00:00Z"
}
},
"title": "Person"
},
"pbRefreshTokenRequest": {
"type": "object",
"example": {

View File

@ -48,7 +48,8 @@ func (server *Server) authorizeUser(ctx context.Context) (*token.Payload, error)
func (server *Server) isAdmin(ctx context.Context, payload *token.Payload) bool {
acc, err := server.store.GetAccountByEmail(ctx, payload.Email)
if err != nil {
fmt.Printf("could not verify admin: %#v", err)
return false
}
return acc.PermissionLevel < 1
return acc.PermissionLevel > 0
}

View File

@ -6,24 +6,41 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
)
func convertAccount(user db.Account) *pb.Account {
func convertAccount(account db.Account) *pb.Account {
return &pb.Account{
Id: user.ID,
PermissionLevel: user.PermissionLevel,
Email: user.Email,
Firstname: user.Firstname,
Lastname: user.Lastname,
City: user.City,
Street: user.Street,
Zip: user.Zip,
Country: user.Country,
Creator: user.Creator,
Changer: user.Changer,
PrivacyAccepted: user.PrivacyAccepted.Bool,
PrivacyAcceptedDate: timestamppb.New(user.PrivacyAcceptedDate.Time),
Birthday: timestamppb.New(user.Birthday),
Created: timestamppb.New(user.Created),
Changed: timestamppb.New(user.Changed),
Phone: user.Phone.String,
Id: account.ID,
PermissionLevel: account.PermissionLevel,
Email: account.Email,
Firstname: account.Firstname,
Lastname: account.Lastname,
City: account.City,
Street: account.Street,
Zip: account.Zip,
Country: account.Country,
Creator: account.Creator,
Changer: account.Changer,
PrivacyAccepted: account.PrivacyAccepted.Bool,
PrivacyAcceptedDate: timestamppb.New(account.PrivacyAcceptedDate.Time),
Birthday: timestamppb.New(account.Birthday),
Created: timestamppb.New(account.Created),
Changed: timestamppb.New(account.Changed),
Phone: account.Phone.String,
}
}
func convertPerson(person db.Person) *pb.Person {
return &pb.Person{
AccountId: person.AccountID,
Firstname: person.Firstname,
Lastname: person.Lastname,
Street: person.Street,
Country: person.Country,
Zip: person.Zip,
Creator: person.Creator,
Changer: person.Changer,
City: person.City,
Birthday: timestamppb.New(person.Birthday),
Created: timestamppb.New(person.Created),
Changed: timestamppb.New(person.Changed),
}
}

View File

@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"errors"
"log"
db "github.com/itsscb/df/bff/db/sqlc"
"github.com/itsscb/df/bff/pb"
@ -65,7 +64,6 @@ func validateCreateAccountRequest(req *pb.CreateAccountRequest) (violations []*e
}
if err := val.ValidatePassword(req.GetPassword()); err != nil {
log.Println(req.GetPassword(), len(req.GetPassword()))
violations = append(violations, fieldViolation("password", err))
}

View File

@ -0,0 +1,92 @@
package gapi
import (
"context"
"errors"
db "github.com/itsscb/df/bff/db/sqlc"
"github.com/itsscb/df/bff/pb"
"github.com/itsscb/df/bff/val"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (server *Server) CreatePerson(ctx context.Context, req *pb.CreatePersonRequest) (*pb.CreatePersonResponse, error) {
authPayload, err := server.authorizeUser(ctx)
if err != nil {
return nil, unauthenticatedError(err)
}
violations := validateCreatePersonRequest(req)
if violations != nil {
return nil, invalidArgumentError(violations)
}
account, err := server.store.GetAccount(ctx, req.GetAccountId())
if err != nil {
return nil, status.Error(codes.NotFound, "failed to get account")
}
if authPayload.Email != account.Email {
if !server.isAdmin(ctx, authPayload) {
return nil, status.Error(codes.NotFound, "account not found")
}
}
arg := db.CreatePersonTxParams{
AccountID: req.GetAccountId(),
Firstname: req.GetFirstname(),
Lastname: req.GetLastname(),
Birthday: req.GetBirthday().AsTime(),
City: req.GetCity(),
Street: req.GetStreet(),
Country: req.GetCountry(),
Zip: req.GetZip(),
Creator: authPayload.Email,
Changer: authPayload.Email,
}
person, err := server.store.CreatePersonTx(ctx, arg)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to create person: %s", err)
}
rsp := &pb.CreatePersonResponse{
Person: convertPerson(person),
}
return rsp, nil
}
func validateCreatePersonRequest(req *pb.CreatePersonRequest) (violations []*errdetails.BadRequest_FieldViolation) {
if req.GetAccountId() < 1 {
violations = append(violations, fieldViolation("account_id", errors.New("must be greater than 0")))
}
if err := val.ValidateName(req.GetFirstname()); err != nil {
violations = append(violations, fieldViolation("first_name", err))
}
if err := val.ValidateName(req.GetLastname()); err != nil {
violations = append(violations, fieldViolation("last_name", err))
}
if err := val.ValidateAlphaSpace(req.GetCity()); err != nil {
violations = append(violations, fieldViolation("city", err))
}
if err := val.ValidateStreet(req.GetStreet()); err != nil {
violations = append(violations, fieldViolation("street", err))
}
if err := val.ValidateAlphaSpace(req.GetCountry()); err != nil {
violations = append(violations, fieldViolation("country", err))
}
if len(req.GetZip()) < 4 {
violations = append(violations, fieldViolation("zip", errors.New("must be at least 4 characters long")))
}
return violations
}

View File

@ -0,0 +1,48 @@
package gapi
import (
"context"
"errors"
"github.com/itsscb/df/bff/pb"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (server *Server) GetAccount(ctx context.Context, req *pb.GetAccountRequest) (*pb.GetAccountResponse, error) {
authPayload, err := server.authorizeUser(ctx)
if err != nil {
return nil, unauthenticatedError(err)
}
violations := validateGetAccountRequest(req)
if violations != nil {
return nil, invalidArgumentError(violations)
}
account, err := server.store.GetAccount(ctx, req.GetId())
if err != nil {
return nil, status.Error(codes.NotFound, "failed to get account")
}
if authPayload.Email != account.Email {
if !server.isAdmin(ctx, authPayload) {
return nil, status.Error(codes.NotFound, "account not found")
}
}
rsp := &pb.GetAccountResponse{
Account: convertAccount(account),
}
return rsp, nil
}
func validateGetAccountRequest(req *pb.GetAccountRequest) (violations []*errdetails.BadRequest_FieldViolation) {
if req.GetId() < 1 {
violations = append(violations, fieldViolation("id", errors.New("must be greater than 0")))
}
return violations
}

View File

@ -0,0 +1,61 @@
package gapi
import (
"context"
"errors"
db "github.com/itsscb/df/bff/db/sqlc"
"github.com/itsscb/df/bff/pb"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (server *Server) ListAccounts(ctx context.Context, req *pb.ListAccountsRequest) (*pb.ListAccountsResponse, error) {
authPayload, err := server.authorizeUser(ctx)
if err != nil {
return nil, unauthenticatedError(err)
}
violations := validateListAccountsRequest(req)
if violations != nil {
return nil, invalidArgumentError(violations)
}
arg := db.ListAccountsParams{
Limit: req.GetPageSize(),
Offset: (req.GetPageId() - 1) * req.GetPageSize(),
}
dbAccounts, err := server.store.ListAccounts(ctx, arg)
if err != nil {
return nil, status.Error(codes.NotFound, "failed to get account")
}
if !server.isAdmin(ctx, authPayload) {
return nil, status.Error(codes.PermissionDenied, "only for administrators")
}
var accounts []*pb.Account
for _, a := range dbAccounts {
accounts = append(accounts, convertAccount(a))
}
rsp := &pb.ListAccountsResponse{
Account: accounts,
}
return rsp, nil
}
func validateListAccountsRequest(req *pb.ListAccountsRequest) (violations []*errdetails.BadRequest_FieldViolation) {
if req.GetPageId() < 1 {
violations = append(violations, fieldViolation("page_id", errors.New("must be greater than 0")))
}
if req.GetPageSize() < 5 || req.GetPageId() > 50 {
violations = append(violations, fieldViolation("page_size", errors.New("must be between 5 and 50")))
}
return violations
}

View File

@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"errors"
"log"
"time"
"github.com/itsscb/df/bff/pb"
@ -21,7 +20,6 @@ func (server *Server) RefreshToken(ctx context.Context, req *pb.RefreshTokenRequ
return nil, invalidArgumentError(violations)
}
log.Println(req.GetRefreshToken(), len(req.GetRefreshToken()))
refreshPayload, err := server.tokenMaker.VerifyToken(req.GetRefreshToken())
if err != nil {
return nil, status.Error(codes.PermissionDenied, "invalid session token")

View File

@ -3,6 +3,7 @@ package gapi
import (
"context"
"database/sql"
"errors"
db "github.com/itsscb/df/bff/db/sqlc"
"github.com/itsscb/df/bff/pb"
@ -24,7 +25,7 @@ func (server *Server) UpdateAccount(ctx context.Context, req *pb.UpdateAccountRe
return nil, invalidArgumentError(violations)
}
if authPayload.Email != req.GetEmail() {
if authPayload.Email != req.GetEmail() && !server.isAdmin(ctx, authPayload) {
if !server.isAdmin(ctx, authPayload) {
return nil, status.Error(codes.NotFound, "account not found")
}
@ -96,6 +97,10 @@ func (server *Server) UpdateAccount(ctx context.Context, req *pb.UpdateAccountRe
}
func validateUpdateAccountRequest(req *pb.UpdateAccountRequest) (violations []*errdetails.BadRequest_FieldViolation) {
if req.GetId() < 1 {
violations = append(violations, fieldViolation("id", errors.New("must be greater than 0")))
}
if req.GetEmail() != "" {
if err := val.ValidateEmail(req.GetEmail()); err != nil {
violations = append(violations, fieldViolation("email", err))

View File

@ -79,7 +79,8 @@ func runGatewayServer(config util.Config, store db.Store, swaggerFS http.FileSys
jsonOption := runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{
MarshalOptions: protojson.MarshalOptions{
UseProtoNames: true,
UseProtoNames: true,
EmitUnpopulated: true,
},
UnmarshalOptions: protojson.UnmarshalOptions{
DiscardUnknown: true,

297
bff/pb/person.pb.go Normal file
View File

@ -0,0 +1,297 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v3.19.6
// source: person.proto
package pb
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
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"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Person struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
AccountId int64 `protobuf:"varint,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`
Firstname string `protobuf:"bytes,3,opt,name=firstname,proto3" json:"firstname,omitempty"`
Lastname string `protobuf:"bytes,4,opt,name=lastname,proto3" json:"lastname,omitempty"`
Street string `protobuf:"bytes,5,opt,name=street,proto3" json:"street,omitempty"`
City string `protobuf:"bytes,6,opt,name=city,proto3" json:"city,omitempty"`
Zip string `protobuf:"bytes,7,opt,name=zip,proto3" json:"zip,omitempty"`
Country string `protobuf:"bytes,8,opt,name=country,proto3" json:"country,omitempty"`
Birthday *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=birthday,proto3" json:"birthday,omitempty"`
Creator string `protobuf:"bytes,10,opt,name=creator,proto3" json:"creator,omitempty"`
Created *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=created,proto3" json:"created,omitempty"`
Changer string `protobuf:"bytes,12,opt,name=changer,proto3" json:"changer,omitempty"`
Changed *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=changed,proto3" json:"changed,omitempty"`
}
func (x *Person) Reset() {
*x = Person{}
if protoimpl.UnsafeEnabled {
mi := &file_person_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Person) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Person) ProtoMessage() {}
func (x *Person) ProtoReflect() protoreflect.Message {
mi := &file_person_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Person.ProtoReflect.Descriptor instead.
func (*Person) Descriptor() ([]byte, []int) {
return file_person_proto_rawDescGZIP(), []int{0}
}
func (x *Person) GetAccountId() int64 {
if x != nil {
return x.AccountId
}
return 0
}
func (x *Person) GetFirstname() string {
if x != nil {
return x.Firstname
}
return ""
}
func (x *Person) GetLastname() string {
if x != nil {
return x.Lastname
}
return ""
}
func (x *Person) GetStreet() string {
if x != nil {
return x.Street
}
return ""
}
func (x *Person) GetCity() string {
if x != nil {
return x.City
}
return ""
}
func (x *Person) GetZip() string {
if x != nil {
return x.Zip
}
return ""
}
func (x *Person) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *Person) GetBirthday() *timestamppb.Timestamp {
if x != nil {
return x.Birthday
}
return nil
}
func (x *Person) GetCreator() string {
if x != nil {
return x.Creator
}
return ""
}
func (x *Person) GetCreated() *timestamppb.Timestamp {
if x != nil {
return x.Created
}
return nil
}
func (x *Person) GetChanger() string {
if x != nil {
return x.Changer
}
return ""
}
func (x *Person) GetChanged() *timestamppb.Timestamp {
if x != nil {
return x.Changed
}
return nil
}
var File_person_proto protoreflect.FileDescriptor
var file_person_proto_rawDesc = []byte{
0x0a, 0x0c, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02,
0x70, 0x62, 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, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d,
0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xa7, 0x07, 0x0a, 0x06, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x1d,
0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x03, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a,
0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c,
0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c,
0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x65,
0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x12,
0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63,
0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x69, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x7a, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79,
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x53, 0x0a, 0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 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, 0x42, 0x1b, 0x92,
0x41, 0x18, 0x4a, 0x16, 0x22, 0x31, 0x39, 0x39, 0x30, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x54,
0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x22, 0x52, 0x08, 0x62, 0x69, 0x72, 0x74,
0x68, 0x64, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18,
0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x51,
0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 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, 0x42, 0x1b, 0x92, 0x41, 0x18,
0x4a, 0x16, 0x22, 0x32, 0x30, 0x32, 0x33, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x54, 0x30, 0x30,
0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x22, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x07, 0x63,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x18, 0x0d, 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, 0x42, 0x1b, 0x92, 0x41, 0x18, 0x4a, 0x16, 0x22,
0x32, 0x30, 0x32, 0x33, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30,
0x3a, 0x30, 0x30, 0x5a, 0x22, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x3a, 0xbc,
0x03, 0x92, 0x41, 0xb8, 0x03, 0x0a, 0x08, 0x2a, 0x06, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x32,
0xab, 0x03, 0x7b, 0x22, 0x69, 0x64, 0x22, 0x3a, 0x20, 0x22, 0x31, 0x22, 0x2c, 0x22, 0x65, 0x6d,
0x61, 0x69, 0x6c, 0x22, 0x3a, 0x20, 0x22, 0x6a, 0x6f, 0x68, 0x6e, 0x2e, 0x64, 0x6f, 0x65, 0x40,
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x22, 0x2c, 0x20, 0x22, 0x66,
0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x4a, 0x6f, 0x68, 0x6e,
0x22, 0x2c, 0x20, 0x22, 0x6c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, 0x22,
0x44, 0x6f, 0x65, 0x22, 0x2c, 0x20, 0x22, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x3a, 0x20, 0x22,
0x22, 0x2c, 0x20, 0x22, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x44, 0x65,
0x61, 0x74, 0x68, 0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x32, 0x22, 0x2c, 0x20, 0x22, 0x7a, 0x69,
0x70, 0x22, 0x3a, 0x20, 0x22, 0x30, 0x38, 0x31, 0x35, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x69, 0x74,
0x79, 0x22, 0x3a, 0x20, 0x22, 0x4e, 0x65, 0x77, 0x20, 0x59, 0x6f, 0x72, 0x6b, 0x22, 0x2c, 0x20,
0x22, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x3a, 0x20, 0x22, 0x55, 0x53, 0x41, 0x22,
0x2c, 0x20, 0x22, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x22, 0x3a, 0x20, 0x22, 0x31,
0x39, 0x39, 0x30, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a,
0x30, 0x30, 0x5a, 0x22, 0x2c, 0x20, 0x22, 0x70, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x5f, 0x61,
0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c,
0x20, 0x22, 0x70, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74,
0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x30, 0x30, 0x30, 0x31, 0x2d,
0x30, 0x31, 0x2d, 0x30, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x22,
0x2c, 0x20, 0x22, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x3a, 0x20, 0x22, 0x6a, 0x6f,
0x68, 0x6e, 0x2e, 0x64, 0x6f, 0x65, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63,
0x6f, 0x6d, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x3a, 0x20,
0x22, 0x32, 0x30, 0x32, 0x33, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x54, 0x30, 0x32, 0x3a, 0x33,
0x30, 0x3a, 0x35, 0x33, 0x5a, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x72,
0x22, 0x3a, 0x20, 0x22, 0x6a, 0x6f, 0x68, 0x6e, 0x2e, 0x64, 0x6f, 0x65, 0x40, 0x65, 0x78, 0x61,
0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x22, 0x32, 0x30, 0x32, 0x33, 0x2d, 0x31, 0x30, 0x2d, 0x30,
0x35, 0x54, 0x30, 0x32, 0x3a, 0x33, 0x30, 0x3a, 0x35, 0x33, 0x5a, 0x22, 0x7d, 0x42, 0x19, 0x5a,
0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73, 0x73,
0x63, 0x62, 0x2f, 0x64, 0x66, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_person_proto_rawDescOnce sync.Once
file_person_proto_rawDescData = file_person_proto_rawDesc
)
func file_person_proto_rawDescGZIP() []byte {
file_person_proto_rawDescOnce.Do(func() {
file_person_proto_rawDescData = protoimpl.X.CompressGZIP(file_person_proto_rawDescData)
})
return file_person_proto_rawDescData
}
var file_person_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_person_proto_goTypes = []interface{}{
(*Person)(nil), // 0: pb.Person
(*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp
}
var file_person_proto_depIdxs = []int32{
1, // 0: pb.Person.birthday:type_name -> google.protobuf.Timestamp
1, // 1: pb.Person.created:type_name -> google.protobuf.Timestamp
1, // 2: pb.Person.changed:type_name -> google.protobuf.Timestamp
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_person_proto_init() }
func file_person_proto_init() {
if File_person_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_person_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Person); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_person_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_person_proto_goTypes,
DependencyIndexes: file_person_proto_depIdxs,
MessageInfos: file_person_proto_msgTypes,
}.Build()
File_person_proto = out.File
file_person_proto_rawDesc = nil
file_person_proto_goTypes = nil
file_person_proto_depIdxs = nil
}

View File

@ -0,0 +1,312 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v3.19.6
// source: rpc_create_person.proto
package pb
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
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"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CreatePersonRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
AccountId int64 `protobuf:"varint,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`
Firstname string `protobuf:"bytes,2,opt,name=firstname,proto3" json:"firstname,omitempty"`
Lastname string `protobuf:"bytes,3,opt,name=lastname,proto3" json:"lastname,omitempty"`
Street string `protobuf:"bytes,4,opt,name=street,proto3" json:"street,omitempty"`
City string `protobuf:"bytes,5,opt,name=city,proto3" json:"city,omitempty"`
Zip string `protobuf:"bytes,6,opt,name=zip,proto3" json:"zip,omitempty"`
Country string `protobuf:"bytes,7,opt,name=country,proto3" json:"country,omitempty"`
Birthday *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=birthday,proto3" json:"birthday,omitempty"`
}
func (x *CreatePersonRequest) Reset() {
*x = CreatePersonRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_create_person_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreatePersonRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreatePersonRequest) ProtoMessage() {}
func (x *CreatePersonRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_create_person_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreatePersonRequest.ProtoReflect.Descriptor instead.
func (*CreatePersonRequest) Descriptor() ([]byte, []int) {
return file_rpc_create_person_proto_rawDescGZIP(), []int{0}
}
func (x *CreatePersonRequest) GetAccountId() int64 {
if x != nil {
return x.AccountId
}
return 0
}
func (x *CreatePersonRequest) GetFirstname() string {
if x != nil {
return x.Firstname
}
return ""
}
func (x *CreatePersonRequest) GetLastname() string {
if x != nil {
return x.Lastname
}
return ""
}
func (x *CreatePersonRequest) GetStreet() string {
if x != nil {
return x.Street
}
return ""
}
func (x *CreatePersonRequest) GetCity() string {
if x != nil {
return x.City
}
return ""
}
func (x *CreatePersonRequest) GetZip() string {
if x != nil {
return x.Zip
}
return ""
}
func (x *CreatePersonRequest) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *CreatePersonRequest) GetBirthday() *timestamppb.Timestamp {
if x != nil {
return x.Birthday
}
return nil
}
type CreatePersonResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Person *Person `protobuf:"bytes,1,opt,name=person,proto3" json:"person,omitempty"`
}
func (x *CreatePersonResponse) Reset() {
*x = CreatePersonResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_create_person_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreatePersonResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreatePersonResponse) ProtoMessage() {}
func (x *CreatePersonResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_create_person_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreatePersonResponse.ProtoReflect.Descriptor instead.
func (*CreatePersonResponse) Descriptor() ([]byte, []int) {
return file_rpc_create_person_proto_rawDescGZIP(), []int{1}
}
func (x *CreatePersonResponse) GetPerson() *Person {
if x != nil {
return x.Person
}
return nil
}
var File_rpc_create_person_proto protoreflect.FileDescriptor
var file_rpc_create_person_proto_rawDesc = []byte{
0x0a, 0x17, 0x72, 0x70, 0x63, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x65, 0x72,
0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 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, 0x1a, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61,
0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c,
0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x04, 0x0a,
0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d,
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
0x74, 0x72, 0x65, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x69, 0x70,
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x7a, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x53, 0x0a, 0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61,
0x79, 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, 0x42, 0x1b, 0x92, 0x41, 0x18, 0x4a, 0x16, 0x22, 0x31, 0x39, 0x39, 0x30, 0x2d,
0x31, 0x30, 0x2d, 0x30, 0x35, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x22,
0x52, 0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x3a, 0x9c, 0x02, 0x92, 0x41, 0x98,
0x02, 0x0a, 0x63, 0x2a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x50, 0x65, 0x72, 0x73,
0x6f, 0x6e, 0x32, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x50, 0x65,
0x72, 0x73, 0x6f, 0x6e, 0xd2, 0x01, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
0xd2, 0x01, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x06, 0x73, 0x74,
0x72, 0x65, 0x65, 0x74, 0xd2, 0x01, 0x04, 0x63, 0x69, 0x74, 0x79, 0xd2, 0x01, 0x03, 0x7a, 0x69,
0x70, 0xd2, 0x01, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0xd2, 0x01, 0x08, 0x62, 0x69,
0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x32, 0xb0, 0x01, 0x7b, 0x20, 0x22, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x3a, 0x20, 0x22, 0x31, 0x22, 0x2c, 0x20, 0x22, 0x66,
0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x4a, 0x6f, 0x68, 0x6e,
0x22, 0x2c, 0x20, 0x22, 0x6c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, 0x22,
0x44, 0x6f, 0x65, 0x22, 0x2c, 0x20, 0x22, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x22, 0x3a, 0x20,
0x22, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x20, 0x31, 0x22, 0x2c,
0x20, 0x22, 0x7a, 0x69, 0x70, 0x22, 0x3a, 0x20, 0x22, 0x30, 0x38, 0x31, 0x35, 0x22, 0x2c, 0x20,
0x22, 0x63, 0x69, 0x74, 0x79, 0x22, 0x3a, 0x20, 0x22, 0x4e, 0x65, 0x77, 0x20, 0x59, 0x6f, 0x72,
0x6b, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x3a, 0x20, 0x22,
0x55, 0x53, 0x41, 0x22, 0x2c, 0x20, 0x22, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x22,
0x3a, 0x20, 0x22, 0x31, 0x39, 0x39, 0x30, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x54, 0x30, 0x30,
0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x22, 0x7d, 0x22, 0x72, 0x0a, 0x14, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x27, 0x0a, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x42, 0x03, 0x92,
0x41, 0x00, 0x52, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x3a, 0x31, 0x92, 0x41, 0x2e, 0x0a,
0x2c, 0x2a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x73, 0x6f,
0x6e, 0x32, 0x1a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x42, 0x19, 0x5a,
0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73, 0x73,
0x63, 0x62, 0x2f, 0x64, 0x66, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_rpc_create_person_proto_rawDescOnce sync.Once
file_rpc_create_person_proto_rawDescData = file_rpc_create_person_proto_rawDesc
)
func file_rpc_create_person_proto_rawDescGZIP() []byte {
file_rpc_create_person_proto_rawDescOnce.Do(func() {
file_rpc_create_person_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_create_person_proto_rawDescData)
})
return file_rpc_create_person_proto_rawDescData
}
var file_rpc_create_person_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_rpc_create_person_proto_goTypes = []interface{}{
(*CreatePersonRequest)(nil), // 0: pb.CreatePersonRequest
(*CreatePersonResponse)(nil), // 1: pb.CreatePersonResponse
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
(*Person)(nil), // 3: pb.Person
}
var file_rpc_create_person_proto_depIdxs = []int32{
2, // 0: pb.CreatePersonRequest.birthday:type_name -> google.protobuf.Timestamp
3, // 1: pb.CreatePersonResponse.person:type_name -> pb.Person
2, // [2:2] is the sub-list for method output_type
2, // [2:2] 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_rpc_create_person_proto_init() }
func file_rpc_create_person_proto_init() {
if File_rpc_create_person_proto != nil {
return
}
file_person_proto_init()
if !protoimpl.UnsafeEnabled {
file_rpc_create_person_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreatePersonRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_create_person_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreatePersonResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_create_person_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_rpc_create_person_proto_goTypes,
DependencyIndexes: file_rpc_create_person_proto_depIdxs,
MessageInfos: file_rpc_create_person_proto_msgTypes,
}.Build()
File_rpc_create_person_proto = out.File
file_rpc_create_person_proto_rawDesc = nil
file_rpc_create_person_proto_goTypes = nil
file_rpc_create_person_proto_depIdxs = nil
}

View File

@ -31,86 +31,95 @@ var file_service_df_proto_rawDesc = []byte{
0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x72, 0x70, 0x63, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18,
0x72, 0x70, 0x63, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x70, 0x63, 0x5f, 0x67, 0x65,
0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x17, 0x72, 0x70, 0x63, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x72, 0x70, 0x63, 0x5f, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x20, 0x72, 0x70, 0x63, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x70, 0x63, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x72, 0x70, 0x63, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xfd, 0x06,
0x0a, 0x02, 0x64, 0x66, 0x12, 0x42, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x2e,
0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x01, 0x2a, 0x22, 0x09, 0x2f,
0x76, 0x31, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x5f, 0x0a, 0x0c, 0x52, 0x65, 0x66, 0x72,
0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65,
0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x66, 0x72,
0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x74, 0x0a, 0x0c, 0x42, 0x6c, 0x6f,
0x63, 0x6b, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x92, 0x41,
0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74,
0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x32, 0x11, 0x2f, 0x76,
0x31, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12,
0x69, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x15, 0x2e,
0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x92, 0x41,
0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74,
0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x67,
0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x71, 0x0a, 0x0c, 0x4c, 0x69,
0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x92,
0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75,
0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f,
0x6c, 0x69, 0x73, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x63, 0x0a,
0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18,
0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12,
0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x78, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a,
0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x32, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70,
0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x95, 0x01, 0x0a,
0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72,
0x69, 0x76, 0x61, 0x63, 0x79, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a,
0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x32, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70,
0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x69,
0x76, 0x61, 0x63, 0x79, 0x1a, 0x07, 0x92, 0x41, 0x04, 0x12, 0x02, 0x64, 0x66, 0x42, 0xb0, 0x01,
0x92, 0x41, 0x93, 0x01, 0x12, 0x44, 0x0a, 0x06, 0x64, 0x66, 0x20, 0x41, 0x50, 0x49, 0x22, 0x35,
0x0a, 0x06, 0x69, 0x74, 0x73, 0x73, 0x63, 0x62, 0x12, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a,
0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73,
0x73, 0x63, 0x62, 0x2f, 0x64, 0x66, 0x1a, 0x0d, 0x64, 0x65, 0x76, 0x40, 0x69, 0x74, 0x73, 0x73,
0x63, 0x62, 0x2e, 0x64, 0x65, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10,
0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e,
0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73,
0x6f, 0x6e, 0x5a, 0x23, 0x0a, 0x21, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75,
0x74, 0x68, 0x12, 0x13, 0x08, 0x02, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x5a, 0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73, 0x73, 0x63, 0x62, 0x2f, 0x64, 0x66, 0x2f, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17,
0x72, 0x70, 0x63, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f,
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x72, 0x70, 0x63, 0x5f, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x15, 0x72, 0x70, 0x63, 0x5f, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x72, 0x70, 0x63, 0x5f, 0x6c, 0x69,
0x73, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x17, 0x72, 0x70, 0x63, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x72, 0x70, 0x63, 0x5f,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70,
0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x70,
0x63, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x72,
0x70, 0x63, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf3, 0x07, 0x0a, 0x02, 0x64, 0x66, 0x12, 0x42, 0x0a,
0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x0e, 0x3a, 0x01, 0x2a, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x6f, 0x67, 0x69,
0x6e, 0x12, 0x5f, 0x0a, 0x0c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e,
0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22,
0x11, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b,
0x65, 0x6e, 0x12, 0x74, 0x0a, 0x0c, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62,
0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a,
0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x16, 0x3a, 0x01, 0x2a, 0x32, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x69, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a,
0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x71, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70,
0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a,
0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x78, 0x0a, 0x0d, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x70,
0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x32, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72,
0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01,
0x2a, 0x32, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x95, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x12, 0x1f,
0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x3a, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72,
0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01,
0x2a, 0x32, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x12, 0x74, 0x0a,
0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x2e,
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x31, 0x92, 0x41, 0x12, 0x62, 0x10, 0x0a, 0x0e, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65,
0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a,
0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x65, 0x72,
0x73, 0x6f, 0x6e, 0x1a, 0x07, 0x92, 0x41, 0x04, 0x12, 0x02, 0x64, 0x66, 0x42, 0xb0, 0x01, 0x92,
0x41, 0x93, 0x01, 0x12, 0x44, 0x0a, 0x06, 0x64, 0x66, 0x20, 0x41, 0x50, 0x49, 0x22, 0x35, 0x0a,
0x06, 0x69, 0x74, 0x73, 0x73, 0x63, 0x62, 0x12, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f,
0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73, 0x73,
0x63, 0x62, 0x2f, 0x64, 0x66, 0x1a, 0x0d, 0x64, 0x65, 0x76, 0x40, 0x69, 0x74, 0x73, 0x73, 0x63,
0x62, 0x2e, 0x64, 0x65, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61,
0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a,
0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f,
0x6e, 0x5a, 0x23, 0x0a, 0x21, 0x0a, 0x0a, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x41, 0x75, 0x74,
0x68, 0x12, 0x13, 0x08, 0x02, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x5a, 0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73, 0x73, 0x63, 0x62, 0x2f, 0x64, 0x66, 0x2f, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_service_df_proto_goTypes = []interface{}{
@ -122,14 +131,16 @@ var file_service_df_proto_goTypes = []interface{}{
(*CreateAccountRequest)(nil), // 5: pb.CreateAccountRequest
(*UpdateAccountRequest)(nil), // 6: pb.UpdateAccountRequest
(*UpdateAccountPrivacyRequest)(nil), // 7: pb.UpdateAccountPrivacyRequest
(*LoginResponse)(nil), // 8: pb.LoginResponse
(*RefreshTokenResponse)(nil), // 9: pb.RefreshTokenResponse
(*BlockSessionResponse)(nil), // 10: pb.BlockSessionResponse
(*GetAccountResponse)(nil), // 11: pb.GetAccountResponse
(*ListAccountsResponse)(nil), // 12: pb.ListAccountsResponse
(*CreateAccountResponse)(nil), // 13: pb.CreateAccountResponse
(*UpdateAccountResponse)(nil), // 14: pb.UpdateAccountResponse
(*UpdateAccountPrivacyResponse)(nil), // 15: pb.UpdateAccountPrivacyResponse
(*CreatePersonRequest)(nil), // 8: pb.CreatePersonRequest
(*LoginResponse)(nil), // 9: pb.LoginResponse
(*RefreshTokenResponse)(nil), // 10: pb.RefreshTokenResponse
(*BlockSessionResponse)(nil), // 11: pb.BlockSessionResponse
(*GetAccountResponse)(nil), // 12: pb.GetAccountResponse
(*ListAccountsResponse)(nil), // 13: pb.ListAccountsResponse
(*CreateAccountResponse)(nil), // 14: pb.CreateAccountResponse
(*UpdateAccountResponse)(nil), // 15: pb.UpdateAccountResponse
(*UpdateAccountPrivacyResponse)(nil), // 16: pb.UpdateAccountPrivacyResponse
(*CreatePersonResponse)(nil), // 17: pb.CreatePersonResponse
}
var file_service_df_proto_depIdxs = []int32{
0, // 0: pb.df.Login:input_type -> pb.LoginRequest
@ -140,16 +151,18 @@ var file_service_df_proto_depIdxs = []int32{
5, // 5: pb.df.CreateAccount:input_type -> pb.CreateAccountRequest
6, // 6: pb.df.UpdateAccount:input_type -> pb.UpdateAccountRequest
7, // 7: pb.df.UpdateAccountPrivacy:input_type -> pb.UpdateAccountPrivacyRequest
8, // 8: pb.df.Login:output_type -> pb.LoginResponse
9, // 9: pb.df.RefreshToken:output_type -> pb.RefreshTokenResponse
10, // 10: pb.df.BlockSession:output_type -> pb.BlockSessionResponse
11, // 11: pb.df.GetAccount:output_type -> pb.GetAccountResponse
12, // 12: pb.df.ListAccounts:output_type -> pb.ListAccountsResponse
13, // 13: pb.df.CreateAccount:output_type -> pb.CreateAccountResponse
14, // 14: pb.df.UpdateAccount:output_type -> pb.UpdateAccountResponse
15, // 15: pb.df.UpdateAccountPrivacy:output_type -> pb.UpdateAccountPrivacyResponse
8, // [8:16] is the sub-list for method output_type
0, // [0:8] is the sub-list for method input_type
8, // 8: pb.df.CreatePerson:input_type -> pb.CreatePersonRequest
9, // 9: pb.df.Login:output_type -> pb.LoginResponse
10, // 10: pb.df.RefreshToken:output_type -> pb.RefreshTokenResponse
11, // 11: pb.df.BlockSession:output_type -> pb.BlockSessionResponse
12, // 12: pb.df.GetAccount:output_type -> pb.GetAccountResponse
13, // 13: pb.df.ListAccounts:output_type -> pb.ListAccountsResponse
14, // 14: pb.df.CreateAccount:output_type -> pb.CreateAccountResponse
15, // 15: pb.df.UpdateAccount:output_type -> pb.UpdateAccountResponse
16, // 16: pb.df.UpdateAccountPrivacy:output_type -> pb.UpdateAccountPrivacyResponse
17, // 17: pb.df.CreatePerson:output_type -> pb.CreatePersonResponse
9, // [9:18] is the sub-list for method output_type
0, // [0:9] 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
@ -161,6 +174,7 @@ func file_service_df_proto_init() {
return
}
file_rpc_create_account_proto_init()
file_rpc_create_person_proto_init()
file_rpc_update_account_proto_init()
file_rpc_get_account_proto_init()
file_rpc_list_accounts_proto_init()

View File

@ -307,6 +307,40 @@ func local_request_Df_UpdateAccountPrivacy_0(ctx context.Context, marshaler runt
}
func request_Df_CreatePerson_0(ctx context.Context, marshaler runtime.Marshaler, client DfClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreatePersonRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.CreatePerson(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Df_CreatePerson_0(ctx context.Context, marshaler runtime.Marshaler, server DfServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreatePersonRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.CreatePerson(ctx, &protoReq)
return msg, metadata, err
}
// RegisterDfHandlerServer registers the http handlers for service Df to "mux".
// UnaryRPC :call DfServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -513,6 +547,31 @@ func RegisterDfHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
})
mux.Handle("POST", pattern_Df_CreatePerson_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Df/CreatePerson", runtime.WithHTTPPathPattern("/v1/create_person"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Df_CreatePerson_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Df_CreatePerson_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -730,6 +789,28 @@ func RegisterDfHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
})
mux.Handle("POST", pattern_Df_CreatePerson_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pb.Df/CreatePerson", runtime.WithHTTPPathPattern("/v1/create_person"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Df_CreatePerson_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Df_CreatePerson_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -749,6 +830,8 @@ var (
pattern_Df_UpdateAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "update_account"}, ""))
pattern_Df_UpdateAccountPrivacy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "update_account_privacy"}, ""))
pattern_Df_CreatePerson_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "create_person"}, ""))
)
var (
@ -767,4 +850,6 @@ var (
forward_Df_UpdateAccount_0 = runtime.ForwardResponseMessage
forward_Df_UpdateAccountPrivacy_0 = runtime.ForwardResponseMessage
forward_Df_CreatePerson_0 = runtime.ForwardResponseMessage
)

View File

@ -27,6 +27,7 @@ const (
Df_CreateAccount_FullMethodName = "/pb.df/CreateAccount"
Df_UpdateAccount_FullMethodName = "/pb.df/UpdateAccount"
Df_UpdateAccountPrivacy_FullMethodName = "/pb.df/UpdateAccountPrivacy"
Df_CreatePerson_FullMethodName = "/pb.df/CreatePerson"
)
// DfClient is the client API for Df service.
@ -41,6 +42,7 @@ type DfClient interface {
CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...grpc.CallOption) (*CreateAccountResponse, error)
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...grpc.CallOption) (*UpdateAccountResponse, error)
UpdateAccountPrivacy(ctx context.Context, in *UpdateAccountPrivacyRequest, opts ...grpc.CallOption) (*UpdateAccountPrivacyResponse, error)
CreatePerson(ctx context.Context, in *CreatePersonRequest, opts ...grpc.CallOption) (*CreatePersonResponse, error)
}
type dfClient struct {
@ -123,6 +125,15 @@ func (c *dfClient) UpdateAccountPrivacy(ctx context.Context, in *UpdateAccountPr
return out, nil
}
func (c *dfClient) CreatePerson(ctx context.Context, in *CreatePersonRequest, opts ...grpc.CallOption) (*CreatePersonResponse, error) {
out := new(CreatePersonResponse)
err := c.cc.Invoke(ctx, Df_CreatePerson_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DfServer is the server API for Df service.
// All implementations must embed UnimplementedDfServer
// for forward compatibility
@ -135,6 +146,7 @@ type DfServer interface {
CreateAccount(context.Context, *CreateAccountRequest) (*CreateAccountResponse, error)
UpdateAccount(context.Context, *UpdateAccountRequest) (*UpdateAccountResponse, error)
UpdateAccountPrivacy(context.Context, *UpdateAccountPrivacyRequest) (*UpdateAccountPrivacyResponse, error)
CreatePerson(context.Context, *CreatePersonRequest) (*CreatePersonResponse, error)
mustEmbedUnimplementedDfServer()
}
@ -166,6 +178,9 @@ func (UnimplementedDfServer) UpdateAccount(context.Context, *UpdateAccountReques
func (UnimplementedDfServer) UpdateAccountPrivacy(context.Context, *UpdateAccountPrivacyRequest) (*UpdateAccountPrivacyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateAccountPrivacy not implemented")
}
func (UnimplementedDfServer) CreatePerson(context.Context, *CreatePersonRequest) (*CreatePersonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreatePerson not implemented")
}
func (UnimplementedDfServer) mustEmbedUnimplementedDfServer() {}
// UnsafeDfServer may be embedded to opt out of forward compatibility for this service.
@ -323,6 +338,24 @@ func _Df_UpdateAccountPrivacy_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _Df_CreatePerson_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreatePersonRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DfServer).CreatePerson(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Df_CreatePerson_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DfServer).CreatePerson(ctx, req.(*CreatePersonRequest))
}
return interceptor(ctx, in, info, handler)
}
// Df_ServiceDesc is the grpc.ServiceDesc for Df service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -362,6 +395,10 @@ var Df_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateAccountPrivacy",
Handler: _Df_UpdateAccountPrivacy_Handler,
},
{
MethodName: "CreatePerson",
Handler: _Df_CreatePerson_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_df.proto",

35
bff/proto/person.proto Normal file
View File

@ -0,0 +1,35 @@
syntax = "proto3";
package pb;
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "github.com/itsscb/df/pb";
message Person {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
json_schema: {
title: "Person";
};
example: "{\"id\": \"1\",\"email\": \"john.doe@example.com\", \"firstname\": \"John\", \"lastname\": \"Doe\", \"phone\": \"\", \"street\": \"Death Star 2\", \"zip\": \"0815\", \"city\": \"New York\", \"country\": \"USA\", \"birthday\": \"1990-10-05T00:00:00Z\", \"privacy_accepted\": false, \"privacy_accepted_date\": \"0001-01-01T00:00:00Z\", \"creator\": \"john.doe@example.com\", \"created\": \"2023-10-05T02:30:53Z\", \"changer\": \"john.doe@example.com\", \"changed\": \"2023-10-05T02:30:53Z\"}";
};
int64 account_id = 1;
string firstname = 3;
string lastname = 4;
string street = 5;
string city = 6;
string zip = 7;
string country = 8;
google.protobuf.Timestamp birthday = 9 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1990-10-05T00:00:00Z\""
}];
string creator = 10;
google.protobuf.Timestamp created = 11 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2023-10-05T00:00:00Z\""
}];
string changer = 12;
google.protobuf.Timestamp changed = 13 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2023-10-05T00:00:00Z\""
}];
}

View File

@ -45,7 +45,6 @@ message CreateAccountRequest {
}];
}
// \"1990-10-05T00:00:0Z\"
message CreateAccountResponse {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
json_schema: {

View File

@ -0,0 +1,50 @@
syntax = "proto3";
package pb;
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "person.proto";
option go_package = "github.com/itsscb/df/pb";
message CreatePersonRequest {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
json_schema: {
title: "Create Person";
description: "Create an Person";
required: [
"firstname",
"lastname",
"street",
"city",
"zip",
"country",
"birthday"
];
};
example: "{ \"account_id\": \"1\", \"firstname\": \"John\", \"lastname\": \"Doe\", \"street\": \"Main Street 1\", \"zip\": \"0815\", \"city\": \"New York\", \"country\": \"USA\", \"birthday\": \"1990-10-05T00:00:00Z\"}";
};
int64 account_id = 1;
string firstname = 2;
string lastname = 3;
string street = 4;
string city = 5;
string zip = 6;
string country = 7;
google.protobuf.Timestamp birthday = 8 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"1990-10-05T00:00:00Z\""
}];
}
message CreatePersonResponse {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
json_schema: {
title: "Created Person";
description: "Returns the created Person";
};
};
Person person = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
}];
}

View File

@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "rpc_create_account.proto";
import "rpc_create_person.proto";
import "rpc_update_account.proto";
import "rpc_get_account.proto";
import "rpc_list_accounts.proto";
@ -115,10 +116,10 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {
key: "BearerAuth";
value: {}
}
security_requirement: {
key: "BearerAuth";
value: {}
}
}
};
};
@ -129,10 +130,24 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {
key: "BearerAuth";
value: {}
}
security_requirement: {
key: "BearerAuth";
value: {}
}
}
};
};
rpc CreatePerson (CreatePersonRequest) returns (CreatePersonResponse) {
option (google.api.http) = {
post: "/v1/create_person"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {
key: "BearerAuth";
value: {}
}
}
};
};

View File

@ -7,8 +7,9 @@ import (
)
var (
isValidName = regexp.MustCompile(`^[a-zA-Z\s]+$`).MatchString
isValidAlphaNum = regexp.MustCompile(`^[a-zA-Z0-9\s]+$`).MatchString
isValidName = regexp.MustCompile(`^[a-zA-Z\s]+$`).MatchString
isValidAlphaSpace = regexp.MustCompile(`^[a-zA-Z\s]+$`).MatchString
isValidAlphaNumSpace = regexp.MustCompile(`^[a-zA-Z0-9\s]+$`).MatchString
)
func ValidateString(value string, minLength int, maxLength int) error {
@ -55,7 +56,19 @@ func ValidateStreet(value string) error {
return err
}
if !isValidAlphaNum(value) {
if !isValidAlphaNumSpace(value) {
return fmt.Errorf("must contain only letters, numbers or spaces")
}
return nil
}
func ValidateAlphaSpace(value string) error {
if err := ValidateString(value, 3, 100); err != nil {
return err
}
if !isValidAlphaSpace(value) {
return fmt.Errorf("must contain only letters, numbers or spaces")
}