fix mappers

This commit is contained in:
2026-07-26 00:20:58 +07:00
parent 6057ff38a3
commit d5a99508d3
5 changed files with 29 additions and 14 deletions
+5 -4
View File
@@ -457,10 +457,11 @@ message Scenario {
optional string description = 3; optional string description = 3;
optional string image = 4; optional string image = 4;
Story story = 5; Story story = 5;
User author = 6; string status = 6;
google.protobuf.Timestamp updated_at = 7; User author = 7;
google.protobuf.Timestamp created_at = 8; google.protobuf.Timestamp updated_at = 8;
google.protobuf.Timestamp published_at = 9; google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp published_at = 10;
} }
message Story { message Story {
Binary file not shown.
@@ -1236,6 +1236,9 @@
"story": { "story": {
"$ref": "#/definitions/evening_detective_serverStory" "$ref": "#/definitions/evening_detective_serverStory"
}, },
"status": {
"type": "string"
},
"author": { "author": {
"$ref": "#/definitions/evening_detective_serverUser" "$ref": "#/definitions/evening_detective_serverUser"
}, },
+1
View File
@@ -29,6 +29,7 @@ func mapScenario(o *scenarios_service.Scenario) *proto.Scenario {
Image: o.Image, Image: o.Image,
Story: mapStory(o.Story), Story: mapStory(o.Story),
Author: mapUser(o.Author), Author: mapUser(o.Author),
Status: o.Status,
UpdatedAt: timestamppb.New(o.UpdatedAt), UpdatedAt: timestamppb.New(o.UpdatedAt),
CreatedAt: timestamppb.New(o.CreatedAt), CreatedAt: timestamppb.New(o.CreatedAt),
PublishedAt: publishedAt, PublishedAt: publishedAt,
+20 -10
View File
@@ -1656,10 +1656,11 @@ type Scenario struct {
Description *string `protobuf:"bytes,3,opt,name=description,proto3,oneof" json:"description,omitempty"` Description *string `protobuf:"bytes,3,opt,name=description,proto3,oneof" json:"description,omitempty"`
Image *string `protobuf:"bytes,4,opt,name=image,proto3,oneof" json:"image,omitempty"` Image *string `protobuf:"bytes,4,opt,name=image,proto3,oneof" json:"image,omitempty"`
Story *Story `protobuf:"bytes,5,opt,name=story,proto3" json:"story,omitempty"` Story *Story `protobuf:"bytes,5,opt,name=story,proto3" json:"story,omitempty"`
Author *User `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"` Status string `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"`
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` Author *User `protobuf:"bytes,7,opt,name=author,proto3" json:"author,omitempty"`
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
PublishedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=published_at,json=publishedAt,proto3" json:"published_at,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
PublishedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=published_at,json=publishedAt,proto3" json:"published_at,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -1729,6 +1730,13 @@ func (x *Scenario) GetStory() *Story {
return nil return nil
} }
func (x *Scenario) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
func (x *Scenario) GetAuthor() *User { func (x *Scenario) GetAuthor() *User {
if x != nil { if x != nil {
return x.Author return x.Author
@@ -2822,19 +2830,21 @@ const file_main_proto_rawDesc = "" +
"\x02id\x18\x01 \x01(\x05R\x02id\"l\n" + "\x02id\x18\x01 \x01(\x05R\x02id\"l\n" +
"\x0eGetScenarioRsp\x12\x14\n" + "\x0eGetScenarioRsp\x12\x14\n" +
"\x05error\x18\x01 \x01(\tR\x05error\x12D\n" + "\x05error\x18\x01 \x01(\tR\x05error\x12D\n" +
"\bscenario\x18\x02 \x01(\v2(.crabs.evening_detective_server.ScenarioR\bscenario\"\xba\x03\n" + "\bscenario\x18\x02 \x01(\v2(.crabs.evening_detective_server.ScenarioR\bscenario\"\xd2\x03\n" +
"\bScenario\x12\x0e\n" + "\bScenario\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x05R\x02id\x12\x12\n" + "\x02id\x18\x01 \x01(\x05R\x02id\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\x12%\n" + "\x04name\x18\x02 \x01(\tR\x04name\x12%\n" +
"\vdescription\x18\x03 \x01(\tH\x00R\vdescription\x88\x01\x01\x12\x19\n" + "\vdescription\x18\x03 \x01(\tH\x00R\vdescription\x88\x01\x01\x12\x19\n" +
"\x05image\x18\x04 \x01(\tH\x01R\x05image\x88\x01\x01\x12;\n" + "\x05image\x18\x04 \x01(\tH\x01R\x05image\x88\x01\x01\x12;\n" +
"\x05story\x18\x05 \x01(\v2%.crabs.evening_detective_server.StoryR\x05story\x12<\n" + "\x05story\x18\x05 \x01(\v2%.crabs.evening_detective_server.StoryR\x05story\x12\x16\n" +
"\x06author\x18\x06 \x01(\v2$.crabs.evening_detective_server.UserR\x06author\x129\n" + "\x06status\x18\x06 \x01(\tR\x06status\x12<\n" +
"\x06author\x18\a \x01(\v2$.crabs.evening_detective_server.UserR\x06author\x129\n" +
"\n" + "\n" +
"updated_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\x129\n" + "updated_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\x129\n" +
"\n" + "\n" +
"created_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12=\n" + "created_at\x18\t \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12=\n" +
"\fpublished_at\x18\t \x01(\v2\x1a.google.protobuf.TimestampR\vpublishedAtB\x0e\n" + "\fpublished_at\x18\n" +
" \x01(\v2\x1a.google.protobuf.TimestampR\vpublishedAtB\x0e\n" +
"\f_descriptionB\b\n" + "\f_descriptionB\b\n" +
"\x06_image\"F\n" + "\x06_image\"F\n" +
"\x05Story\x12=\n" + "\x05Story\x12=\n" +