Skip to content
Snippets Groups Projects
Commit f3f5dce8 authored by ko_oler's avatar ko_oler
Browse files

обновления после изменений в proto

parent e7f6a649
No related branches found
No related tags found
No related merge requests found
Subproject commit 3e57be95d6dc9ef3e6818e95f946ec7ee0b63dfd
Subproject commit 9d74c4186ec1deb7463ae641bbcf11b2252e664f
......@@ -22,16 +22,17 @@ type Config struct {
const StateInfoEmpty = "EMPTY"
type Space struct {
ID string `json:"id,omitempty" bson:"_id"`
OrgID string `json:"org_id,omitempty" bson:"org_id"`
Name string `json:"name,omitempty" bson:"name"`
Description string `json:"desc,omitempty" bson:"desc"`
StateInfo *StateInfo `json:"state_info,omitempty" bson:"state_info,omitempty"`
ID string `json:"id,omitempty" bson:"_id"`
OrgID string `json:"org_id,omitempty" bson:"org_id"`
Name string `json:"name,omitempty" bson:"name"`
Description string `json:"desc,omitempty" bson:"desc"`
// Deprecated
State State `json:"state" bson:"state"`
// TransferToOrg - идентификатор организации, в которую был запрошен перенос пространства
TransferToOrg string `json:"transfer_to_org" bson:"transfer_to_org"`
Config *Config `json:"config" bson:"config"`
Config *Config `json:"config" bson:"config"`
StateInfo *StateInfo `json:"state_info,omitempty" bson:"state_info,omitempty"`
}
type StateInfo struct {
......@@ -56,10 +57,12 @@ func (s Space) Fetch(i interface{}) interface{} {
return s.Name
case "Description":
return s.Description
case "StateInfo":
return s.StateInfo
case "State":
return s.State
case "Config":
return s.Config
case "StateInfo":
return s.StateInfo
default:
panic("unknown parameter")
}
......
......@@ -27,7 +27,7 @@ func PtrStateInfoToProto(stateInfo *service.StateInfo) (*pb.StateInfo, error) {
State: pb.State(stateInfo.State),
Info: stateInfo.Info,
DbVersion: int32(stateInfo.DBVersion),
StartedAt: timestamppb.New(stateInfo.StartedAt),
Time: timestamppb.New(stateInfo.StartedAt),
}, nil
}
......@@ -47,7 +47,7 @@ func ProtoToPtrStateInfo(protoStateInfo *pb.StateInfo) (*service.StateInfo, erro
return &service.StateInfo{
State: service.State(protoStateInfo.State),
Info: protoStateInfo.Info,
StartedAt: protoStateInfo.StartedAt.AsTime(),
StartedAt: protoStateInfo.Time.AsTime(),
DBVersion: uint32(protoStateInfo.DbVersion),
}, nil
}
......@@ -63,6 +63,7 @@ func PtrSpaceToProto(space *service.Space) (*pb.Space, error) {
OrgId: space.OrgID,
Name: space.Name,
Description: space.Description,
State: pb.State(space.StateInfo.State),
StateInfo: state,
Config: cfg,
TransferToOrg: space.TransferToOrg,
......@@ -81,6 +82,7 @@ func ProtoToPtrSpace(protoSpace *pb.Space) (*service.Space, error) {
Name: protoSpace.Name,
Description: protoSpace.Description,
StateInfo: state,
State: service.State(protoSpace.StateInfo.State),
Config: cfg,
TransferToOrg: protoSpace.TransferToOrg,
}, nil
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment