1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-08 05:47:07 +09:00

GO-4459: Return recommended layout for object type

This commit is contained in:
Jannis Metrikat 2025-01-09 23:08:41 +01:00
parent d8c8ce4b00
commit aeed6dcaa2
No known key found for this signature in database
GPG key ID: B223CAC5AAF85615
2 changed files with 13 additions and 11 deletions

View file

@ -75,11 +75,12 @@ type Tag struct {
}
type ObjectType struct {
Type string `json:"type" example:"object_type"`
Id string `json:"id" example:"bafyreigyb6l5szohs32ts26ku2j42yd65e6hqy2u3gtzgdwqv6hzftsetu"`
UniqueKey string `json:"unique_key" example:"ot-page"`
Name string `json:"name" example:"Page"`
Icon string `json:"icon" example:"📄"`
Type string `json:"type" example:"object_type"`
Id string `json:"id" example:"bafyreigyb6l5szohs32ts26ku2j42yd65e6hqy2u3gtzgdwqv6hzftsetu"`
UniqueKey string `json:"unique_key" example:"ot-page"`
Name string `json:"name" example:"Page"`
Icon string `json:"icon" example:"📄"`
RecommendedLayout string `json:"recommended_layout" example:"todo"`
}
type ObjectTemplate struct {

View file

@ -294,7 +294,7 @@ func (s *ObjectService) ListTypes(ctx context.Context, spaceId string, offset in
Type: model.BlockContentDataviewSort_Asc,
},
},
Keys: []string{"id", "uniqueKey", "name", "iconEmoji"},
Keys: []string{"id", "uniqueKey", "name", "iconEmoji", "recommendedLayout"},
})
if resp.Error.Code != pb.RpcObjectSearchResponseError_NULL {
@ -311,11 +311,12 @@ func (s *ObjectService) ListTypes(ctx context.Context, spaceId string, offset in
for _, record := range paginatedTypes {
objectTypes = append(objectTypes, ObjectType{
Type: "object_type",
Id: record.Fields["id"].GetStringValue(),
UniqueKey: record.Fields["uniqueKey"].GetStringValue(),
Name: record.Fields["name"].GetStringValue(),
Icon: record.Fields["iconEmoji"].GetStringValue(),
Type: "object_type",
Id: record.Fields["id"].GetStringValue(),
UniqueKey: record.Fields["uniqueKey"].GetStringValue(),
Name: record.Fields["name"].GetStringValue(),
Icon: record.Fields["iconEmoji"].GetStringValue(),
RecommendedLayout: model.ObjectTypeLayout_name[int32(record.Fields["recommendedLayout"].GetNumberValue())],
})
}
return objectTypes, total, hasMore, nil